TheCherno / Hazel

Hazel Engine
Apache License 2.0
11.56k stars 1.5k forks source link

Hazel failed to build with "error LNK2019: unresolved external symbol shaderc_compiler_initialize referenced in function "private: void __cdecl Hazel::OpenGLShader::CompileOrGetOpenGLBinaries(void)" " with MSVC on windows arm64 #552

Open YangYang129 opened 2 years ago

YangYang129 commented 2 years ago

Hazel failed to build with "Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol shaderc_compiler_initialize referenced in function "private: void __cdecl Hazel::OpenGLShader::CompileOrGetOpenGLBinaries(void)" " with MSVC on windows arm64. It can reproduces on version https://github.com/TheCherno/Hazel/commit/f627b9c90923382f735350cd3060892bbd4b1e75. Could you please help look at this issue? Thank you very much

Environment Compiler version: VS2019 (16.11.9) Operating system: Windows server 2019

Steps to reproduce:

  1. open VS2019 x64 tools command
  2. git clone https://github.com/TheCherno/Hazel
  3. cd F:/Hazel
  4. git submodule update --init --recursive
  5. set VSCMD_SKIP_SENDTELEMETRY=1 & "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -host_arch=amd64 -arch=arm64
  6. Change "architecture "x86_64"" to "architecture "arm64""
  7. cd scripts 8.Setup.bat
  8. cd F:\Hazel
  9. msbuild /m /p:Platform=arm64 /p:Configuration=Release Hazel.sln /t:Rebuild

Build.log: Hazel_build.log

Error info:

