我知道已有类似的问题和良好的解决方案;但是,这些解决方案都没有帮助解决我的问题。我正在尝试为我的研究实验建立一个库。该库需要Boost 1.48作为其先决条件之一。我在服务器上的个人Ubuntu上构建了这个库,一切都很好。我使用以下命令安装所需的boost库:
sudo apt-get install libboost-all-dev
sudo apt-get install libboost1.48-dev
sudo apt-get install libboost-program-options1.48-dev
sudo apt-get install libboost-system1.48-dev
sudo apt-get install libboost-filesystem1.48-dev
sudo apt-get install libboost-random1.48-dev
sudo apt-get install libboost-thread1.48-dev
现在我必须在另一台服务器上安装此库。我不是这个人的管理员;因此我没有足够的权限来安装包或使用sudo
。所以我从它的网站下载了boost 1.48并将其解压到了当地。然后我设置环境变量来解决boost本地目录。
export BOOST_ROOT= <"boost extracted directory">
export BOOST_LIBRARYDIR=<"boost extracted directory/lib">
这次CMake找到除boost_random
以外的所有增强库。
CMake Error at /usr/share/cmake/Modules/FindBoost.cmake:1138 (message):
Unable to find the requested Boost libraries.
Boost version: 1.48.0
Boost include path: /home/ME/Research/BOOST/boost_1_48_0
Could not find the following Boost libraries:
boost_random
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. Call Stack (most recent call first):
CMakeLists.txt:6 (FIND_PACKAGE)
如果您能帮我解决这个问题,我将非常感谢。
注意: cmake -DBoost_DEBUG=ON -DBOOST_ROOT=/home/ME/Research/BOOST/boost_1_48_0/ -DBOOST_LIBRARYDIR=/home/ME/Research/BOOST/boost_1_48_0/libs/ -DBOOST_INCLUDEDIR=/home/ME/Research/BOOST/boost_1_48_0/boost/ .. > out6.txt
的报告如下:
-- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY)
-- [ /usr/share/cmake/Modules/FindBoost.cmake:481 ] _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
-- [ /usr/share/cmake/Modules/FindBoost.cmake:483 ] Boost_USE_MULTITHREADED = TRUE
-- [ /usr/share/cmake/Modules/FindBoost.cmake:485 ] Boost_USE_STATIC_LIBS =
-- [ /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 = /home/ME/Research/BOOST/boost_1_48_0/
-- [ /usr/share/cmake/Modules/FindBoost.cmake:547 ] BOOST_INCLUDEDIR = /home/ME/Research/BOOST/boost_1_48_0/boost/
-- [ /usr/share/cmake/Modules/FindBoost.cmake:549 ] BOOST_LIBRARYDIR = /home/ME/Research/BOOST/boost_1_48_0/libs/
-- [ /usr/share/cmake/Modules/FindBoost.cmake:551 ] _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
-- [ /usr/share/cmake/Modules/FindBoost.cmake:620 ] Include debugging info:
-- [ /usr/share/cmake/Modules/FindBoost.cmake:622 ] _boost_INCLUDE_SEARCH_DIRS = /home/ME/Research/BOOST/boost_1_48_0/boost/;/home/ME/Research/BOOST/boost_1_48_0//include;/home/ME/Research/BOOST/boost_1_48_0/;PATHS;C:/boost/include;C:/boost;/sw/local/include
-- [ /usr/share/cmake/Modules/FindBoost.cmake:624 ] _boost_PATH_SUFFIXES = boost-1_56_0;boost_1_56_0;boost/boost-1_56_0;boost/boost_1_56_0;boost-1_56;boost_1_56;boost/boost-1_56;boost/boost_1_56;boost-1_55_0;boost_1_55_0;boost/boost-1_55_0;boost/boost_1_55_0;boost-1_55;boost_1_55;boost/boost-1_55;boost/boost_1_55;boost-1_54_0;boost_1_54_0;boost/boost-1_54_0;boost/boost_1_54_0;boost-1_54;boost_1_54;boost/boost-1_54;boost/boost_1_54;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;boost-1_52_0;boost_1_52_0;boost/boost-1_52_0;boost/boost_1_52_0;boost-1_52;boost_1_52;boost/boost-1_52;boost/boost_1_52;boost-1_51_0;boost_1_51_0;boost/boost-1_51_0;boost/boost_1_51_0;boost-1_51;boost_1_51;boost/boost-1_51;boost/boost_1_51;boost-1_50_0;boost_1_50_0;boost/boost-1_50_0;boost/boost_1_50_0;boost-1_50;boost_1_50;boost/boost-1_50;boost/boost_1_50;boost-1_49_0;boost_1_49_0;boost/boost-1_49_0;boost/boost_1_49_0;boost-1_49;boost_1_49;boost/boost-1_49;boost/boost_1_49;boost-1_48_0;boost_1_48_0;boost/boost-1_48_0;boost/boost_1_48_0;boost-1_48;boost_1_48;boost/boost-1_48;boost/boost_1_48
-- [ /usr/share/cmake/Modules/FindBoost.cmake:644 ] location of version.hpp: /home/ME/Research/BOOST/boost_1_48_0/boost/version.hpp
-- [ /usr/share/cmake/Modules/FindBoost.cmake:668 ] version.hpp reveals boost 1.48.0
-- [ /usr/share/cmake/Modules/FindBoost.cmake:744 ] guessed _boost_COMPILER = -gcc44
-- [ /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 = /home/ME/Research/BOOST/boost_1_48_0/libs/;/home/ME/Research/BOOST/boost_1_48_0//lib;/home/ME/Research/BOOST/boost_1_48_0//stage/lib;/home/ME/Research/BOOST/boost_1_48_0/lib;/home/ME/Research/BOOST/boost_1_48_0/../lib;/home/ME/Research/BOOST/boost_1_48_0/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
-- [ /usr/share/cmake/Modules/FindBoost.cmake:957 ] Searching for PROGRAM_OPTIONS_LIBRARY_RELEASE: boost_program_options-gcc44-mt-1_48;boost_program_options-gcc44-mt;boost_program_options-mt-1_48;boost_program_options-mt;boost_program_options
-- [ /usr/share/cmake/Modules/FindBoost.cmake:993 ] Searching for PROGRAM_OPTIONS_LIBRARY_DEBUG: boost_program_options-gcc44-mt-d-1_48;boost_program_options-gcc44-mt-d;boost_program_options-mt-d-1_48;boost_program_options-mt-d;boost_program_options-mt;boost_program_options
-- [ /usr/share/cmake/Modules/FindBoost.cmake:957 ] Searching for SYSTEM_LIBRARY_RELEASE: boost_system-gcc44-mt-1_48;boost_system-gcc44-mt;boost_system-mt-1_48;boost_system-mt;boost_system
-- [ /usr/share/cmake/Modules/FindBoost.cmake:993 ] Searching for SYSTEM_LIBRARY_DEBUG: boost_system-gcc44-mt-d-1_48;boost_system-gcc44-mt-d;boost_system-mt-d-1_48;boost_system-mt-d;boost_system-mt;boost_system
-- [ /usr/share/cmake/Modules/FindBoost.cmake:957 ] Searching for FILESYSTEM_LIBRARY_RELEASE: boost_filesystem-gcc44-mt-1_48;boost_filesystem-gcc44-mt;boost_filesystem-mt-1_48;boost_filesystem-mt;boost_filesystem
-- [ /usr/share/cmake/Modules/FindBoost.cmake:993 ] Searching for FILESYSTEM_LIBRARY_DEBUG: boost_filesystem-gcc44-mt-d-1_48;boost_filesystem-gcc44-mt-d;boost_filesystem-mt-d-1_48;boost_filesystem-mt-d;boost_filesystem-mt;boost_filesystem
-- [ /usr/share/cmake/Modules/FindBoost.cmake:957 ] Searching for RANDOM_LIBRARY_RELEASE: boost_random-gcc44-mt-1_48;boost_random-gcc44-mt;boost_random-mt-1_48;boost_random-mt;boost_random
-- [ /usr/share/cmake/Modules/FindBoost.cmake:993 ] Searching for RANDOM_LIBRARY_DEBUG: boost_random-gcc44-mt-d-1_48;boost_random-gcc44-mt-d;boost_random-mt-d-1_48;boost_random-mt-d;boost_random-mt;boost_random
-- [ /usr/share/cmake/Modules/FindBoost.cmake:957 ] Searching for THREAD_LIBRARY_RELEASE: boost_thread-gcc44-mt-1_48;boost_thread-gcc44-mt;boost_thread-mt-1_48;boost_thread-mt;boost_thread
-- [ /usr/share/cmake/Modules/FindBoost.cmake:993 ] Searching for THREAD_LIBRARY_DEBUG: boost_thread-gcc44-mt-d-1_48;boost_thread-gcc44-mt-d;boost_thread-mt-d-1_48;boost_thread-mt-d;boost_thread-mt;boost_thread
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1044 ] Boost_FOUND = 1
-- Configuring incomplete, errors occurred!
See also "/home/ME/Research/CURRENNT/build/CMakeFiles/CMakeOutput.log".
答案 0 :(得分:-4)
我不确定这是否会有所帮助,但如果CMake使用了makefile概念,那么这就是我必须添加到我的makefile中才能成功编译boost(但是我使用Gnu Make,所以再次,不知道这是否会帮助):
LDLIBS := -lboost_thread -lboost_system -lboost_filesystem
我猜您需要添加-lboost_random
之类的内容吗?