-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DolphinQt: Add support for a Steam Runtime build #10462
Conversation
07c9ade
to
cf84489
Compare
cf84489
to
083f761
Compare
This is going to massively bloat Externals/ -- currently the Qt submodule already wastes 0.5GB of space on macOS and Linux. Would it be possible to pull in the Qt libs at build time using CMake rather than a submodule (similar to how MoltenVK is downloaded only when necessary)? |
@leoetlino I think it should be possible. A separate git repository would probably need to be created for this, though (I can set one up on my account for now) |
@leoetlino I had a look at turning the submodule into an ExternalProject, but it seems that the |
Looks like there are alternatives to ExternalProject if you just want to clone a repo at configure time (rather than at build time): https://stackoverflow.com/a/51311151/1636285 Forgot that CMake would need to find Qt at configure time and so downloading Qt at build time would be too late, my bad. |
As far as I know, the modern CMake way to do this is FetchContent. |
083f761
to
c5cf28c
Compare
@leoetlino @AdmiralCurtiss I had no idea this existed - thanks! I've updated the PR to use |
c5cf28c
to
db1e4a7
Compare
What is the story with SteamOS and packaging Qt (is it based on debian/ubuntu, idk)? If you are building Qt from source, maybe just start with a Qt6 ? |
@shuffle2 Not SteamOS, but the Steam Runtime. The Steam Runtime provides a stable environment with common libraries and tools which can be built against. When a native Linux application is downloaded from Steam, the client downloads the Steam Runtime and runs the application in it. It's not distro-specific. More info here: https://partner.steamgames.com/doc/store/application/platforms/linux and https://github.com/ValveSoftware/steam-runtime#introduction. The new SteamOS on the Deck is Arch-based, but I think the older ones are Debian or Ubuntu based. (Also, isn't Dolphin incompatible with Qt6? I have no experience with creating Qt applications) |
OK, but for this discussion it basically means we cannot rely on Steam OS and/or Runtime to provide a recent version of Qt, so we must build it ourselves, right?
see #9669 (specifically #9669 (comment) ) - it's not hard to enable qt6 compat, but we are currently blocked on debian packaging of qt6 taking a long time. I'm just wondering if:
Not saying Qt6 stuff needs to be tied to Steam support in any way, just suggesting that it might make things easier in the long run, but idk 🤷♂️ |
Yes, I had to build it myself. The Runtime doesn't ship with a copy of Qt.
During testing for this PR, I at one point ran Dolphin outside of the Runtime (with the Runtime-compiled Qt and Manjaro system libraries) and it crashed. |
Sounds funky! |
Similar to my comment on #10516, let's try to avoid hiding too much magic/implicit behavior behind a STEAM_RUNTIME flag. Stuff like "not linking with libpng" should be separate options that we happen to enable on the SteamRT builder by default. We probably still want some flag to have cmake copy the right files to generate an "app bundle" for SteamRT, but that flag should be additional behavior, not controlling behavior re: dependencies and such. Does this make sense? |
db1e4a7
to
0ee3c12
Compare
0ee3c12
to
20b01db
Compare
20b01db
to
8c59cf6
Compare
I solved the The problem appears to involve accessing free'd memory in |
cd6f27d
to
aeeb58d
Compare
OK, I think this is about ready now. Addressed all comments, cleaned up the commits, and the unit tests no longer fail when running them within the runtime. I've been uploading builds made with this PR to Steam and they seem to work fine. |
@dolphin-emu-bot rebuild |
@@ -607,6 +607,12 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND STEAM) | |||
BUILD_WITH_INSTALL_RPATH true | |||
INSTALL_RPATH "\$ORIGIN/lib" | |||
) | |||
|
|||
add_custom_command(TARGET dolphin-emu POST_BUILD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this isn't done all the time? Is Qt managed by the system or do we have a special build like on Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no Qt present in the steamrt, so yes, we provide our own build. It's not in a submodule, though. I believe we will just have it on the builder.
@@ -593,6 +593,22 @@ else() | |||
install(TARGETS dolphin-emu RUNTIME DESTINATION ${bindir}) | |||
endif() | |||
|
|||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND STEAM) | |||
# Set that we want ORIGIN in FLAGS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could possibly use BUILD_RPATH_USE_ORIGIN
though that wouldn't allow you to disable the tags...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I tried that earlier and it used RUNPATH?
const auto it = std::find_if(old_parent->children.begin(), old_parent->children.end(), | ||
GetNamePredicate(split_old_path.file_name)); | ||
if (it != old_parent->children.end()) | ||
{ | ||
*new_entry = *it; | ||
new_entry->data = it->data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it doesn't matter but this is different behavior than before because all of the FstEntry
isn't copied. It'd be nice to keep the copy constructor behavior. What was the ut failure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any test that attempted using Rename would crash when running it within the steamrt. I posted a valgrind output in a comment above.
The Sys folder should be included along with the executable.
This type is already declared in glxext.h in the Steam Runtime.
…n Steam builds for Linux We will store our Qt shared libraries here.
… builds for Linux
aeeb58d
to
2648837
Compare
Looks like reviews have essentially finished. I asked a couple of times if anyone else had any qualms and/or concerns, and no one has spoken up. Let us get the ball rolling. |
This PR adds an easy flag to disable/enable things necessary for a Steam build, and makes changes to DolphinQt to create a build that will run in the Steam Runtime.
I built and tested this PR with Steam Runtime version 1,
scout
, using the revision currently being used in general availability with the Steam client (which is what Valve recommends for games).Building
Building Dolphin for the Steam Runtime is just like building for a regular Linux system. However, it must must be done within the Steam Runtime environment to prevent system libraries leaking into the application. A chroot environment or Docker container can be used, as outlined here.
Some extra CMake flags are required to produce a Steam Runtime build, as some libraries included in the runtime are too old. The recommended cmake configuration command is:
cmake .. -G Ninja -DCMAKE_C_COMPILER="gcc-9" -DCMAKE_CXX_COMPILER="g++-9" -DENABLE_EVDEV=OFF -DENABLE_LLVM=OFF -DUSE_SHARED_LIBPNG=OFF -DSTEAM=ON -DENABLE_SDL=ON -DCMAKE_PREFIX_PATH=/path/to/qt
Running
Running a build can occur on any Linux machine. However, it is not possible to run Dolphin within the chroot environment or the Docker container used for building, due to libusb initialization on startup.
First, make sure the scout runtime is installed. This can be done by copying and pasting the following into the address bar
Then, run the build:
./steam-runtime/run.sh ./dolphin-emu
Acknowledgements
Thanks to delroth, Techjar, and Warepire for their help getting DolphinQt working.