Ubuntu16.04编译王京大神VIORB过程中遇到的问题

本文记录了在Ubuntu16.04上编译VIORB时遇到的问题,包括编译错误、OpenCV版本冲突、gcc版本问题以及Pangolin库的编译问题。通过修改CMakeLists.txt文件、调整OpenCV版本和重新编译Pangolin等步骤,最终成功解决所有问题并完成编译。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前言

这两天遇到了先后遇到了,
1. rosbuild_ws下面编译通过代码,但是无法执行程序,无法跑数据库的尴尬局面;
2. rosbuild_ws下面同时存在LearnVIORB和另外一个基于此的代码的时候,ros路径的问题;
3. 然后rosbuild_ws彻底不工作的问题;
4. ~/.zshrc系列设置的问题;
5. 然后索性把rosbuild_ws下面的东西先拷贝出来。在catkin_ws下面编译!
这次记录了在这个下面编译VIORB的过程中先后遇到的问题,记录一下!
——————————————————————————————————————————————————————

问题一:

编译过程中出现YOU MIXED DIFFERENT NUMERIC TYPES等等错误,就是说显示的是各种看起来让人不舒服的<>这种括号里面乱七八糟的东西,因为之前单独编译ORB-SLAM的时候也遇到过,就一下子解决了
【解决办法】
Step1:
在LearnVIORB项目下,进入到Thirdparty/g2o/g2o/solvers目录下面:
Step2:
用vim或者gedit修改linear_solver_eigen.h文件;
具体的修改的内容:

//1.找到下面这一行:
typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, SparseMatrix::Index> PermutationMatrix;
//2.把上面找到的这一行修改为:
typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, int> PermutationMatrix;

简而言之,上面其实就是把<>里面的SparseMatrix::Index换成int而已

Step3:
保存退出重新编译。

然后在编译的过程中我又遇到了这样的问题:
————————————————————————————————————————————————————————

问题二:

OpenCV版本的问题,LearnVIORB 提供的是OpenCV 2.x.x的版本,具体的我忘记了,
但是在编译的过程中总是走到开始编译 VIO部分60%部分的时候报错然后就失败了!!!
【解决办法】
这个比较简单,不一一列举了!
简单的说就是把 LearnVIORB下面的 CMakeList.txt和Examples/ROS/VIO_ORB下面的CMakeList.txt中的find package()都改成相应的版本,顺便还要在之前添加:
set( OpenCV_DIR "/usr/local/opencv3.2.0/share/OpenCV")
这里我以自己安装opencv3的地址为例,记住是每个CMakeListx.txt都要进行这样的操作~

好了,这下VIORB的VIO的部分能够编译到100%了,但是又出现了如下的新的问题:
——————————————————————————————————————————————————————

问题三:

报错信息:
基本就是各种undefined reference to XXX
看得我就很生气!很生气!

Scanning dependencies of target VIO
[ 66%] Building CXX object CMakeFiles/VIO.dir/src/MsgSync/MsgSynchronizer.cpp.o
[ 66%] Building CXX object CMakeFiles/VIO.dir/src/ros_vio.cc.o
[100%] Linking CXX executable ../VIO
CMakeFiles/VIO.dir/src/ros_vio.cc.o: In function `bool rosbag::Bag::readField<unsigned int>(std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, std::string const&, bool, unsigned int*) const':
ros_vio.cc:(.text._ZNK6rosbag3Bag9readFieldIjEEbRKSt3mapISsSsSt4lessISsESaISt4pairIKSsSsEEERS6_bPT_[_ZNK6rosbag3Bag9readFieldIjEEbRKSt3mapISsSsSt4lessISsESaISt4pairIKSsSsEEERS6_bPT_]+0x25): undefined reference to `rosbag::Bag::checkField(std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, std::string const&, unsigned int, unsigned int, bool) const'
CMakeFiles/VIO.dir/src/ros_vio.cc.o: In function `ros::SubscriptionCallbackHelperT<boost::shared_ptr<sensor_msgs::Imu_<std::allocator<void> > const> const&, void>::deserialize(ros::SubscriptionCallbackHelperDeserializeParams const&)':
ros_vio.cc:(.text._ZN3ros27SubscriptionCallbackHelperTIRKN5boost10shared_ptrIKN11sensor_msgs4Imu_ISaIvEEEEEvE11deserializeERKNS_43SubscriptionCallbackHelperDeserializeParamsE[_ZN3ros27SubscriptionCallbackHelperTIRKN5boost10shared_ptrIKN11sensor_msgs4Imu_ISaIvEEEEEvE11deserializeERKNS_43SubscriptionCallbackHelperDeserializeParamsE]+0x6f7): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
CMakeFiles/VIO.dir/src/ros_vio.cc.o: In function `boost::shared_ptr<sensor_msgs::Imu_<std::allocator<void> > > rosbag::Bag::instantiateBuffer<sensor_msgs::Imu_<std::allocator<void> > >(rosbag::IndexEntry const&) const':
ros_vio.cc:(.text._ZNK6rosbag3Bag17instantiateBufferIN11sensor_msgs4Imu_ISaIvEEEEEN5boost10shared_ptrIT_EERKNS_10IndexEntryE[_ZNK6rosbag3Bag17instantiateBufferIN11sensor_msgs4Imu_ISaIvEEEEEN5boost10shared_ptrIT_EERKNS_10IndexEntryE]+0x3ab): undefined reference to `rosbag::Bag::readField(std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, std::string const&, bool, std::string&) const'
ros_vio.cc:(.text._ZNK6rosbag3Bag17instantiateBufferIN11sensor_msgs4Imu_ISaIvEEEEEN5boost10shared_ptrIT_EERKNS_10IndexEntryE[_ZNK6rosbag3Bag17instantiateBufferIN11sensor_msgs4Imu_ISaIvEEEEEN5boost10shared_ptrIT_EERKNS_10IndexEntryE]+0x3c5): undefined reference to `rosbag::Bag::readField(std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, std::string const&, bool, std::string&) const'
ros_vio.cc:(.text._ZNK6rosbag3Bag17instantiateBufferIN11sensor_msgs4Imu_ISaIvEEEEEN5boost10shared_ptrIT_EERKNS_10IndexEntryE[_ZNK6rosbag3Bag17instantiateBufferIN11sensor_msgs4Imu_ISaIvEEEEEN5boost10shared_ptrIT_EERKNS_10IndexEntryE]+0x3df): undefined reference to `rosbag::Bag::readField(std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, std::string const&, bool, std::string&) const'
CMakeFiles/VIO.dir/src/ros_vio.cc.o: In function `boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > > rosbag::Bag::instantiateBuffer<sensor_msgs::Image_<std::allocator<void> > >(rosbag::IndexEn
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值