ubantu 22.04 opencv版本: 3.4.14 pangolin: 0.8 Eigen:3.4.90
可以使用pangolin最新版本
/usr/bin/ld: /usr/local/lib/libavcodec.a(vc1dsp_mmx.o):
relocation R_X86_64_PC32 against symbol `ff_pw_9'
can not be used when making a shared object; recompile with -fPIC
解决方法:
1.重新编译ffmpeg,加参数:--enable-shared
./configure --enable-shared
然后重新在opencv中重新编译:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_TESTS=OFF -D CMAKE_INSTALL_PREFIX=/usr/local .. -D WITH_FFMPEG=OFF
make
sudo make install
接下来参考ubuntu 22.04安装opencv3.4.15_ubuntu22.04安装opencv_不是我吧12138的博客-CSDN博客
解决办法:
将
find_package(Eigen3 3.1.0 REQUIRED)
find_package(Pangolin REQUIRED)
改为:
find_package(Eigen3 3.1.0 REQUIRED NO_MODULE)
find_package(Pangolin REQUIRED)
#include
#include
#include
**pkg-config --modversion opencv
看到类似错误一定是需要在编译选项中加入c++17的支持
将
set(CMAKE_CXX_FLAGS "-std=c++11 ${SSE_FLAGS} -g -O3 -march=native")
修改为:
set(CMAKE_CXX_FLAGS "-std=c++17 ${SSE_FLAGS} -g -O3 -march=native")
/usr/local/include/sigslot/signal.hpp:109:79: error: ‘decay_t’ is not a member of ‘std’; did you mean ‘decay’?
109 | weak_ptr_compatible_v = detail::is_weak_ptr_compatible>::value;
| ^~~~~~~
| decay
/usr/local/include/sigslot/signal.hpp:109:79: error: ‘decay_t’ is not a member of ‘std’; did you mean ‘decay’?
109 | weak_ptr_compatible_v = detail::is_weak_ptr_compatible>::value;
| ^~~~~~~
| decay
/usr/local/include/sigslot/signal.hpp:109:87: error: template argument 1 is invalid
109 | _compatible_v = detail::is_weak_ptr_compatible>::value;
| ^
/usr/local/include/sigslot/signal.hpp:109:92: error: ‘::value’ has not been declared
109 | _compatible_v = detail::is_weak_ptr_compatible>::value;
| ^~~~~
/usr/local/include/sigslot/signal.hpp:132:53: error: ‘remove_pointer_t’ is not a member of ‘std’; did you mean ‘remove_pointer’?
132 | std::remove_pointer_t>::value;
| ^~~~~~~~~~~~~~~~
| remove_pointer
/usr/local/include/sigslot/signal.hpp:132:53: error: ‘remove_pointer_t’ is not a member of ‘std’; did you mean ‘remove_pointer’?
132 | std::remove_pointer_t>::value;
| ^~~~~~~~~~~~~~~~
| remove_pointer
/usr/local/include/sigslot/signal.hpp:132:70: error: template argument 2 is invalid
132 | std::remove_pointer_t>::value;
| ^
/usr/local/include/sigslot/signal.hpp:132:75: error: ‘::value’ has not been declared
132 | std::remove_pointer_t>::value;
| ^~~~~
/usr/local/include/sigslot/signal.hpp:223:32: error: ‘enable_if_t’ is not a member of ‘std’
223 | struct function_traits>> {
| ^~~~~~~~~~~
/usr/local/include/sigslot/signal.hpp:223:32: note: ‘std::enable_if_t’ is only available from C++14 onwards
/usr/local/include/sigslot/signal.hpp:223:32: error: ‘enable_if_t’ is not a member of ‘std’
/usr/local/include/sigslot/signal.hpp:223:32: note: ‘std::enable_if_t’ is only available from C++14 onwards
/usr/local/include/sigslot/signal.hpp:223:62: error: type/value mismatch at argument 2 in template parameter list for ‘template struct sigslot::detail::function_traits’
223 | struct function_traits>> {
| ^~
/usr/local/include/sigslot/signal.hpp:223:62: note: expected a type, got ‘( < is_func_v)’
/usr/local/include/sigslot/signal.hpp:223:64: error: expected unqualified-id before ‘>’ token
223 | struct function_traits>> {
| ^
/usr/local/include/sigslot/signal.hpp:233:33: error: ‘enable_if_t’ is not a member of ‘std’
233 | struct function_traits>> {
| ^~~~~~~~~~~
/usr/local/include/sigslot/signal.hpp:233:33: note: ‘std::enable_if_t’ is only available from C++14 onwards
/usr/local/include/sigslot/signal.hpp:233:33: error: ‘enable_if_t’ is not a member of ‘std’
/usr/local/include/sigslot/signal.hpp:233:33: note: ‘std::enable_if_t’ is only available from C++14 onwards
/usr/local/include/sigslot/signal.hpp:233:63: error: type/value mismatch at argument 2 in template parameter list for ‘template struct sigslot::detail::function_traits’
这个错误是在cmake时候出现的,可以跳过,不影响后面
这是应为之前没有安装csparse,所以检测不到这个安装g2o时候就跳过去了,需要先安装csparse,再重新编译g2o
错误信息:
/usr/bin/ld: CMakeFiles/pose_graph_g2o_lie.dir/pose_graph_g2o_lie_algebra.cpp.o:pose_graph_g2o_lie_algebra.cpp:(.text._ZN3fmt2v96detail5valueINS0_20basic_format_contextINS0_8appenderEcEEE17format_custom_argINS1_13streamed_viewIN5Eigen9TransposeIKNS9_6MatrixIdLi4ELi1ELi0ELi4ELi1EEEEEEENS0_9formatterISF_cvEEEEvPvRNS0_26basic_format_parse_contextIcEERS5_[_ZN3fmt2v96detail5valueINS0_20basic_format_contextINS0_8appenderEcEEE17format_custom_argINS1_13streamed_viewIN5Eigen9TransposeIKNS9_6MatrixIdLi4ELi1ELi0ELi4ELi1EEEEEEENS0_9formatterISF_cvEEEEvPvRNS0_26basic_format_parse_contextIcEERS5_]+0x769): more undefined references to `fmt::v9::detail::throw_format_error(char const*)' follow
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/pose_graph_g2o_lie.dir/build.make:97:pose_graph_g2o_lie] 错误 1
make[1]: *** [CMakeFiles/Makefile2:111:CMakeFiles/pose_graph_g2o_lie.dir/all] 错误 2
解决方法:
set(FMT_LIBRARIES fmt::fmt)
target_link_libraries(name ${FMT_LIBRARIES})
然后在相应的程序中添加FMT_LIBRARIES
错误信息
[ 75%] Linking CXX shared library /home/wt/Documents/study/slambook2-master/ch13/lib/libmyslam.so
/usr/bin/ld: /usr/local/lib/libfmt.a(format.cc.o): warning: relocation against `stdout@@GLIBC_2.2.5' in read-only section `.text'
/usr/bin/ld: /usr/local/lib/libfmt.a(format.cc.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 最后的链结失败: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/myslam.dir/build.make:299:/home/wt/Documents/study/slambook2-master/ch13/lib/libmyslam.so] 错误 1
make[1]: *** [CMakeFiles/Makefile2:134:src/CMakeFiles/myslam.dir/all] 错误 2
make: *** [Makefile:101:all] 错误 2
改为
STATIC
/usr/bin/ld: CMakeFiles/test_triangulation.dir/test_triangulation.cpp.o:(.data.rel.ro._ZTI29MyslamTest_Triangulation_Test[_ZTI29MyslamTest_Triangulation_Test]+0x10): undefined reference to `typeinfo for testing::Test'
显然是gtest中错误:
在CMakeLists.txt中添加
find_library(gtestlib libgtest.a ${ROOT_DIR}/lib)
将${gtestlib}添加到链接库中
conda install -c conda-forge libstdcxx-ng=12