Skip to content
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

ShaderLang.h GLSLANG_EXPORT is not working properly #2884

Closed
SamCZ opened this issue Feb 3, 2022 · 2 comments
Closed

ShaderLang.h GLSLANG_EXPORT is not working properly #2884

SamCZ opened this issue Feb 3, 2022 · 2 comments

Comments

@SamCZ
Copy link

SamCZ commented Feb 3, 2022

Hi, I tried to link glslang as shared library, but I'm having issue with whole ShaderLang.h file.

This is my setup

if(NOT TARGET glslang)
    set(SKIP_GLSLANG_INSTALL ON)
    set(ENABLE_HLSL OFF)
    set(BUILD_EXTERNAL OFF)
    set(BUILD_SHARED_LIBS ON)
    add_subdirectory(glslang)
endif()

I link glslang to my dynamic linked engine that is in used in my game.

I use MingW with 10.2.0 GCC and cmake build system.

Weird thing is that I can see the preprocessor definition GLSLANG_IS_SHARED_LIBRARY set in glslang_c_interface.h correctly, but when I look in ShaderLang.h its not set. I tried to look at ninja build file and its set there.

I tried reloading cmake, deleting whole build folder, disabling PCH and nothing worked.

This is error that is shown building my engine

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lib/Aurora/CMakeFiles/Aurora.dir/src/Aurora/Graphics/OpenGL/GLRenderDevice.cpp.obj: in function `Aurora::GLRenderDevice::~GLRenderDevice()':
E:/Sam2/Sam/Projects/EmberSky/lib/Aurora/src/Aurora/Graphics/OpenGL/GLRenderDevice.cpp:177: undefined reference to `__imp__ZN7glslang15FinalizeProcessEv'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lib/Aurora/CMakeFiles/Aurora.dir/src/Aurora/Graphics/OpenGL/GLRenderDevice.cpp.obj: in function `Aurora::GLRenderDevice::CreateShaderProgram(Aurora::ShaderProgramDesc const&)':
E:/Sam2/Sam/Projects/EmberSky/lib/Aurora/src/Aurora/Graphics/OpenGL/GLRenderDevice.cpp:512: undefined reference to `__imp__ZN7glslang7TShaderC1E11EShLanguage'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/Sam2/Sam/Projects/EmberSky/lib/Aurora/src/Aurora/Graphics/OpenGL/GLRenderDevice.cpp:517: undefined reference to `__imp__ZN7glslang7TShader13setEntryPointEPKc'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/Sam2/Sam/Projects/EmberSky/lib/Aurora/src/Aurora/Graphics/OpenGL/GLRenderDevice.cpp:525: undefined reference to `__imp__ZN7glslang7TShader29setStringsWithLengthsAndNamesEPKPKcPKiS4_i'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/Sam2/Sam/Projects/EmberSky/lib/Aurora/src/Aurora/Graphics/OpenGL/GLRenderDevice.cpp:526: undefined reference to `__imp__ZN7glslang7TShader18setAutoMapBindingsEb'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/Sam2/Sam/Projects/EmberSky/lib/Aurora/src/Aurora/Graphics/OpenGL/GLRenderDevice.cpp:530: undefined reference to `__imp__ZN7glslang7TShader10preprocessEPK16TBuiltInResourcei8EProfilebb11EShMessagesPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS0_8IncluderE'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/Sam2/Sam/Projects/EmberSky/lib/Aurora/src/Aurora/Graphics/OpenGL/GLRenderDevice.cpp:532: undefined reference to `__imp__ZN7glslang7TShader15getInfoDebugLogEv'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/Sam2/Sam/Projects/EmberSky/lib/Aurora/src/Aurora/Graphics/OpenGL/GLRenderDevice.cpp:532: undefined reference to `__imp__ZN7glslang7TShader10getInfoLogEv'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lib/Aurora/CMakeFiles/Aurora.dir/src/Aurora/Graphics/OpenGL/GLRenderDevice.cpp.obj: in function `Aurora::GLRenderDevice::Init()':
E:/Sam2/Sam/Projects/EmberSky/lib/Aurora/src/Aurora/Graphics/OpenGL/GLRenderDevice.cpp:184: undefined reference to `__imp__ZN7glslang17InitializeProcessEv'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/Sam2/Sam/Projects/EmberSky/lib/Aurora/src/Aurora/Graphics/OpenGL/GLRenderDevice.cpp:243: undefined reference to `__imp__ZN7glslang20GetGlslVersionStringEv'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

@greg-lunarg
Copy link
Contributor

At the moment glslang is not supporting a shared build and not creating any shared objects. This is a known problem. See #2283 #2346 #2196.

I would recommend statically linking until this is fixed.

@SamCZ
Copy link
Author

SamCZ commented Feb 3, 2022

ok thanks for the info and sorry for the duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants