google / shaderc

A collection of tools, libraries, and tests for Vulkan shader compilation.
Other
1.86k stars 363 forks source link

shaderc from VulkanSDK is giving undefined references on basically everything while linking #1446

Closed exa211 closed 1 month ago

exa211 commented 1 month ago

I want to use the precompiled static shaderc_combined.lib from VulkanSDK 1.3.290 and i cannot get it to link properly. Shaderc's includes are handled through ${Vulkan_INCLUDE_DIRS} I'm using mingw with clion and gcc on windows.

CMakeLists.txt:

cmake_minimum_required(VERSION 3.29.3)
project(Vulkan_Base)

set(CMAKE_CXX_STANDARD 17)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "build")

# VULKAN
find_package(Vulkan 1.3.290 EXACT REQUIRED COMPONENTS shaderc_combined)
include_directories(${Vulkan_INCLUDE_DIRS})

add_subdirectory(lib/VulkanMemoryAllocator)
include_directories(lib/VulkanMemoryAllocator/include)

... other dependencies

add_executable(Vulkan_Base
   ... project sources
)

target_link_libraries(Vulkan_Base PUBLIC
        ${Vulkan_LIBRARIES}
        Vulkan::shaderc_combined)

Here is a small snippet from the build output:

290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x45f): undefined reference to `__security_check_cookie'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x476): undefined reference to `?_Xlen_string@std@@YAXXZ'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x14): undefined reference to `__security_cookie'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x72): undefined reference to `??8TType@glslang@@QEBA_NAEBV01@@Z'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x10f): undefined reference to `?getCompleteString@TType@glslang@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$pool_allocator@D@glslang@@@std@@_N000V34@1@Z'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x1a9): undefined reference to `?getCompleteString@TType@glslang@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$pool_allocator@D@glslang@@@std@@_N000V34@1@Z'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x20a): undefined reference to `__security_check_cookie'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x112): undefined reference to `??8TType@glslang@@QEBA_NAEBV01@@Z'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x37): undefined reference to `?shallowCopy@TType@glslang@@QEAAXAEBV12@@Z'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x1eb): undefined reference to `?computeNumComponents@TType@glslang@@QEBAHXZ'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x271): undefined reference to `?computeNumComponents@TType@glslang@@QEBAHXZ'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x407): undefined reference to `?computeNumComponents@TType@glslang@@QEBAHXZ'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x709): undefined reference to `??8TType@glslang@@QEBA_NAEBV01@@Z'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x771): undefined reference to `?computeNumComponents@TType@glslang@@QEBAHXZ'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x18): undefined reference to `__security_cookie'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x41): undefined reference to `?computeNumComponents@TType@glslang@@QEBAHXZ'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x4b): undefined reference to `?computeNumComponents@TType@glslang@@QEBAHXZ'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0xce): undefined reference to `??0TType@glslang@@QEAA@AEBV01@H_N@Z'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0xe1): undefined reference to `??0TType@glslang@@QEAA@AEBV01@H_N@Z'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x15b): undefined reference to `??0TType@glslang@@QEAA@W4TBasicType@1@W4TStorageQualifier@1@HHH_N@Z'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0x3a9): undefined reference to `__security_check_cookie'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0xe): undefined reference to `__security_cookie'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0xa3): undefined reference to `??0TType@glslang@@QEAA@W4TBasicType@1@W4TStorageQualifier@1@HHH_N@Z'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/VulkanSDK/1.3.290.0/Lib/shaderc_combined.lib(C:/j/msdk0/build/shaderc/repo/src/build/third_party/glslang/glslang/MachineIndependent.dir/Release/hlslParseHelper.obj):(.text$mn+0xc6): undefined reference to `__security_check_cookie'

and here the entire build output: build_output.txt

Am i missing something or am i doing something wrong?

exa211 commented 1 month ago

Resolved. shaderc_combined.lib from VulkanSDK is compiled with MSVC on windows making it obviously uncompatible with MinGW and GCC. I compiled with CMake and MinGW from source now and it works.