编译Cmake时找不到boost_thread库

在catkin_make时发生如下错误:

CMake Error at /usr/share/cmake-3.5/Modules/FindBoost.cmake:1677 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.54.0

  Boost include path: /home/ilook/boost_1_54_0

  Could not find the following Boost libraries:

          boost_thread

  Some (but not all) of the required Boost libraries were found.  You may
  need to install these additional Boost libraries.  Alternatively, set
  BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
  to the location of Boost.

首先找到boost_thread库的位置:

ilook@ilook-vo:~/catkin_ws_robot$ locate boost_thread
/usr/lib/x86_64-linux-gnu/libboost_thread.a
/usr/lib/x86_64-linux-gnu/libboost_thread.so
/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.58.0
/usr/local/MATLAB/R2017a/bin/glnxa64/libboost_thread.so.1.56.0

发现boost_thread库是存在的,网上博客有说使用软链接也可以解决,但是对于我不行,于是常识修改CmakeList中找寻boost库的路径。
在工程的CmakeList中修改:

set(BOOST_LIBRARYDIR /usr/lib)
find_package(Boost REQUIRED COMPONENTS thread)

BOOST_LIBRARYDIR修改成locate找到的lib路径,此时会优先在设置的路径寻找。
成功编译,其他库类似

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

秃头队长

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值