From d306ebea3088611aacf4d06f2bc52dd3b7da41b7 Mon Sep 17 00:00:00 2001 From: reg_server Date: Fri, 3 Jan 2025 19:49:07 +0100 Subject: [PATCH] Linux Build Fixes - fixed AppImage not accepting arguments (for example -f -g ROM_file to start directly) - adjusted AppImage build.sh so it can find Qt libs on Fedora (#98) - perl-Digest-SHA package is needed for shasum on Fedora - added option do disable linking against LLVM 17 (Steam Deck specific) - updated build-for-linux.md (Steam Deck specific) --- AppImageBuilder/assets_aarch64/AppRun | 6 ++--- AppImageBuilder/assets_aarch64/yuzu-bwrap.sh | 4 +-- AppImageBuilder/assets_aarch64/yuzu.sh | 2 +- AppImageBuilder/assets_x86_64/AppRun | 10 ++++---- AppImageBuilder/assets_x86_64/yuzu-bwrap.sh | 8 +++--- AppImageBuilder/assets_x86_64/yuzu.sh | 2 +- AppImageBuilder/build.sh | 26 ++++++++++++++------ CMakeLists.txt | 6 ++++- build-for-linux.md | 20 ++++++++++++++- 9 files changed, 58 insertions(+), 26 deletions(-) diff --git a/AppImageBuilder/assets_aarch64/AppRun b/AppImageBuilder/assets_aarch64/AppRun index 829f33ba7..137ad6f0f 100755 --- a/AppImageBuilder/assets_aarch64/AppRun +++ b/AppImageBuilder/assets_aarch64/AppRun @@ -3,11 +3,11 @@ cd "$APPDIR" if [ -d /usr/lib/aarch64-linux-gnu/qt5 ]; then - exec ./yuzu-bwrap.sh + exec ./yuzu-bwrap.sh "$@" else if [ -d /usr/lib/aarch64-linux-gnu/qt6 ]; then - exec ./yuzu-bwrap.sh + exec ./yuzu-bwrap.sh "$@" else - exec ./yuzu.sh + exec ./yuzu.sh "$@" fi fi diff --git a/AppImageBuilder/assets_aarch64/yuzu-bwrap.sh b/AppImageBuilder/assets_aarch64/yuzu-bwrap.sh index d3c234cdb..ea2f51eb7 100755 --- a/AppImageBuilder/assets_aarch64/yuzu-bwrap.sh +++ b/AppImageBuilder/assets_aarch64/yuzu-bwrap.sh @@ -1,8 +1,8 @@ #! /bin/sh if [ -d /usr/lib/aarch64-linux-gnu/qt5 ]; then - exec ./bwrap --dev-bind / / --tmpfs /usr/lib/aarch64-linux-gnu/qt5 ./yuzu.sh + exec ./bwrap --dev-bind / / --tmpfs /usr/lib/aarch64-linux-gnu/qt5 ./yuzu.sh "$@" else if [ -d /usr/lib/aarch64-linux-gnu/qt6 ]; then - exec ./bwrap --dev-bind / / --tmpfs /usr/lib/aarch64-linux-gnu/qt6 ./yuzu.sh + exec ./bwrap --dev-bind / / --tmpfs /usr/lib/aarch64-linux-gnu/qt6 ./yuzu.sh "$@" fi fi diff --git a/AppImageBuilder/assets_aarch64/yuzu.sh b/AppImageBuilder/assets_aarch64/yuzu.sh index 561ae269c..74b2669ce 100755 --- a/AppImageBuilder/assets_aarch64/yuzu.sh +++ b/AppImageBuilder/assets_aarch64/yuzu.sh @@ -3,4 +3,4 @@ # NOTE: the `ld-linux-aarch64.so.1` filename came from a pi debian 11 installation, # this may be incorrect for a different or more up-to-date system. # Can find out the correct filename using command "ldd yuzu" on the non-AppImage app -QT_QPA_PLATFORM=xcb QT_PLUGIN_PATH=. exec ./ld-linux-aarch64.so.1 --library-path . ./yuzu +QT_QPA_PLATFORM=xcb QT_PLUGIN_PATH=. exec ./ld-linux-aarch64.so.1 --library-path . ./yuzu "$@" diff --git a/AppImageBuilder/assets_x86_64/AppRun b/AppImageBuilder/assets_x86_64/AppRun index 524559c15..1faaed208 100755 --- a/AppImageBuilder/assets_x86_64/AppRun +++ b/AppImageBuilder/assets_x86_64/AppRun @@ -4,21 +4,21 @@ cd "$APPDIR" # default qt5 location if [ -d /usr/lib/x86_64-linux-gnu/qt5 ]; then - exec ./yuzu-bwrap.sh + exec ./yuzu-bwrap.sh "$@" else # qt5 on Steam Deck (as qt) if [ -d /usr/lib/qt ]; then - exec ./yuzu-bwrap.sh + exec ./yuzu-bwrap.sh "$@" else # default qt6 location if [ -d /usr/lib/x86_64-linux-gnu/qt6 ]; then - exec ./yuzu-bwrap.sh + exec ./yuzu-bwrap.sh "$@" else # qt6 on Steam Deck if [ -d /usr/lib/qt6 ]; then - exec ./yuzu-bwrap.sh + exec ./yuzu-bwrap.sh "$@" else - exec ./yuzu.sh + exec ./yuzu.sh "$@" fi fi fi diff --git a/AppImageBuilder/assets_x86_64/yuzu-bwrap.sh b/AppImageBuilder/assets_x86_64/yuzu-bwrap.sh index 9757f5bea..240fe648d 100755 --- a/AppImageBuilder/assets_x86_64/yuzu-bwrap.sh +++ b/AppImageBuilder/assets_x86_64/yuzu-bwrap.sh @@ -2,19 +2,19 @@ # default qt5 location if [ -d /usr/lib/x86_64-linux-gnu/qt5 ]; then - exec ./bwrap --dev-bind / / --tmpfs /usr/lib/x86_64-linux-gnu/qt5 ./yuzu.sh + exec ./bwrap --dev-bind / / --tmpfs /usr/lib/x86_64-linux-gnu/qt5 ./yuzu.sh "$@" else # qt5 on Steam Deck (as qt) if [ -d /usr/lib/qt ]; then - exec ./bwrap --dev-bind / / --tmpfs /usr/lib/qt ./yuzu.sh + exec ./bwrap --dev-bind / / --tmpfs /usr/lib/qt ./yuzu.sh "$@" else # default qt6 location if [ -d /usr/lib/x86_64-linux-gnu/qt6 ]; then - exec ./bwrap --dev-bind / / --tmpfs /usr/lib/x86_64-linux-gnu/qt6 ./yuzu.sh + exec ./bwrap --dev-bind / / --tmpfs /usr/lib/x86_64-linux-gnu/qt6 ./yuzu.sh "$@" else # qt6 on Steam Deck if [ -d /usr/lib/qt6 ]; then - exec ./bwrap --dev-bind / / --tmpfs /usr/lib/qt6 ./yuzu.sh + exec ./bwrap --dev-bind / / --tmpfs /usr/lib/qt6 ./yuzu.sh "$@" fi fi fi diff --git a/AppImageBuilder/assets_x86_64/yuzu.sh b/AppImageBuilder/assets_x86_64/yuzu.sh index a0e3672fd..43ad5ec41 100755 --- a/AppImageBuilder/assets_x86_64/yuzu.sh +++ b/AppImageBuilder/assets_x86_64/yuzu.sh @@ -1,2 +1,2 @@ #! /bin/sh -QT_QPA_PLATFORM=xcb QT_PLUGIN_PATH=. exec ./ld-linux-x86-64.so.2 --library-path . ./yuzu +QT_QPA_PLATFORM=xcb QT_PLUGIN_PATH=. exec ./ld-linux-x86-64.so.2 --library-path . ./yuzu "$@" diff --git a/AppImageBuilder/build.sh b/AppImageBuilder/build.sh index b74bc6268..671bfcc7f 100755 --- a/AppImageBuilder/build.sh +++ b/AppImageBuilder/build.sh @@ -11,6 +11,7 @@ fi # Get paths ARCH="$(uname -m)" SYSTEM_LIBS="/usr/lib" +SYSTEM_LIBS64="/usr/lib64" YUZU_BIN="${1}/bin" YUZU_BIN_GUI="${YUZU_BIN}/yuzu" @@ -24,20 +25,29 @@ rm -rf build mkdir build # NOTE: some of these aren't used now, but can be reordered in priority when torzu is converted to QT6 -# Find QT folder (Steam Deck fix), check for default qt5 first +# QT5 - /usr/lib/${ARCH}-linux-gnu/qt5 (debian), /usr/lib64/qt5 (fedora), /usr/lib/qt (steam deck) +# QT5 - /usr/lib/${ARCH}-linux-gnu/qt6 (debian), /usr/lib64/qt6 (fedora), /usr/lib/qt6 (steam deck) QTFOUND="true" QTDIR="$SYSTEM_LIBS"/${ARCH}-linux-gnu/qt5/plugins if [ ! -d "$QTDIR" ]; then - # default qt5 folder not found, check for Steam Deck qt (qt5) folder - QTDIR="$SYSTEM_LIBS"/qt/plugins + # default qt5 folder not found, check for 64-bit qt5 folder + QTDIR="$SYSTEM_LIBS64"/qt5/plugins if [ ! -d "$QTDIR" ]; then - # Steam Deck qt (qt5) folder not found, check for regular qt6 folder - QTDIR="$SYSTEM_LIBS"/${ARCH}-linux-gnu/qt6/plugins + # 64-bit qt5 folder not found, check for Steam Deck qt (qt5) folder + QTDIR="$SYSTEM_LIBS"/qt/plugins if [ ! -d "$QTDIR" ]; then - # regular qt6 folder not found, check for Steam Deck qt6 folder - QTDIR="$SYSTEM_LIBS"/qt6/plugins + # Steam Deck qt (qt5) folder not found, check for regular qt6 folder + QTDIR="$SYSTEM_LIBS"/${ARCH}-linux-gnu/qt6/plugins if [ ! -d "$QTDIR" ]; then - QTFOUND="false" + # regular qt6 folder not found, check for 64-bit qt6 folder + QTDIR="$SYSTEM_LIBS64"/qt6/plugins + if [ ! -d "$QTDIR" ]; then + # 64-bit qt6 folder not found, check for Steam Deck qt6 folder + QTDIR="$SYSTEM_LIBS"/qt6/plugins + if [ ! -d "$QTDIR" ]; then + QTFOUND="false" + fi + fi fi fi fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 034fcd5af..8da828efb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,8 @@ option(YUZU_DOWNLOAD_TIME_ZONE_DATA "Always download time zone binaries" OFF) option(YUZU_ENABLE_PORTABLE "Allow yuzu to enable portable mode if a user folder is found in the CWD" ON) +option(YUZU_USE_LLVM_DEMANGLE "Use LLVM Demangle" ON) + CMAKE_DEPENDENT_OPTION(YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "NOT WIN32" OFF) CMAKE_DEPENDENT_OPTION(USE_SYSTEM_MOLTENVK "Use the system MoltenVK lib (instead of the bundled one)" OFF "APPLE" OFF) @@ -299,7 +301,9 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) find_package(Boost 1.79.0 REQUIRED context) find_package(enet 1.3 MODULE) find_package(fmt REQUIRED) -find_package(LLVM 17.0.2 MODULE COMPONENTS Demangle) +if (YUZU_USE_LLVM_DEMANGLE) + find_package(LLVM 17.0.2 MODULE COMPONENTS Demangle) +endif() find_package(lz4 REQUIRED) find_package(nlohmann_json 3.8 REQUIRED) find_package(Opus 1.3 MODULE) diff --git a/build-for-linux.md b/build-for-linux.md index 3b230fbbd..17fccbd67 100644 --- a/build-for-linux.md +++ b/build-for-linux.md @@ -128,7 +128,7 @@ All other dependencies will be downloaded by [vcpkg](https://vcpkg.io/) if neede - Fedora: ```bash - sudo dnf install autoconf ccache cmake ffmpeg-devel fmt-devel gcc{,-c++} glslang hidapi-devel json-devel libtool libusb1-devel libXext-devel libzstd-devel lz4-devel nasm ninja-build openssl-devel pulseaudio-libs-devel qt5-linguist qt5-qtbase{-private,}-devel qt5-qtmultimedia-devel qt5-qtwebengine-devel shasum speexdsp-devel wayland-devel zlib-devel + sudo dnf install autoconf ccache cmake ffmpeg-devel fmt-devel gcc{,-c++} glslang hidapi-devel json-devel libtool libusb1-devel libXext-devel libzstd-devel lz4-devel nasm ninja-build openssl-devel pulseaudio-libs-devel qt5-linguist qt5-qtbase{-private,}-devel qt5-qtmultimedia-devel qt5-qtwebengine-devel shasum speexdsp-devel wayland-devel zlib-devel perl-Digest-SHA ``` - Fedora 32 or later is required. - Due to GCC 12, Fedora 36 or later users need to install `clang`, and configure CMake to use it via `-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang` @@ -173,6 +173,24 @@ mkdir build && cd build cmake .. -GNinja -DYUZU_USE_BUNDLED_VCPKG=ON -DYUZU_TESTS=OFF ninja ``` + +If building for the Steam Deck and you have LLVM 17 installed, you need to disable linking against it in the CMake command. The Steam Deck, as of SteamOS v3.6.20, includes `libLLVM-16`. + +To verify which libraries your application is linking against, you can use the ldd command. For example: + +```bash +ldd torzu/build/bin/yuzu +``` + +Look for entries related to `libLLVM` (or grep the ldd output). If it shows `libLLVM-17`, you need to adjust your configuration. + +Use the following CMake command to disable linking against LLVM 17, instead of the one above: + +```bash +cmake .. -GNinja -DYUZU_USE_BUNDLED_VCPKG=ON -DYUZU_TESTS=OFF -DYUZU_USE_LLVM_DEMANGLE=OFF +ninja +``` + There should now be executable binaries located in the `torzu/build/bin` folder. You can choose to (all starting from the `build` folder):