ubuntu20.04+opencv4.2.0编译kimera

1. 报错:编译过程中出现找不到ros的问题时:

解决:

ROS环境下部分编译异常解决方案 - 古月居

或者可以试一下添加软连接:sudo ln -s /usr/local/include /usr/include ,因为默认搜索位置是/usr/include,而我们一般安装的位置是/usr/local/include

pkg_check_modules(EIGEN3 REQUIRED eigen3>=3.2) 语法找不到eigen时,可以换成

find_package(Eigen3 REQUIRED),然后按照上边的方法。

2. 报错:/usr/include/opencv4/opencv2/core/cvdef.h:704:4: error: #error "OpenCV 4.x+ requires enabled C++11 support" # error "OpenCV 4.x+ requires enabled C++11 support"

解决:

这种错误很可能是GCC 和 G++版本不匹配。在ubuntu20.04,我安装了好几个版本的cuda,对应就有不同版本的gcc c++,来回切换乱套了,最后把两个版本都切换成9版本就可以了。
 

3. 报错:‘xxx’ is not a member of ‘pcl::traits’的解决方法

解决:

在对应CMakeLists.txt的project后添加  set(CMAKE_CXX_STANDARD 14)

终端最后会有报错提示,看看是哪个包就去哪个包找。

对于ubuntu20.04来说,可能有很多包涉及这个问题,我遇到了kimera_rviz_markers和opencv3_catkin两个包。

4. 装依赖包的时候最好一个一个装,很有可能同时装很多包的话,有的包就没装上。

5. Kimera关闭测试,否则会出现一些到目前还没有解决的问题:

方法:

在 catkin/src/kimera-vio/CMakeLists.txt 中检索“native”,把这一行注释掉;把 CMakeLists.txt 的test也设置为OFF。

6.报错:/home/sqw/catkin_ws_kimera_sem/src/Kimera-VIO/src/backend/VioBackendParams.cpp:46:15:error: ‘struct gtsam::ISAM2Params’ has no member named ‘setCacheLinearizedFactors’; did you mean ‘cacheLinearizedFactors’?

解决:

isam_param->setCacheLinearizedFactors(true); 改成isam_param->cacheLinearizedFactors=true;

isam_param->setEvaluateNonlinearError(false); 改成isam_param->evaluateNonlinearError=false;

7. 报错:fauis to build due to: libkimera_semantics_ros undefined reference to cv::String::deallocate()

解决:

在CMakeLists.txt里加入

find_package(opencv3_catkin REQUIRED)
target_link_libraries(${PROJECT_NAME} ${opencv3_catkin_LIBRARIES}) 
其中第二条(target_link_libraries)要加在cs_add_executable之后

8. 报错:CMake Error at opencv3_contrib-prefix/src/opencv3_contrib-stamp/download-opencv3_contrib.cmake:170 (message):
  Each download failed!

    error: downloading 'https://github.com/opencv/opencv_contrib/archive/3.4.2.zip' failed

解决:

网络原因,换一个网络或者换个时间段,因为github在不同时间段稳定性有区别。

9. 报错:/home/sqw/catkin_ws_kimera_sem/build/opencv3_catkin/opencv3_contrib_src/modules/xfeatures2d/src/boostdesc.cpp:653:20: fatal error: boostdesc_bgm.i: No such file or directory

解决:

在本机opencv_contrib//modules/xfeatures2d/src/ 下把 boostdesc_bgm.i 、vgg_generated_48.i 等 11个文件拷到catkin_ws_kimera_sem/build/opencv3_catkin/opencv3_contrib_src/modules/xfeatures2d/src/下

10. 报错:/home/sqw/catkin_ws_kimera_sem/build/opencv3_catkin/opencv3_src/modules/stitching/include/opencv2/stitching/detail/matchers.hpp:52:12: fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory

解决:

home/sqw/catkin_ws_kimera_sem/build/opencv3_catkin/opencv3_src/modules/stitching/include/opencv2/stitching/detail/matchers.hpp中的# include "opencv2/xfeatures2d/cuda.hpp"换成绝对位置 # include "/home/sqw/catkin_ws_kimera_sem/build/opencv3_catkin/opencv3_contrib_src/modules/xfeatures2d/include/opencv2/xfeatures2d/cuda.hpp"

不建议换成本机安装路径 # include "/home/sqw/Documents/deps/opencv_contrib-4.2.0/modules/xfeatures2d/include/opencv2/xfeatures2d/cuda.hpp"

