mmdeploy
mmdeploy copied to clipboard
Error when build demo on linux: /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/libstdc++fs.a(ops.o): undefined reference to symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6resizeEmc'
I encountered a difficult problem with the last command (make -j$(nproc)) of Build for Linux-x86_64:
(mmdeploy) root@2bc997559bdb:xxx/mmdeploy/build/install/example/build# make -j$(nproc)
Consolidate compiler generated dependencies of target object_detection
[ 50%] Linking CXX executable object_detection
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/libstdc++fs.a(ops.o): undefined reference to symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6resizeEmc'
/usr/bin/ld: /home/wangjy/research/mmdeploy/build/install/lib/libmmdeploy_core.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/object_detection.dir/build.make:181: object_detection] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/object_detection.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
I delete the add_example() except for object_detection for simplicity. The env info as shown below:
(mmdeploy) root@2bc997559bdb:xxx/mmdeploy# python ./tools/check_env.py
2022-07-27 21:17:18,363 - mmdeploy - INFO -
2022-07-27 21:17:18,363 - mmdeploy - INFO - **********Environmental information**********
2022-07-27 21:17:20,167 - mmdeploy - INFO - sys.platform: linux
2022-07-27 21:17:20,168 - mmdeploy - INFO - Python: 3.7.13 (default, Mar 29 2022, 02:18:16) [GCC 7.5.0]
2022-07-27 21:17:20,168 - mmdeploy - INFO - CUDA available: True
2022-07-27 21:17:20,168 - mmdeploy - INFO - GPU 0,1,2,3: GeForce RTX 3090
2022-07-27 21:17:20,168 - mmdeploy - INFO - CUDA_HOME: :/usr/local/cuda
2022-07-27 21:17:20,168 - mmdeploy - INFO - GCC: gcc (Ubuntu 7.5.0-6ubuntu2) 7.5.0
2022-07-27 21:17:20,168 - mmdeploy - INFO - PyTorch: 1.8.0
2022-07-27 21:17:20,168 - mmdeploy - INFO - PyTorch compiling details: PyTorch built with:
- GCC 7.3
- C++ Version: 201402
- Intel(R) oneAPI Math Kernel Library Version 2021.4-Product Build 20210904 for Intel(R) 64 architecture applications
- Intel(R) MKL-DNN v1.7.0
- OpenMP 201511 (a.k.a. OpenMP 4.5)
- NNPACK is enabled
- CPU capability usage: AVX2
- CUDA Runtime 11.1
- NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_37,code=compute_37
- CuDNN 8.0.5
- Magma 2.5.2
- Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.1, CUDNN_VERSION=8.0.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.8.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON,
2022-07-27 21:17:20,168 - mmdeploy - INFO - TorchVision: 0.9.0
2022-07-27 21:17:20,168 - mmdeploy - INFO - OpenCV: 4.6.0
2022-07-27 21:17:20,168 - mmdeploy - INFO - MMCV: 1.4.0
2022-07-27 21:17:20,168 - mmdeploy - INFO - MMCV Compiler: GCC 7.3
2022-07-27 21:17:20,168 - mmdeploy - INFO - MMCV CUDA Compiler: 11.1
2022-07-27 21:17:20,169 - mmdeploy - INFO - MMDeploy: 0.6.0+5195ff9
2022-07-27 21:17:20,169 - mmdeploy - INFO -
2022-07-27 21:17:20,169 - mmdeploy - INFO - **********Backend information**********
2022-07-27 21:17:20,946 - mmdeploy - INFO - onnxruntime: 1.8.1 ops_is_avaliable : True
2022-07-27 21:17:20,985 - mmdeploy - INFO - tensorrt: 8.2.3.0 ops_is_avaliable : True
2022-07-27 21:17:21,029 - mmdeploy - INFO - ncnn: None ops_is_avaliable : False
2022-07-27 21:17:21,030 - mmdeploy - INFO - pplnn_is_avaliable: False
2022-07-27 21:17:21,031 - mmdeploy - INFO - openvino_is_avaliable: False
2022-07-27 21:17:21,031 - mmdeploy - INFO -
2022-07-27 21:17:21,031 - mmdeploy - INFO - **********Codebase information**********
2022-07-27 21:17:21,033 - mmdeploy - INFO - mmdet: 2.22.0
2022-07-27 21:17:21,033 - mmdeploy - INFO - mmseg: None
2022-07-27 21:17:21,033 - mmdeploy - INFO - mmcls: None
2022-07-27 21:17:21,033 - mmdeploy - INFO - mmocr: None
2022-07-27 21:17:21,033 - mmdeploy - INFO - mmedit: None
2022-07-27 21:17:21,033 - mmdeploy - INFO - mmdet3d: None
2022-07-27 21:17:21,033 - mmdeploy - INFO - mmpose: None
2022-07-27 21:17:21,033 - mmdeploy - INFO - mmrotate: None
Hi,
What's your Ubuntu version and how did you install GCC-7?
Hi,
What's your Ubuntu version and how did you install GCC-7?
Ubuntu Version: 20.04.
I install GCC-7 following the docs. (sudo apt-get install gcc-7). And I use gcc --version to confirm it:
(mmdeploy) root@2bc997559bdb:xxx/research/mmdeploy# gcc --version
gcc (Ubuntu 7.5.0-6ubuntu2) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I followed the instructions in the doc using a fresh Ubuntu 20.04 environment and can't reproduce the problem.
The symbol _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6resizeEmc demangles to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long, char) which is from C++ standard library and should be defined in libstdc++.so, should't be a problem normally.
Maybe you can try to use g++-9 (which is the default C++ compiler for Ubuntu 20.04) and see if it works.
Close it for no activity for a long time. Feel free to reopen it if it is still an issue