Could not find a package configuration file provided by “boost_signals”

Could not find a package configuration file provided by “boost_signals”

Could not find a package configuration file provided by "boost_signals"
  (requested version 1.75.0) with any of the following names:

    boost_signalsConfig.cmake
    boost_signals-config.cmake
    Call Stack (most recent call first):

  /usr/local/lib/cmake/Boost-1.75.0/BoostConfig.cmake:258 (boost_find_component)
  /usr/local/share/cmake-3.20/Modules/FindBoost.cmake:594 (find_package)
  Creating-2D-laser-slam-from-scratch-master/lesson4/CMakeLists.txt:22 (find_package) 

编译文件时出现以上错误,进入/usr/local/lib/cmake/Boost-1.75.0目录搜索发现没有boost-signals包,怀疑安装的时候就没装这个包,在官网下载重新装了遍boost-1.75并安装,发现最后有几行文字:

...failed updating 54 targets...
...skipped 10 targets...
...updated 468 targets...

运行./b2 -q查看详情,

In file included from ./boost/python/detail/prefix.hpp:13,
                 from ./boost/python/dict.hpp:8,
                 from libs/python/src/dict.cpp:4:
./boost/python/detail/wrap_python.hpp:57:11: fatal error: pyconfig.h: 没有那个文件或目录
   57 | # include <pyconfig.h>
      |           ^~~~~~~~~~~~
compilation terminated.

发现缺少pyconfig,通过pip安装pyconfig再安装boost还是报错.
再次翻看报错内容,其中用的是python2.7,使用update-alternatives切换python版本无效,发现在conda环境里,使用conda deactivate退出conda环境后python版本变为2.7,再次编译发现还是没有boost-signals包.
仔细搜索后发现这个包在boost1.69后被移除了,小丑竟是我自己!!!
在这里插入图片描述
最后注释掉CmakeList中的find_package(Boost REQUIRED COMPONENTS thread signals),编译成功…

在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述


版权声明:本文为Brandonsemenuk原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。