Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Build error with glslang #95

Open
Ravbug opened this issue Sep 16, 2020 · 3 comments
Open

Build error with glslang #95

Ravbug opened this issue Sep 16, 2020 · 3 comments

Comments

@Ravbug
Copy link

Ravbug commented Sep 16, 2020

In my CMakeLists.txt:

# bgfx
set(BGFX_BUILD_EXAMPLES OFF)
set(BGFX_INSTALL_EXAMPLES OFF)
set(BGFX_INSTALL OFF)
add_subdirectory("${DEPS_DIR}/bgfx.cmake")

I get the following compilation error on Windows (VS 2019):

bgfx.cmake\bgfx\3rdparty\glslang\SPIRV\GlslangToSpv.cpp(61,10): fatal error C1083: Cannot open include file: 'glslang/build_info.h': No such file or directory
@mipek
Copy link

mipek commented Sep 16, 2020

I had the same error on Linux (using GCC). I fixed it by adding the following to the bottom of cmake/3rdparty/glslang.cmake:

target_include_directories( glslang PRIVATE ${BGFX_DIR}/3rdparty )

not sure if this is the correct approach to fix this quirk but it works (for now :)

@Ravbug
Copy link
Author

Ravbug commented Sep 16, 2020

If I do that on Windows, the header error is fixed but it's traded for an undefined symbols error in shaderc:

50>glslang.lib(ShaderLang.obj) : error LNK2019: unresolved external symbol "public: __cdecl glslang::HlslParseContext::HlslParseContext(class glslang::TSymbolTable &,class glslang::TIntermediate &,bool,int,enum EProfile,struct glslang::SpvVersion const &,enum EShLanguage,class TInfoSink &,class std::basic_string<char,struct std::char_traits<char>,class glslang::pool_allocator<char> >,bool,enum EShMessages)" (??0HlslParseContext@glslang@@QEAA@AEAVTSymbolTable@1@AEAVTIntermediate@1@_NHW4EProfile@@AEBUSpvVersion@1@W4EShLanguage@@AEAVTInfoSink@@V?$basic_string@DU?$char_traits@D@std@@V?$pool_allocator@D@glslang@@@std@@2W4EShMessages@@@Z) referenced in function "class glslang::TParseContextBase * __cdecl `anonymous namespace'::CreateParseContext(class glslang::TSymbolTable &,class glslang::TIntermediate &,int,enum EProfile,enum glslang::EShSource,enum EShLanguage,class TInfoSink &,struct glslang::SpvVersion,bool,enum EShMessages,bool,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?CreateParseContext@?A0x5e3bac6d@@YAPEAVTParseContextBase@glslang@@AEAVTSymbolTable@3@AEAVTIntermediate@3@HW4EProfile@@W4EShSource@3@W4EShLanguage@@AEAVTInfoSink@@USpvVersion@3@_NW4EShMessages@@7V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
50>glslang.lib(ShaderLang.obj) : error LNK2019: unresolved external symbol "public: __cdecl glslang::TBuiltInParseablesHlsl::TBuiltInParseablesHlsl(void)" (??0TBuiltInParseablesHlsl@glslang@@QEAA@XZ) referenced in function "class glslang::TBuiltInParseables * __cdecl `anonymous namespace'::CreateBuiltInParseables(class TInfoSink &,enum glslang::EShSource)" (?CreateBuiltInParseables@?A0x5e3bac6d@@YAPEAVTBuiltInParseables@glslang@@AEAVTInfoSink@@W4EShSource@3@@Z)
50>glslang.lib(ShaderLang.obj) : error LNK2019: unresolved external symbol "public: static void __cdecl glslang::HlslScanContext::fillInKeywordMap(void)" (?fillInKeywordMap@HlslScanContext@glslang@@SAXXZ) referenced in function ShInitialize
50>glslang.lib(ShaderLang.obj) : error LNK2019: unresolved external symbol "public: static void __cdecl glslang::HlslScanContext::deleteKeywordMap(void)" (?deleteKeywordMap@HlslScanContext@glslang@@SAXXZ) referenced in function ShFinalize
50>C:\Users\Ravbug\Documents\RavEngine-AirHockey\RavEngine\build\debug\shaderc.exe : fatal error LNK1120: 4 unresolved externals

The modification I made to cmake/3rdparty/glslang.cmake:

target_include_directories( glslang PUBLIC
	${BGFX_DIR}/3rdparty/spirv-tools/include
	${BGFX_DIR}/3rdparty/spirv-tools/source
	${BGFX_DIR}/3rdparty/glslang
	${BGFX_DIR}/3rdparty/glslang/glslang/Include
	${BGFX_DIR}/3rdparty/glslang/glslang/Public
        # my modification below:
	PRIVATE
	${BGFX_DIR}/3rdparty
)

@azais-corentin
Copy link

On Windows with MSVC 2019, I had to apply both mipek's patch and also #93 in order to the unresolved external symbol errors.

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

No branches or pull requests

3 participants