《视觉SLAM十四讲》错误记录

ubantu 22.04    opencv版本: 3.4.14   pangolin: 0.8    Eigen:3.4.90  

可以使用pangolin最新版本

1. 安装opencv

/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博客

2. Pangolin could not be found because dependency Eigen3 could not be found.

解决办法:

find_package(Eigen3 3.1.0 REQUIRED)
find_package(Pangolin REQUIRED)

改为:

find_package(Eigen3 3.1.0 REQUIRED NO_MODULE)
find_package(Pangolin REQUIRED)

3.error: usleep is not declared in this scope

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

**pkg-config --modversion opencv

4. error: ‘decay_t’ is not a member of ‘std’; did you mean ‘decay’?

看到类似错误一定是需要在编译选项中加入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<std::decay_t<P>>::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<std::decay_t<P>>::value;
      |                                                             ^~~~~~~
      |                                                             decay
/usr/local/include/sigslot/signal.hpp:109:87: error: template argument 1 is invalid
  109 | _compatible_v = detail::is_weak_ptr_compatible<std::decay_t<P>>::value;
      |                                                             ^

/usr/local/include/sigslot/signal.hpp:109:92: error: ‘::value’ has not been declared
  109 | _compatible_v = detail::is_weak_ptr_compatible<std::decay_t<P>>::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<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<T>>::value;
      |                                                     ^~~~~~~~~~~~~~~~
      |                                                     remove_pointer
/usr/local/include/sigslot/signal.hpp:132:70: error: template argument 2 is invalid
  132 |                                       std::remove_pointer_t<T>>::value;
      |                                                             ^

/usr/local/include/sigslot/signal.hpp:132:75: error: ‘::value’ has not been declared
  132 |                                       std::remove_pointer_t<T>>::value;
      |                                                                  ^~~~~

/usr/local/include/sigslot/signal.hpp:223:32: error: ‘enable_if_t’ is not a member of ‘std’
  223 | struct function_traits<T, std::enable_if_t<trait::is_func_v<T>>> {
      |                                ^~~~~~~~~~~
/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<class T, class> struct sigslot::detail::function_traits’
  223 | struct function_traits<T, std::enable_if_t<trait::is_func_v<T>>> {
      |                                                              ^~
/usr/local/include/sigslot/signal.hpp:223:62: note:   expected a type, got ‘(<expression error> < is_func_v<T>)’
/usr/local/include/sigslot/signal.hpp:223:64: error: expected unqualified-id before ‘>’ token
  223 | struct function_traits<T, std::enable_if_t<trait::is_func_v<T>>> {
      |                                                                ^
/usr/local/include/sigslot/signal.hpp:233:33: error: ‘enable_if_t’ is not a member of ‘std’
  233 | struct function_traits<T*, std::enable_if_t<trait::is_func_v<T>>> {
      |                                 ^~~~~~~~~~~
/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<class T, class> struct sigslot::detail::function_traits’

5. The package name passed to `find_package_handle_standard_args` (CSPARSE)
  does not match the name of the calling package (CSparse)

这个错误是在cmake时候出现的,可以跳过,不影响后面

6. fatal error: g2o/solvers/csparse/linear_solver_csparse.h: 没有那个文件或目录

这是应为之前没有安装csparse,所以检测不到这个安装g2o时候就跳过去了,需要先安装csparse,再重新编译g2o

7. more undefined references to `fmt::v9::detail::throw_format_error(char const*)' follow

错误信息:

/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

8. relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC

错误信息

[ 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

9. undefined reference to `typeinfo for testing::Test'

/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}添加到链接库中

10. /home/w/Downloads/soft/anaconda3/lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found

conda install -c conda-forge libstdcxx-ng=12
  • 6
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值