Linux (Arch Linux x86_64): Linking Fails Against Glslang 13.1.1 #1034

Open
opened 2023-11-30 16:51:44 -03:00 by V0rt3x667 · 9 comments
V0rt3x667 commented 2023-11-30 16:51:44 -03:00 (Migrated from github.com)

I am trying to build Cemu on Arch Linux for x86_64 and linking fails against the Glslang library. Arch Linux is currently using Glslang version 13.1.1.

Initially I got the following error message which I fixed by changing glslang::SPIRV to glslang in /src/Cafe/CMakeLists.txt.

image

The build then proceeds until the linking stage where it then fails with the following error message.

image

I have tried compiling with Clang 16.0.6 and the LLD linker, Clang and the GCC (Gold) Linker and GCC 13.2.1 and the GCC (Gold) Linker. My build flags are:

cmake .
-B"build"
-G"Ninja"
-DCMAKE_BUILD_RPATH_USE_ORIGIN="ON"
-DCMAKE_BUILD_TYPE="Release"
-DCMAKE_INSTALL_PREFIX="${md_inst}"
-DCMAKE_C_COMPILER="clang"
-DCMAKE_CXX_COMPILER="clang++"
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld"
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld"
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld"
-DCMAKE_CXX_FLAGS="${CXXFLAGS} -I/usr/include/glslang"
-DENABLE_VCPKG="OFF"
-DPORTABLE="OFF"
-Wno-dev
ninja -C build

Thanks for your help.

