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

Linking error against spirv-tools #1374

Open
meerfrau opened this issue Oct 12, 2023 · 0 comments
Open

Linking error against spirv-tools #1374

meerfrau opened this issue Oct 12, 2023 · 0 comments

Comments

@meerfrau
Copy link

meerfrau commented Oct 12, 2023

I've built successfully against git master of https://github.com/KhronosGroup/SPIRV-Tools. shaderc was compiled via

  cmake \
    -B build \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_CXX_FLAGS="$CXXFLAGS -ffat-lto-objects" \
    -DSHADERC_SKIP_TESTS=ON \
    -Dglslang_SOURCE_DIR=/usr/include/glslang \
    -GNinja
  ninja -C build

But whenever I try to link against shaderc in my programs there is a linking error. Using mold or lld made no difference:

/usr/bin/ld: /usr/lib/libshaderc_combined.a(shaderc.cc.o): in function `shaderc_compilation_result_spv_binary::~shaderc_compilation_result_spv_binary()':
(.text._ZN37shaderc_compilation_result_spv_binaryD2Ev[_ZN37shaderc_compilation_result_spv_binaryD5Ev]+0x14): undefined reference to `spvBinaryDestroy'
/usr/bin/ld: /usr/lib/libshaderc_combined.a(shaderc.cc.o): in function `shaderc_compilation_result_spv_binary::~shaderc_compilation_result_spv_binary()':
(.text._ZN37shaderc_compilation_result_spv_binaryD0Ev[_ZN37shaderc_compilation_result_spv_binaryD5Ev]+0x14): undefined reference to `spvBinaryDestroy'
/usr/bin/ld: /usr/lib/libshaderc_combined.a(spirv_tools_wrapper.cc.o): in function `shaderc_util::SpirvToolsOptimize(shaderc_util::Compiler::TargetEnv, shaderc_util::Compiler::TargetEnvVersion, std::vector<shaderc_util::PassId, std::allocator<shaderc_util::PassId> > const&, spvtools::OptimizerOptions&, std::vector<unsigned int, std::allocator<unsigned int> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
(.text+0x20b): undefined reference to `spvValidatorOptionsCreate'
/usr/bin/ld: (.text+0x221): undefined reference to `spvValidatorOptionsSetSkipBlockLayout'
/usr/bin/ld: (.text+0x22f): undefined reference to `spvValidatorOptionsSetRelaxLogicalPointer'
/usr/bin/ld: (.text+0x23d): undefined reference to `spvValidatorOptionsSetBeforeHlslLegalization'
/usr/bin/ld: (.text+0x24f): undefined reference to `spvOptimizerOptionsSetValidatorOptions'
/usr/bin/ld: (.text+0x25e): undefined reference to `spvOptimizerOptionsSetRunValidator'
/usr/bin/ld: (.text+0x280): undefined reference to `spvtools::Optimizer::Optimizer(spv_target_env)'
/usr/bin/ld: (.text+0x42c): undefined reference to `spvtools::Optimizer::SetMessageConsumer(std::function<void (spv_message_level_t, char const*, spv_position_t const&, char const*)>)'
/usr/bin/ld: (.text+0x48a): undefined reference to `spvtools::CreateCompactIdsPass()'
/usr/bin/ld: (.text+0x496): undefined reference to `spvtools::Optimizer::RegisterPass(spvtools::Optimizer::PassToken&&)'
/usr/bin/ld: (.text+0x49f): undefined reference to `spvtools::Optimizer::PassToken::~PassToken()'
/usr/bin/ld: (.text+0x4d4): undefined reference to `spvtools::Optimizer::Run(unsigned int const*, unsigned long, std::vector<unsigned int, std::allocator<unsigned int> >*, spv_optimizer_options_t*) const'
/usr/bin/ld: (.text+0x598): undefined reference to `spvtools::Optimizer::~Optimizer()'
/usr/bin/ld: (.text+0x5a3): undefined reference to `spvValidatorOptionsDestroy'
/usr/bin/ld: (.text+0x5e5): undefined reference to `spvtools::Optimizer::RegisterPerformancePasses()'
/usr/bin/ld: (.text+0x5f5): undefined reference to `spvtools::Optimizer::RegisterLegalizationPasses()'
/usr/bin/ld: (.text+0x60a): undefined reference to `spvtools::CreateStripDebugInfoPass()'
/usr/bin/ld: (.text+0x616): undefined reference to `spvtools::Optimizer::RegisterPass(spvtools::Optimizer::PassToken&&)'
/usr/bin/ld: (.text+0x625): undefined reference to `spvtools::Optimizer::RegisterSizePasses()'
/usr/bin/ld: /usr/lib/libshaderc_combined.a(spirv_tools_wrapper.cc.o): in function `shaderc_util::SpirvToolsDisassemble(shaderc_util::Compiler::TargetEnv, shaderc_util::Compiler::TargetEnvVersion, std::vector<unsigned int, std::allocator<unsigned int> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
(.text+0xa41): undefined reference to `spvtools::SpirvTools::SpirvTools(spv_target_env)'
/usr/bin/ld: (.text+0xba8): undefined reference to `spvtools::SpirvTools::SetMessageConsumer(std::function<void (spv_message_level_t, char const*, spv_position_t const&, char const*)>)'
/usr/bin/ld: (.text+0xbd3): undefined reference to `spvtools::SpirvTools::Disassemble(std::vector<unsigned int, std::allocator<unsigned int> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, unsigned int) const'
/usr/bin/ld: (.text+0xdd3): undefined reference to `spvtools::SpirvTools::~SpirvTools()'
/usr/bin/ld: /usr/lib/libshaderc_combined.a(spirv_tools_wrapper.cc.o): in function `shaderc_util::SpirvToolsAssemble(shaderc_util::Compiler::TargetEnv, shaderc_util::Compiler::TargetEnvVersion, shaderc_util::string_piece, spv_binary_t**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
(.text+0x1023): undefined reference to `spvContextCreate'
/usr/bin/ld: (.text+0x1062): undefined reference to `spvTextToBinary'
/usr/bin/ld: (.text+0x1412): undefined reference to `spvDiagnosticDestroy'
/usr/bin/ld: (.text+0x141b): undefined reference to `spvContextDestroy'
/usr/bin/ld: /usr/lib/libshaderc_combined.a(spirv_tools_wrapper.cc.o): in function `shaderc_util::SpirvToolsOptimize(shaderc_util::Compiler::TargetEnv, shaderc_util::Compiler::TargetEnvVersion, std::vector<shaderc_util::PassId, std::allocator<shaderc_util::PassId> > const&, spvtools::OptimizerOptions&, std::vector<unsigned int, std::allocator<unsigned int> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) [clone .cold]':
(.text.unlikely+0xa6): undefined reference to `spvtools::Optimizer::~Optimizer()'
/usr/bin/ld: (.text.unlikely+0xb1): undefined reference to `spvValidatorOptionsDestroy'
/usr/bin/ld: (.text.unlikely+0x11b): undefined reference to `spvtools::Optimizer::PassToken::~PassToken()'
/usr/bin/ld: /usr/lib/libshaderc_combined.a(spirv_tools_wrapper.cc.o): in function `shaderc_util::SpirvToolsDisassemble(shaderc_util::Compiler::TargetEnv, shaderc_util::Compiler::TargetEnvVersion, std::vector<unsigned int, std::allocator<unsigned int> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) [clone .cold]':
(.text.unlikely+0x140): undefined reference to `spvtools::SpirvTools::~SpirvTools()'
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

1 participant