因为一会儿还要更改 "/home/sqw/catkin_ws_kimera_sem/build/opencv3_catkin/opencv3_contrib_src/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp" 里的

#include "/opencv2/xfeatures2d/nonfree.hpp" 路径,这样就把本机安装的文件给改乱了,而改此处build路径下的东西还可以通过重新编译生成。

11. 报错:

F0419 17:24:43.275704 24832 RosBagDataProvider.cpp:60] Check failed: !rosbag_path_.empty()

解决:

/home/sqw/catkin_ws_kimera_sem/src/Kimera-VIO-ROS/launch/kimera_vio_ros_euroc.launch :

<arg name="rosbag_path" default=" " 改成自己数据包的位置

<arg name="rosbag_path" default="/home/sqw/Documents/data/ros_data/EuRoC_stereo"

12. 报错:

terminate called after throwing an instance of 'rosbag::BagIOException'
  what():  Error reading version line

解决:

/home/sqw/catkin_ws_kimera_sem/src/Kimera-VIO-ROS/launch/kimera_vio_ros_euroc.launch :

<arg name="online" default="false" /> 改为<arg name="online" default="true" />

13. 报错

  Errors     << grpc:make /home/sqw/ROS_WS/voxblox/logs/grpc/build.make.000.log                                                                        
Cloning into 'grpc_build'...
HEAD is now at e5276ec36 Merge pull request #25135 from yulin-liang/fix_macos_distribtest
Submodule 'third_party/abseil-cpp' (https://github.com/abseil/abseil-cpp.git) registered for path 'third_party/abseil-cpp'
Submodule 'third_party/benchmark' (https://github.com/google/benchmark) registered for path 'third_party/benchmark'
Submodule 'third_party/bloaty' (https://github.com/google/bloaty.git) registered for path 'third_party/bloaty'
Submodule 'third_party/boringssl-with-bazel' (https://github.com/google/boringssl.git) registered for path 'third_party/boringssl-with-bazel'
Submodule 'third_party/cares/cares' (https://github.com/c-ares/c-ares.git) registered for path 'third_party/cares/cares'
Submodule 'third_party/envoy-api' (https://github.com/envoyproxy/data-plane-api.git) registered for path 'third_party/envoy-api'
Submodule 'third_party/googleapis' (https://github.com/googleapis/googleapis.git) registered for path 'third_party/googleapis'
Submodule 'third_party/googletest' (https://github.com/google/googletest.git) registered for path 'third_party/googletest'
Submodule 'third_party/libuv' (https://github.com/libuv/libuv.git) registered for path 'third_party/libuv'
Submodule 'third_party/protobuf' (https://github.com/google/protobuf.git) registered for path 'third_party/protobuf'
Submodule 'third_party/protoc-gen-validate' (https://github.com/envoyproxy/protoc-gen-validate.git) registered for path 'third_party/protoc-gen-validate'
Submodule 'third_party/re2' (https://github.com/google/re2.git) registered for path 'third_party/re2'
Submodule 'third_party/udpa' (https://github.com/cncf/udpa.git) registered for path 'third_party/udpa'
Submodule 'third_party/zlib' (https://github.com/madler/zlib) registered for path 'third_party/zlib'
Cloning into '/home/sqw/ROS_WS/voxblox/build/grpc/grpc_build/third_party/abseil-cpp'...
fatal: unable to access 'https://github.com/abseil/abseil-cpp.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
fatal: clone of 'https://github.com/abseil/abseil-cpp.git' into submodule path '/home/sqw/ROS_WS/voxblox/build/grpc/grpc_build/third_party/abseil-cpp' failed...

解决:是 protobuf_catkin 这个包用到了 grpc,也就是 voxblox_https.rosinstall 中需要下载的 catkin_grpc,虽然下载没有问题,但编译这个包的时候似乎要再下载某些东西,使用了很多方法也没有解决这个问题。网上最多的是删除代理或者增大buffer等Git Clone错误解决:GnuTLS recv error (-110): The TLS connection was non-properly terminated._蛙仔的博客-CSDN博客但是放在这里并没有用。

我的解决办法参照 catkin build error about grpc · Issue #389 · ethz-asl/voxblox · GitHub

(1)删除 catkin_grpc;(2)sudo apt install -y ros-noetic-grpc

相当于不使用源码编译grpc,而是直接使用 apt 安装。

14. 单独编译 voxblox 时可视化有点特别:安装voxblox构建稠密地图踩坑:_稻壳特筑的博客-CSDN博客_voxblox

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值