I am trying to build Cemu on Arch Linux for x86_64 and linking fails against the Glslang library. Arch Linux is currently using Glslang version 13.1.1. Initially I got the following error message which I fixed by changing glslang::SPIRV to glslang in /src/Cafe/CMakeLists.txt. ![image](https://github.com/cemu-project/Cemu/assets/25441654/24ba0287-b8ca-48b0-bd7d-a6d78dd76fc3) The build then proceeds until the linking stage where it then fails with the following error message. ![image](https://github.com/cemu-project/Cemu/assets/25441654/acb7fe68-029c-4ed3-87ce-d1e6865686c8) I have tried compiling with Clang 16.0.6 and the LLD linker, Clang and the GCC (Gold) Linker and GCC 13.2.1 and the GCC (Gold) Linker. My build flags are: cmake . \ -B"build" \ -G"Ninja" \ -DCMAKE_BUILD_RPATH_USE_ORIGIN="ON" \ -DCMAKE_BUILD_TYPE="Release" \ -DCMAKE_INSTALL_PREFIX="${md_inst}" \ -DCMAKE_C_COMPILER="clang" \ -DCMAKE_CXX_COMPILER="clang++" \ -DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" \ -DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" \ -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \ -DCMAKE_CXX_FLAGS="${CXXFLAGS} -I/usr/include/glslang" \ -DENABLE_VCPKG="OFF" \ -DPORTABLE="OFF" \ -Wno-dev ninja -C build Thanks for your help.
Squall-Leonhart commented 2023-11-30 23:40:51 -03:00 (Migrated from github.com)
Upstream problem, refer to https://github.com/KhronosGroup/glslang/issues/3065
hummeltech commented 2023-12-03 16:26:58 -03:00 (Migrated from github.com)

@V0rt3x667, I was able to get it to build successfully with this patch:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9dc1a6f2..025286b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -129,7 +129,7 @@ find_package(pugixml REQUIRED)
 find_package(RapidJSON REQUIRED)
 find_package(Boost COMPONENTS program_options filesystem nowide REQUIRED)
 find_package(libzip REQUIRED)
-find_package(glslang REQUIRED)
+find_package(Vulkan COMPONENTS glslang REQUIRED)
 find_package(ZLIB REQUIRED)
 find_package(zstd MODULE REQUIRED) # MODULE so that zstd::zstd is available
 find_package(OpenSSL COMPONENTS Crypto SSL REQUIRED)
@@ -137,11 +137,6 @@ find_package(glm REQUIRED)
 find_package(fmt 9 REQUIRED)
 find_package(PNG REQUIRED)
 
-# glslang versions older than 11.11.0 define targets without a namespace
-if (NOT TARGET glslang::SPIRV AND TARGET SPIRV)
-       add_library(glslang::SPIRV ALIAS SPIRV)
-endif()
-
 if (UNIX AND NOT APPLE)
        find_package(X11 REQUIRED)
        if (ENABLE_WAYLAND)
diff --git a/src/Cafe/CMakeLists.txt b/src/Cafe/CMakeLists.txt
index 29c5a0b3..4d0e8def 100644
--- a/src/Cafe/CMakeLists.txt
+++ b/src/Cafe/CMakeLists.txt
@@ -516,7 +516,7 @@ target_link_libraries(CemuCafe PRIVATE
        Boost::nowide
        CURL::libcurl
        fmt::fmt
-       glslang::SPIRV
+       Vulkan::glslang
        ih264d
        OpenSSL::Crypto
        OpenSSL::SSL
@V0rt3x667, I was able to get it to build successfully with this patch: ```diff diff --git a/CMakeLists.txt b/CMakeLists.txt index 9dc1a6f2..025286b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,7 +129,7 @@ find_package(pugixml REQUIRED) find_package(RapidJSON REQUIRED) find_package(Boost COMPONENTS program_options filesystem nowide REQUIRED) find_package(libzip REQUIRED) -find_package(glslang REQUIRED) +find_package(Vulkan COMPONENTS glslang REQUIRED) find_package(ZLIB REQUIRED) find_package(zstd MODULE REQUIRED) # MODULE so that zstd::zstd is available find_package(OpenSSL COMPONENTS Crypto SSL REQUIRED) @@ -137,11 +137,6 @@ find_package(glm REQUIRED) find_package(fmt 9 REQUIRED) find_package(PNG REQUIRED) -# glslang versions older than 11.11.0 define targets without a namespace -if (NOT TARGET glslang::SPIRV AND TARGET SPIRV) - add_library(glslang::SPIRV ALIAS SPIRV) -endif() - if (UNIX AND NOT APPLE) find_package(X11 REQUIRED) if (ENABLE_WAYLAND) diff --git a/src/Cafe/CMakeLists.txt b/src/Cafe/CMakeLists.txt index 29c5a0b3..4d0e8def 100644 --- a/src/Cafe/CMakeLists.txt +++ b/src/Cafe/CMakeLists.txt @@ -516,7 +516,7 @@ target_link_libraries(CemuCafe PRIVATE Boost::nowide CURL::libcurl fmt::fmt - glslang::SPIRV + Vulkan::glslang ih264d OpenSSL::Crypto OpenSSL::SSL ```
V0rt3x667 commented 2023-12-03 19:31:22 -03:00 (Migrated from github.com)

Thank you very much, the patch worked a treat.

Thank you very much, the patch worked a treat.
hirak99 commented 2023-12-06 20:30:55 -03:00 (Migrated from github.com)

Should we incorporate the patch into this repo?

Should we incorporate the patch into this repo?
hummeltech commented 2023-12-06 20:35:54 -03:00 (Migrated from github.com)

@hirak99, I thought about it, however the minimum version of CMake would need to be increased to v3.24 (it's already at v3.21.1) (see docs here) and it might also break compatibility with older versions of glslang (but probably not). Therefore, some discussions need to take place. There is likely a very simple fix that can be applied to re-add support for older versions of glslang (if it does indeed break it.)

@hirak99, I thought about it, however the minimum version of `CMake` would need to be increased to `v3.24` (it's already at [`v3.21.1`](https://github.com/cemu-project/Cemu/blob/main/CMakeLists.txt#L1C1-L1C1)) (see [docs here](https://cmake.org/cmake/help/latest/module/FindVulkan.html#optional-components)) and it might also break compatibility with older versions of `glslang` (but probably not). Therefore, some discussions need to take place. There is likely a very simple fix that can be applied to re-add support for older versions of `glslang` (if it does indeed break it.)
hirak99 commented 2023-12-07 11:59:44 -03:00 (Migrated from github.com)

Thanks @hummeltech, makes sense. May be instead the arch PKGBUILD can include this patch for the time being.

Thanks @hummeltech, makes sense. May be instead the arch PKGBUILD can include this patch for the time being.
kescherCode commented 2023-12-21 22:01:04 -03:00 (Migrated from github.com)

Patch included in the AUR package for the time being. Thanks for writing the patch, @hummeltech!

Patch included in the AUR package for the time being. Thanks for writing the patch, @hummeltech!
hummeltech commented 2023-12-22 15:55:43 -03:00 (Migrated from github.com)

Thanks for that @kescherCode!

Thanks for that @kescherCode!
kescherCode commented 2024-02-24 09:00:39 -03:00 (Migrated from github.com)

Linking works against glslang 14. The AUR package will have the patch removed, and the requirement set to require at least glslang 14, as that's the latest version on Arch.

Linking works against glslang 14. The AUR package will have the patch removed, and the requirement set to require at least glslang 14, as that's the latest version on Arch.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: cemu-project_Mirror/Cemu-2024-03-05#1034
No description provided.