问题描述:
在复现https://github.com/hku-mars/FAST-LIVO2激光雷达视觉SLAM时,解决了下面这个问题。 /usr/bin/ld: /home/aq/miniconda3/lib/libfmt.so.11.0.2: undefined reference to std::__throw_bad_array_new_length()@GLIBCXX_3.4.29 collect2: error: ld returned 1 exit status make[2]: *** [test/core/CMakeFiles/test_rxso3.dir/build.make:101:test/core/test_rxso3] 错误 1 make[1]: *** [CMakeFiles/Makefile2:528:test/core/CMakeFiles/test_rxso3.dir/all] 错误 2 /usr/bin/ld: /home/aq/miniconda3/lib/libfmt.so.11.0.2: undefined reference to std::__throw_bad_array_new_length()@GLIBCXX_3.4.29 collect2: error: ld returned 1 exit status make[2]: *** [test/core/CMakeFiles/test_so3.dir/build.make:101:test/core/test_so3] 错误 1 make[1]: *** [CMakeFiles/Makefile2:464:test/core/CMakeFiles/test_so3.dir/all] 错误 2 make: *** [Makefile:146:all] 错误 2问题解答:
conda在偷偷往 CMake / linker注入库路径,它拿了 conda 里的 libfmt.so,这个库是用比你系统 GCC 更新的编译器编的,和Ubuntu 20.04 自带的libstdc++ ABI 不兼容,这个问题是没有退出base环境导致的。
解决办法:
conda deactivate