我正在使用 Ubuntu 16.04(带有 boost 1.58),我必须使用boost::beast
. 所以我得到了最新版本的 boost (1.67),现在我正在尝试编译beast 存储库以使用示例。
我以最简单的方式编译了 boost。./bootstrap
然后我做了./bjam
,它编译得很好(我使用了它)。
我需要什么:我需要 cmake 来识别我希望它找到 1.67 版本,而不是系统中的版本 ( /usr/bin
)。
为什么我不能从我的系统中删除 boost 的存储库版本?因为它将删除我系统中的许多其他依赖项,并且我开发了其他使用 Ubuntu 16.04 作为基线的东西。
我尝试了什么:
在CMakeLists.txt
我从存储库获得的文件中,我根据文档添加了这些行(在所有内容之前和项目名称之后):
set(BOOST_ROOT "/path/to/compiled/boost/")
set(BOOSTROOT "/path/to/compiled/boost/")
set(BOOST_LIBRARYDIR "/path/to/compiled/boost/stage/lib/")
set(BOOST_INCLUDEDIR "/path/to/compiled/boost/")
set(Boost_NO_SYSTEM_PATHS ON)
当我尝试编译野兽(以便它也编译示例)时,我收到错误:
fatal error: boost/utility/string_view.hpp: No such file or directory
我什至从我的系统中卸载了 cmake 并自己编译了一个,Cmake 3.11.2。
我还可以做些什么?请指教。
编辑:以下是按照Boost_DEBUG
评论中的建议启用后 cmake 的输出:
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1121 ] _boost_TEST_VERSIONS = 1.67.0;1.67
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1123 ] Boost_USE_MULTITHREADED = TRUE
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1125 ] Boost_USE_STATIC_LIBS =
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1127 ] Boost_USE_STATIC_RUNTIME =
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1129 ] Boost_ADDITIONAL_VERSIONS =
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1131 ] Boost_NO_SYSTEM_PATHS = ON
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1199 ] Declared as CMake or Environmental Variables:
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1201 ] BOOST_ROOT = /path/to/compiled/boost/
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1203 ] BOOST_INCLUDEDIR = /path/to/compiled/boost/
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1205 ] BOOST_LIBRARYDIR = /path/to/compiled/boost/stage/lib/
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1207 ] _boost_TEST_VERSIONS = 1.67.0;1.67
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1282 ] Include debugging info:
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1284 ] _boost_INCLUDE_SEARCH_DIRS = /path/to/compiled/boost/;/path/to/compiled/boost//include;/path/to/compiled/boost/;NO_CMAKE_SYSTEM_PATH;NO_SYSTEM_ENVIRONMENT_PATH
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1286 ] _boost_PATH_SUFFIXES = boost-1_67_0;boost_1_67_0;boost/boost-1_67_0;boost/boost_1_67_0;boost-1_67;boost_1_67;boost/boost-1_67;boost/boost_1_67
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1306 ] location of version.hpp: /path/to/compiled/boost/boost/version.hpp
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1330 ] version.hpp reveals boost 1.67.0
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1416 ] guessed _boost_COMPILER = -gcc54
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1426 ] _boost_MULTITHREADED = -mt
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1502 ] _boost_RELEASE_ABI_TAG = -
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1504 ] _boost_DEBUG_ABI_TAG = -d
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1567 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = /path/to/compiled/boost/stage/lib/;/path/to/compiled/boost//lib;/path/to/compiled/boost//stage/lib;/path/to/compiled/boost/lib;/path/to/compiled/boost/../lib;/path/to/compiled/boost/stage/lib;NO_CMAKE_SYSTEM_PATH;NO_SYSTEM_ENVIRONMENT_PATH_boost_LIBRARY_SEARCH_DIRS_DEBUG = /path/to/compiled/boost/stage/lib/;/path/to/compiled/boost//lib;/path/to/compiled/boost//stage/lib;/path/to/compiled/boost/lib;/path/to/compiled/boost/../lib;/path/to/compiled/boost/stage/lib;NO_CMAKE_SYSTEM_PATH;NO_SYSTEM_ENVIRONMENT_PATH
-- [ /home/user/Programs/cmake/cmake-install/share/cmake-3.11/Modules/FindBoost.cmake:1883 ] Boost_FOUND = 1
-- Boost version: 1.67.0
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.0.2g")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/temp/beast/build