Tencent / ncnn

ncnn is a high-performance neural network inference framework optimized for the mobile platform
Other
20.42k stars 4.16k forks source link

error: undefined reference to `ConstructCompiler(EShLanguage, int)' #3247

Open chingi071 opened 3 years ago

chingi071 commented 3 years ago

detail | 详细描述 | 詳細な説明

Hello, I installed ncnn on jetson nano and compiled the NCNN example on QT, but the following problems occurred. Excuse me, is there a file that I missed that caused this problem? Image 1

I follow the steps below to compile ncnn on jetson nano.

$ git submodule update --depth=1 --init $ cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/jetson.toolchain.cmake \ -DNCNN_BUILD_EXAMPLES=ON \ -DNCNN_BUILD_TOOLS=ON \ -DNCNN_VULKAN=ON \ -DNCNN_SYSTEM_GLSLANG=ON \ -DCMAKE_BUILD_TYPE=Release \ -DNCNN_DISABLE_RTTI=OFF .. $ make -j4 $ sudo make install

My QT compilation settings are as follows.

SOURCES += test.cpp

INCLUDEPATH += /home/user/ncnn/build/install/include/ncnn \ /home/user/ncnn/build/install/include/glslang \ /home/user/ncnn/build/install/include/glslang/Include \ /home/user/ncnn/build/install/include/glslang/MachineIndependent \ /home/user/ncnn/build/install/include/glslang/MachineIndependent/preprocessor \ /home/user/ncnn/build/install/include/glslang/Public \ /home/user/ncnn/build/install/include/glslang/SPIRV \ /usr/include/opencv4 \ /usr/include/opencv4/opencv2

LIBS += /home/user/ncnn/build/install/lib/libncnn.a \ /home/user/ncnn/build/install/lib/libglslang.a \ /home/user/ncnn/build/install/lib/libGenericCodeGen.a \ /home/user/ncnn/build/install/lib/libMachineIndependent.a \ /home/user/ncnn/build/install/lib/libOGLCompiler.a \ /home/user/ncnn/build/install/lib/libOSDependent.a \ /home/user/ncnn/build/install/lib/libSPIRV.a \ /usr/lib/aarch64-linux-gnu/libopencv_*.so.4.1 \ /usr/lib/aarch64-linux-gnu/libvulkan.so.1.2

QMAKE_CXXFLAGS += -fopenmp QMAKE_LFLAGS += -fopenmp LIBS += -fopenmp

cyinen commented 2 years ago

Hello,Did you solve the problem?I meet the same problem.

Z-Xiong commented 2 years ago

-lglslang -lshaderc_shared

abaghiyan commented 2 years ago

Building as a shared lib solved similar problem. Check in CmakeList.txt: #option(NCNN_SHARED_LIB "shared library support" OFF) change to option(NCNN_SHARED_LIB "shared library support" ON)

EricTonyLiu commented 2 years ago

Building as a shared lib solved similar problem. Check in CmakeList.txt: #option(NCNN_SHARED_LIB "shared library support" OFF) change to option(NCNN_SHARED_LIB "shared library support" ON)

I try this but it seems not working

abaghiyan commented 2 years ago

Building as a shared lib solved similar problem. Check in CmakeList.txt: #option(NCNN_SHARED_LIB "shared library support" OFF) change to option(NCNN_SHARED_LIB "shared library support" ON)

This type of build may affect some detectors leading to incorrect results. For instance, on yolov4 example I got negative detection rect coordinates (from output ncnn::Mat of extractor) and many false positives. So this solves linking issues but also leads to risks and inaccuracies for several detectors.

jinzhongmin commented 2 years ago

我在cgo链接时也遇到了类似的问题,我通过调整链接库的顺序,通过了编译 image 也许你可以按这个顺序试试

zxpzhong commented 2 years ago

我在cgo链接时也遇到了类似的问题,我通过调整链接库的顺序,通过了编译 image 也许你可以按这个顺序试试

that works!