0

我想用 CMake 在 Debian Jessy 上构建 stp,它使用 boost 库,我得到了错误:找不到以下 Boost 库:boost_program_options boost_system

我试图直接设置包含路径但没有成功。对我来说,似乎只有标题而没有库。我能做些什么?

这里是 Boost_DEBUG=ON 和 Boost_DETAILED_FAILURE=ON 的完整输出:

-- Doing a RelWithDebInfo build
-- Building shared library currently broken due to mix of C++/C code
-- Checking for C++ hash_set implementation...
-- C++ hash_set found as std::unordered_set in <unordered_set>
-- Checking for C++ hash_multiset implementation...
-- C++ hash_multiset found as std::unordered_multiset in <unordered_set>
-- Checking for C++ hash_map implementation...
-- C++ hash_map found as std::unordered_map in <unordered_map>
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:492 ] _boost_TEST_VERSIONS = 1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53;1.52.0;1.52;1.51.0;1.51;1.50.0;1.50;1.49.0;1.49;1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:494 ] Boost_USE_MULTITHREADED = TRUE
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:496 ] Boost_USE_STATIC_LIBS = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:498 ] Boost_USE_STATIC_RUNTIME = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:500 ] Boost_ADDITIONAL_VERSIONS = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:502 ] Boost_NO_SYSTEM_PATHS = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:554 ] Declared as CMake or Environmental Variables:
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:556 ]   BOOST_ROOT = /usr/include/boost
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:558 ]   BOOST_INCLUDEDIR = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:560 ]   BOOST_LIBRARYDIR = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:562 ] _boost_TEST_VERSIONS = 1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53;1.52.0;1.52;1.51.0;1.51;1.50.0;1.50;1.49.0;1.49;1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:655 ] location of version.hpp: /usr/include/boost/version.hpp
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:679 ] version.hpp reveals boost 1.54.0
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:755 ] guessed _boost_COMPILER = -gcc48
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:765 ] _boost_MULTITHREADED = -mt
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:808 ] _boost_RELEASE_ABI_TAG = -
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:810 ] _boost_DEBUG_ABI_TAG = -d
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:858 ] _boost_LIBRARY_SEARCH_DIRS = /usr/include/boost/lib;/usr/include/boost/stage/lib;/usr/include/lib;/usr/include/../lib;/usr/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:946 ] Searching for PROGRAM_OPTIONS_LIBRARY_RELEASE: boost_program_options-gcc48-mt-1_54;boost_program_options-gcc48-mt;boost_program_options-mt-1_54;boost_program_options-mt;boost_program_options
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:982 ] Searching for PROGRAM_OPTIONS_LIBRARY_DEBUG: boost_program_options-gcc48-mt-d-1_54;boost_program_options-gcc48-mt-d;boost_program_options-mt-d-1_54;boost_program_options-mt-d;boost_program_options-mt;boost_program_options
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:946 ] Searching for SYSTEM_LIBRARY_RELEASE: boost_system-gcc48-mt-1_54;boost_system-gcc48-mt;boost_system-mt-1_54;boost_system-mt;boost_system
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:982 ] Searching for SYSTEM_LIBRARY_DEBUG: boost_system-gcc48-mt-d-1_54;boost_system-gcc48-mt-d;boost_system-mt-d-1_54;boost_system-mt-d;boost_system-mt;boost_system
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1033 ] Boost_FOUND = 1
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1130 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.54.0

  Boost include path: /usr/include

  Could not find the following Boost libraries:

          boost_program_options
          boost_system

  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.
Call Stack (most recent call first):
  CMakeLists.txt:190 (find_package)


Adding public header(s) /home/michael/Downloads/stp/src/interface/C/c_interface.h to target libstp
Adding public header(s) /home/michael/Downloads/stp/src/interface/CPP/cpp_interface.h to target libstp
CMake Warning at CMakeLists.txt:269 (message):
  Testing is disabled


-- Configuring incomplete, errors occurred!
4

1 回答 1

0

我在 CentOS 上看到过同样的问题。

$ cat /etc/redhat-release 
CentOS Linux release 7.0.1406 (Core)

首先,我确保 libboost-system.so 存在于 /usr/lib64 中。

$ find /usr -name "*boost*"

然后,在 findBoost.cmake 中,我发现它只在somedir/lib 中看起来像 boost。所以我安装了x86版本

$ yum install boost-devel.x86_64

不工作。

最后,我想到了,只有.so文件。所以我尝试编辑 stp/CMakeLists.txt,并设置

set(Boost_USE_STATIC_LIBS OFF)

if(NOT BUILD_SHARED_LIBS)
    # If we are building libstp as static we will want to 
    # make sure there are no unresolved symbols to Boost
    # library functions. Later we'll merge them into the
    # archive so we'll need static boost libraries.
    message("Trying to use static Boost libraries")
    # set(Boost_USE_STATIC_LIBS ON)
endif()

有用!

于 2015-09-10T10:33:43.477 回答