libncnn error miss glslang? when build lib ncnn, i built glslang but still undefined reference?
damvantai opened this issue · 2 comments
/usr/bin/ld: /window10/Users/tai94/Documents/baolinh/cv/LiveFaceReco_RaspberryPi_2/include/lib/libncnn.a(gpu.cpp.o): in function ncnn::destroy_gpu_instance()': gpu.cpp:(.text+0xdad): undefined reference to
glslang::FinalizeProcess()'
/usr/bin/ld: /window10/Users/tai94/Documents/baolinh/cv/LiveFaceReco_RaspberryPi_2/include/lib/libncnn.a(gpu.cpp.o): in function ncnn::create_gpu_instance()': gpu.cpp:(.text+0x44e9): undefined reference to
glslang::InitializeProcess()'
/usr/bin/ld: /window10/Users/tai94/Documents/baolinh/cv/LiveFaceReco_RaspberryPi_2/include/lib/libncnn.a(gpu.cpp.o): in function ncnn::compile_spirv_module(char const*, int, ncnn::Option const&, std::vector<unsigned int, std::allocator<unsigned int> >&)': gpu.cpp:(.text+0x88b8): undefined reference to
glslang::TShader::TShader(EShLanguage)'
/usr/bin/ld: gpu.cpp:(.text+0x88d3): undefined reference to glslang::TShader::setStringsWithLengths(char const* const*, int const*, int)' /usr/bin/ld: gpu.cpp:(.text+0x88f0): undefined reference to
glslang::TShader::addProcesses(std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > const&)'
/usr/bin/ld: gpu.cpp:(.text+0x88ff): undefined reference to glslang::TShader::setEntryPoint(char const*)' /usr/bin/ld: gpu.cpp:(.text+0x890e): undefined reference to
glslang::TShader::setSourceEntryPoint(char const*)'
/usr/bin/ld: gpu.cpp:(.text+0x8adf): undefined reference to glslang::TShader::parse(TBuiltInResource const*, int, EProfile, bool, bool, EShMessages, glslang::TShader::Includer&)' /usr/bin/ld: gpu.cpp:(.text+0x8b1e): undefined reference to
glslang::TShader::getInfoLog()'
/usr/bin/ld: gpu.cpp:(.text+0x8b3e): undefined reference to glslang::TShader::getInfoDebugLog()' /usr/bin/ld: gpu.cpp:(.text+0x8b64): undefined reference to
glslang::TShader::~TShader()'
/usr/bin/ld: gpu.cpp:(.text+0x8c39): undefined reference to glslang::GlslangToSpv(glslang::TIntermediate const&, std::vector<unsigned int, std::allocator<unsigned int> >&, glslang::SpvOptions*)' /usr/bin/ld: gpu.cpp:(.text+0x8c44): undefined reference to
glslang::TShader::~TShader()'
/usr/bin/ld: /window10/Users/tai94/Documents/baolinh/cv/LiveFaceReco_RaspberryPi_2/include/lib/libncnn.a(gpu.cpp.o): in function ncnn::compile_spirv_module(char const*, int, ncnn::Option const&, std::vector<unsigned int, std::allocator<unsigned int> >&) [clone .cold]': gpu.cpp:(.text.unlikely+0x204): undefined reference to
glslang::TShader::~TShader()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/LiveFaceReco.dir/build.make:152: LiveFaceReco] Error 1
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/LiveFaceReco.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
You must compile your ncnn with glslang support
cmake -DCMAKE_BUILD_TYPE=Release -DNCNN_VULKAN=ON -DNCNN_SYSTEM_GLSLANG=ON -DNCNN_BUILD_EXAMPLES=ON ..
doesn't forget to clone the libncnn repository with --recursive option
git clone https://github.com/Tencent/ncnn.git --recursive
you can setup your ncnn android by
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-24 -DNCNN_VULKAN=ON -DNCNN_SHARED_LIB=ON -DNCNN_ENABLE_LTO=OFF ..