记录一下编译高翔《自动驾驶与机器人中的SLAM技术》中遇到的问题

1.报错如下:

../../../lib/libslam_in_auto_driving.tools.so: undefined reference to `tbb::interface7::internal::isolate_within_arena(tbb::interface7::internal::delegate_base&, long)'
collect2: error: ld returned 1 exit status
src/tools/CMakeFiles/ui_test.dir/build.make:833: recipe for target '../bin/ui_test' failed
make[2]: *** [../bin/ui_test] Error 1
CMakeFiles/Makefile2:3829: recipe for target 'src/tools/CMakeFiles/ui_test.dir/all' failed
make[1]: *** [src/tools/CMakeFiles/ui_test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 94%] Built target slam_in_auto_driving.common
Makefile:145: recipe for target 'all' failed
make: *** [all] Error 2

解决方案:

在对应的Cmakefiles文件中的

target_link_libraries

     与

add_executable

         加入这三行。

        /usr/local/lib/libtbb.so
        /usr/local/lib/libtbbmalloc.so
        /usr/local/lib/libtbbmalloc_proxy.so

2.报错如下:

CMakeFiles/test_nn.dir/test_nn.cc.o:在函数‘std::result_of<std::integral_constant<bool, true> ()>::type __pstl::__internal::__except_handler<__pstl::__internal::__pattern_walk1<__pstl::execution::v1::parallel_unsequenced_policy const&, __gnu_cxx::__normal_iterator<unsigned long*, std::vector<unsigned long, std::allocator<unsigned long> > >, sad::GridNN<2>::GetClosestPointForCloudMT(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >, boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >, std::vector<std::pair<unsigned long, unsigned long>, std::allocator<std::pair<unsigned long, unsigned long> > >&)::{lambda(unsigned long const&)#2}, std::integral_constant<bool, true> >(__pstl::execution::v1::parallel_unsequenced_policy const&, __gnu_cxx::__normal_iterator<unsigned long*, std::vector<unsigned long, std::allocator<unsigned long> > >, __pstl::execution::v1::parallel_unsequenced_policy const&, sad::GridNN<2>::GetClosestPointForCloudMT(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >, boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >, std::vector<std::pair<unsigned long, unsigned long>, std::allocator<std::pair<unsigned long, unsigned long> > >&)::{lambda(unsigned long const&)#2}, std::integral_constant<bool, true>, std::integral_constant)::{lambda()#1}>(std::integral_constant<bool, true>)’中:
/usr/local/include/tbb/task_arena.h:157:对‘tbb::interface7::internal::isolate_within_arena(tbb::interface7::internal::delegate_base&, long)’未定义的引用
CMakeFiles/test_nn.dir/test_nn.cc.o:在函数‘std::result_of<std::integral_constant<bool, true> ()>::type __pstl::__internal::__except_handler<__pstl::__internal::__pattern_walk1<__pstl::execution::v1::parallel_unsequenced_policy const&, __gnu_cxx::__normal_iterator<unsigned long*, std::vector<unsigned long, std::allocator<unsigned long> > >, sad::GridNN<3>::GetClosestPointForCloudMT(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >, boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >, std::vector<std::pair<unsigned long, unsigned long>, std::allocator<std::pair<unsigned long, unsigned long> > >&)::{lambda(unsigned long const&)#2}, std::integral_constant<bool, true> >(__pstl::execution::v1::parallel_unsequenced_policy const&, __gnu_cxx::__normal_iterator<unsigned long*, std::vector<unsigned long, std::allocator<unsigned long> > >, __pstl::execution::v1::parallel_unsequenced_policy const&, sad::GridNN<3>::GetClosestPointForCloudMT(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >, boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >, std::vector<std::pair<unsigned long, unsigned long>, std::allocator<std::pair<unsigned long, unsigned long> > >&)::{lambda(unsigned long const&)#2}, std::integral_constant<bool, true>, std::integral_constant)::{lambda()#1}>(std::integral_constant<bool, true>)’中:
/usr/local/include/tbb/task_arena.h:157:对‘tbb::interface7::internal::isolate_within_arena(tbb::interface7::internal::delegate_base&, long)’未定义的引用
collect2: error: ld returned 1 exit status
src/ch5/CMakeFiles/test_nn.dir/build.make:673: recipe for target '../bin/test_nn' failed
make[2]: *** [../bin/test_nn] Error 1
CMakeFiles/Makefile2:4917: recipe for target 'src/ch5/CMakeFiles/test_nn.dir/all' failed
make[1]: *** [src/ch5/CMakeFiles/test_nn.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

研究了下,感觉还是tbb的问题,采用下面指令解决:

cd /usr/lib/x86_64-linux-gnu
# 如果存在以下三个文件,则备份之
sudo mv libtbb.so libtbb.so.bk
sudo mv libtbbmalloc_proxy.so libtbbmalloc_proxy.so.bk
sudo mv libtbbmalloc.so libtbbmalloc.so.bk
# 建立正确的符号链接
sudo ln -s /usr/local/tbb-2019_U8/lib/libtbb.so.2 libtbb.so 
sudo ln -s /usr/local/tbb-2019_U8/lib/libtbbmalloc.so.2 libtbbmalloc.so
sudo ln -s /usr/local/tbb-2019_U8/lib/libtbbmalloc_proxy.so.2 libtbbmalloc_proxy.so

感觉他也能解决第一个问题

3.报错如下:

In file included from /opt/ros/melodic/include/roslz4/lz4s.h:38,
                 from /opt/ros/melodic/include/rosbag/stream.h:46,
                 from /opt/ros/melodic/include/rosbag/chunked_file.h:46,
                 from /opt/ros/melodic/include/rosbag/bag.h:41,
                 from /home/mw/slam_in_autonomous_driving/src/common/io_utils.h:8,
                 from /home/mw/slam_in_autonomous_driving/src/ch6/test_2d_icp_s2s.cc:10:
/usr/include/lz4.h:196:57: error: conflicting declaration ‘typedef struct LZ4_stream_t LZ4_stream_t’
  196 | typedef struct { long long table[LZ4_STREAMSIZE_U64]; } LZ4_stream_t;
      |                                                         ^~~~~~~~~~~~

采用下面方案解决:

先找到/usr/include/flann/util/serialization.h  该文件,修改里面内容,

先将

#include "flann/ext/lz4.h"
#include "flann/ext/lz4hc.h"这两行注释,

然后加入下面两行:

#include "lz4.h"
#include "lz4hc.h"

参考文章:

https://blog.csdn.net/billowwong/article/details/122324083

https://blog.csdn.net/davidhopper/article/details/98309966

https://blog.csdn.net/guanjing_dream/article/details/132531693

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值