9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol shaderc_compiler_initialize referenced in function "private: void __cdecl Hazel::OpenGLShader::CompileOrGetOpenGLBinaries(void)" (?CompileOrGetOpenGLBinaries@OpenGLShader@Hazel@@AEAAXXZ) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol shaderc_compiler_release referenced in function "public: __cdecl shaderc::Compiler::~Compiler(void)" (??1Compiler@shaderc@@QEAA@XZ) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol shaderc_compile_options_initialize referenced in function "private: void __cdecl Hazel::OpenGLShader::CompileOrGetOpenGLBinaries(void)" (?CompileOrGetOpenGLBinaries@OpenGLShader@Hazel@@AEAAXXZ) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol shaderc_compile_options_release referenced in function "public: __cdecl shaderc::CompileOptions::~CompileOptions(void)" (??1CompileOptions@shaderc@@QEAA@XZ) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol shaderc_compile_options_set_optimization_level referenced in function "private: void __cdecl Hazel::OpenGLShader::CompileOrGetVulkanBinaries(class std::unordered_map<unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::hash<unsigned int>,struct std::equal_to<unsigned int>,class std::allocator<struct std::pair<unsigned int const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > const &)" (?CompileOrGetVulkanBinaries@OpenGLShader@Hazel@@AEAAXAEBV?$unordered_map@IV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$hash@I@2@U?$equal_to@I@2@V?$allocator@U?$pair@$$CBIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@@2@@std@@@Z) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol shaderc_compile_options_set_target_env referenced in function "private: void __cdecl Hazel::OpenGLShader::CompileOrGetOpenGLBinaries(void)" (?CompileOrGetOpenGLBinaries@OpenGLShader@Hazel@@AEAAXXZ) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol shaderc_compile_into_spv referenced in function "private: void __cdecl Hazel::OpenGLShader::CompileOrGetOpenGLBinaries(void)" (?CompileOrGetOpenGLBinaries@OpenGLShader@Hazel@@AEAAXXZ) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol shaderc_result_release referenced in function "public: __cdecl shaderc::CompilationResult<unsigned int>::~CompilationResult<unsigned int>(void)" (??1?$CompilationResult@I@shaderc@@QEAA@XZ) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol shaderc_result_get_length referenced in function "private: void __cdecl Hazel::OpenGLShader::CompileOrGetOpenGLBinaries(void)" (?CompileOrGetOpenGLBinaries@OpenGLShader@Hazel@@AEAAXXZ) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol shaderc_result_get_compilation_status referenced in function "private: void __cdecl Hazel::OpenGLShader::CompileOrGetOpenGLBinaries(void)" (?CompileOrGetOpenGLBinaries@OpenGLShader@Hazel@@AEAAXXZ) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol shaderc_result_get_bytes referenced in function "private: void __cdecl Hazel::OpenGLShader::CompileOrGetOpenGLBinaries(void)" (?CompileOrGetOpenGLBinaries@OpenGLShader@Hazel@@AEAAXXZ) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol shaderc_result_get_error_message referenced in function "private: void __cdecl Hazel::OpenGLShader::CompileOrGetOpenGLBinaries(void)" (?CompileOrGetOpenGLBinaries@OpenGLShader@Hazel@@AEAAXXZ) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol "public: __cdecl spirv_cross::Compiler::Compiler(class std::vector<unsigned int,class std::allocator<unsigned int> >)" (??0Compiler@spirv_cross@@QEAA@V?$vector@IV?$allocator@I@std@@@std@@@Z) referenced in function "public: __cdecl spirv_cross::CompilerGLSL::CompilerGLSL(class std::vector<unsigned int,class std::allocator<unsigned int> >)" (??0CompilerGLSL@spirv_cross@@QEAA@V?$vector@IV?$allocator@I@std@@@std@@@Z) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol "public: unsigned int __cdecl spirv_cross::Compiler::get_decoration(class spirv_cross::TypedID<0>,enum spv::Decoration)const " (?get_decoration@Compiler@spirv_cross@@QEBAIV?$TypedID@$0A@@2@W4Decoration@spv@@@Z) referenced in function "private: void __cdecl Hazel::OpenGLShader::Reflect(unsigned int,class std::vector<unsigned int,class std::allocator<unsigned int> > const &)" (?Reflect@OpenGLShader@Hazel@@AEAAXIAEBV?$vector@IV?$allocator@I@std@@@std@@@Z) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol "public: struct spirv_cross::SPIRType const & __cdecl spirv_cross::Compiler::get_type(class spirv_cross::TypedID<1>)const " (?get_type@Compiler@spirv_cross@@QEBAAEBUSPIRType@2@V?$TypedID@$00@2@@Z) referenced in function "private: void __cdecl Hazel::OpenGLShader::Reflect(unsigned int,class std::vector<unsigned int,class std::allocator<unsigned int> > const &)" (?Reflect@OpenGLShader@Hazel@@AEAAXIAEBV?$vector@IV?$allocator@I@std@@@std@@@Z) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __cdecl spirv_cross::Compiler::get_fallback_name(class spirv_cross::TypedID<0>)const " (?get_fallback_name@Compiler@spirv_cross@@UEBA?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$TypedID@$0A@@2@@Z) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __cdecl spirv_cross::Compiler::get_block_fallback_name(class spirv_cross::TypedID<2>)const " (?get_block_fallback_name@Compiler@spirv_cross@@UEBA?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$TypedID@$01@2@@Z) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol "public: unsigned __int64 __cdecl spirv_cross::Compiler::get_declared_struct_size(struct spirv_cross::SPIRType const &)const " (?get_declared_struct_size@Compiler@spirv_cross@@QEBA_KAEBUSPIRType@2@@Z) referenced in function "private: void __cdecl Hazel::OpenGLShader::Reflect(unsigned int,class std::vector<unsigned int,class std::allocator<unsigned int> > const &)" (?Reflect@OpenGLShader@Hazel@@AEAAXIAEBV?$vector@IV?$allocator@I@std@@@std@@@Z) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol "public: struct spirv_cross::ShaderResources __cdecl spirv_cross::Compiler::get_shader_resources(void)const " (?get_shader_resources@Compiler@spirv_cross@@QEBA?AUShaderResources@2@XZ) referenced in function "private: void __cdecl Hazel::OpenGLShader::Reflect(unsigned int,class std::vector<unsigned int,class std::allocator<unsigned int> > const &)" (?Reflect@OpenGLShader@Hazel@@AEAAXIAEBV?$vector@IV?$allocator@I@std@@@std@@@Z) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2001: unresolved external symbol "protected: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl spirv_cross::Compiler::to_name(unsigned int,bool)const " (?to_name@Compiler@spirv_cross@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@I_N@Z) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2019: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl spirv_cross::CompilerGLSL::compile(void)" (?compile@CompilerGLSL@spirv_cross@@UEAA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "private: void __cdecl Hazel::OpenGLShader::CompileOrGetOpenGLBinaries(void)" (?CompileOrGetOpenGLBinaries@OpenGLShader@Hazel@@AEAAXXZ) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2001: unresolved external symbol "protected: virtual void __cdecl spirv_cross::CompilerGLSL::emit_function_prototype(struct spirv_cross::SPIRFunction &,class spirv_cross::Bitset const &)" (?emit_function_prototype@CompilerGLSL@spirv_cross@@MEAAXAEAUSPIRFunction@2@AEBVBitset@2@@Z) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
     9>Hazel.lib(OpenGLShader.obj) : error LNK2001: unresolved external symbol "protected: virtual void __cdecl spirv_cross::CompilerGLSL::emit_instruction(struct spirv_cross::Instruction const &)" (?emit_instruction@CompilerGLSL@spirv_cross@@MEAAXAEBUInstruction@2@@Z) [F:\gitP\TheCherno\Hazel\Sandbox\Sandbox.vcxproj]
yao83383 commented 1 year ago

It happend to me also, with VS2019. Did you resolve the problem?