嗨:我使用一些静态增强库来链接我正在编写的程序。我使用FindBoost.cmake来检查是否正确安装了boost。一切正常,直到我尝试从Boost 1.53.0更新到1.55.0。我最初安装的Boost是来自:
的vanilla安装yum install boost boost-devel
我首先尝试从这种人的回购安装升级到1.55.0:
[enetres]
name = ENETRES REPO for CentOS/RHEL $releasever
baseurl = http://repo.enetres.net/
enabled = 0
protect = 0
gpgcheck = 0
它已安装,但它没有我需要的东西所以我退出了它。那个过程进行了:
yum install boost-1.55.0
yum erase boost-1.55.0
我注意到在安装1.55.0时它取代了我的1.53.0安装。
然后我尝试使用bootstrap来安装boost的正常程序: http://www.boost.org/doc/libs/1_55_0/doc/html/bbv2/installation.html
我在/ opt / boost /中安装了这个,之后无法使用我rm -rf / opt / boost。
认为我恢复正常,我再次从yum重新启动了boost 1.53.0但FindBoost.cmake不再找到提升,即使我看到文件路径对包含和库目录是正确的
以下是我使用的库的示例,并且我已确认标头位于/ usr / include / boost中:
$ locate libboost_system
/usr/lib64/libboost_system-mt.a
/usr/lib64/libboost_system-mt.so
/usr/lib64/libboost_system-mt.so.1.53.0
/usr/lib64/libboost_system.a
/usr/lib64/libboost_system.so
/usr/lib64/libboost_system.so.1.53.0
当我使用-DBoost_DEBUG = ON运行cmake时,lib的所有路径和include目录看起来都是正确的。
有趣的调试输出:
$ ./build.sh -DBOOST_LIBRARYDIR=/usr/lib64 -DBoost_DEBUG=ON
-- [ /usr/share/cmake/Modules/FindBoost.cmake:481 ]
-- [ /usr/share/cmake/Modules/FindBoost.cmake:483 ] Boost_USE_MULTITHREADED = TRUE
-- [ /usr/share/cmake/Modules/FindBoost.cmake:485 ] Boost_USE_STATIC_LIBS = ON
-- [ /usr/share/cmake/Modules/FindBoost.cmake:487 ] Boost_USE_STATIC_RUNTIME =
-- [ /usr/share/cmake/Modules/FindBoost.cmake:489 ] Boost_ADDITIONAL_VERSIONS =
-- [ /usr/share/cmake/Modules/FindBoost.cmake:491 ] Boost_NO_SYSTEM_PATHS =
-- [ /usr/share/cmake/Modules/FindBoost.cmake:543 ] Declared as CMake or Environmental Variables:
-- [ /usr/share/cmake/Modules/FindBoost.cmake:545 ] BOOST_ROOT =
-- [ /usr/share/cmake/Modules/FindBoost.cmake:547 ] BOOST_INCLUDEDIR =
-- [ /usr/share/cmake/Modules/FindBoost.cmake:549 ] BOOST_LIBRARYDIR = /usr/lib64
...clip...
-- [ /usr/share/cmake/Modules/FindBoost.cmake:620 ] Include debugging info:
-- [ /usr/share/cmake/Modules/FindBoost.cmake:622 ] _boost_INCLUDE_SEARCH_DIRS = PATHS;C:/boost/include;C:/boost;/sw/local/include
-- [ /usr/share/cmake/Modules/FindBoost.cmake:624 ] _boost_PATH_SUFFIXES = ..clip...boost-1_53_0;boost_1_53_0;boost/boost-1_53_0;boost/boost_1_53_0;boost-1_53;boost_1_53;boost/boost-1_53;boost/boost_1_53;...clip...
-- [ /usr/share/cmake/Modules/FindBoost.cmake:644 ] location of version.hpp: /usr/include/boost/version.hpp
-- [ /usr/share/cmake/Modules/FindBoost.cmake:668 ] version.hpp reveals boost 1.53.0
-- [ /usr/share/cmake/Modules/FindBoost.cmake:744 ] guessed _boost_COMPILER = -gcc53
-- [ /usr/share/cmake/Modules/FindBoost.cmake:754 ] _boost_MULTITHREADED = -mt
-- [ /usr/share/cmake/Modules/FindBoost.cmake:797 ] _boost_RELEASE_ABI_TAG = -
-- [ /usr/share/cmake/Modules/FindBoost.cmake:799 ] _boost_DEBUG_ABI_TAG = -d
-- [ /usr/share/cmake/Modules/FindBoost.cmake:847 ] _boost_LIBRARY_SEARCH_DIRS = **/usr/lib64**;/usr/include/lib;/usr/include/../lib;/usr/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
-- [ /usr/share/cmake/Modules/FindBoost.cmake:957 ] Searching for SYSTEM_LIBRARY_RELEASE: boost_system-gcc53-mt-1_53;boost_system-gcc53-mt;boost_system-mt-1_53;**boost_system-mt**;**boost_system**
-- [ /usr/share/cmake/Modules/FindBoost.cmake:993 ] Searching for SYSTEM_LIBRARY_DEBUG: boost_system-gcc53-mt-d-1_53;boost_system-gcc53-mt-d;boost_system-mt-d-1_53;boost_system-mt-d;boost_system-mt;boost_system
-- [ /usr/share/cmake/Modules/FindBoost.cmake:957 ] Searching for FILESYSTEM_LIBRARY_RELEASE: boost_filesystem-gcc53-mt-1_53;boost_filesystem-gcc53-mt;boost_filesystem-mt-1_53;**boost_filesystem-mt;boost_filesystem**
-- [ /usr/share/cmake/Modules/FindBoost.cmake:993 ] Searching for FILESYSTEM_LIBRARY_DEBUG: boost_filesystem-gcc53-mt-d-1_53;boost_filesystem-gcc53-mt-d;boost_filesystem-mt-d-1_53;boost_filesystem-mt-d;boost_filesystem-mt;boost_filesystem
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1044 ] Boost_FOUND = 1
CMake Error at /usr/share/cmake/Modules/FindBoost.cmake:1138 (message):
Unable to find the requested Boost libraries.
Boost version: 1.53.0
Boost include path: /usr/include
Could not find the following static Boost libraries:
boost_system
boost_filesystem
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
如您所见,我正在设置BOOST_LIBRARYDIR = / usr / lib64。
非常感谢任何帮助。
答案 0 :(得分:1)
解决方案很有意义,但我很困惑:
yum install boost-static
好的,是的,我使用Boost_USE_STATIC_LIBS = ON以便线索指向解决方案,但我发誓' yum install boost boost-devel'用于安装静态标头......