c++ - CMake 找不到 boost 。

标签 c++ bash boost cmake

我不熟悉 CMake。我正在尝试编译一个库 GTSAM 4.0。使用CMake。此处提供了编译说明:

https://bitbucket.org/gtborg/gtsam/src/c82fe1fde2fc988b6bde5e4798b66129bbb5da19/INSTALL?fileviewer=file-view-default

我收到一个错误,我猜这是因为无法定位 Boost 和 pthread.h。

谁能简单地解释一下如何解决这个问题?

bash登录如下:

username@DESKTOP-JME8PN9:/mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build$ cmake ..
-- GTSAM_SOURCE_ROOT_DIR: [/mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam]
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:882 ] _boost_TEST_VERSIONS = 1.61.0;1.61;1.60.0;1.60;1.59.0;1.59;1.58.0;1.58;1.57.0;1.57;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;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:884 ] Boost_USE_MULTITHREADED = TRUE
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:886 ] Boost_USE_STATIC_LIBS =
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:888 ] Boost_USE_STATIC_RUNTIME =
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:890 ] Boost_ADDITIONAL_VERSIONS =
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:892 ] Boost_NO_SYSTEM_PATHS =
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:960 ] Declared as CMake or Environmental Variables:
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:962 ]   BOOST_ROOT =
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:964 ]   BOOST_INCLUDEDIR =
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:966 ]   BOOST_LIBRARYDIR =
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:968 ] _boost_TEST_VERSIONS = 1.61.0;1.61;1.60.0;1.60;1.59.0;1.59;1.58.0;1.58;1.57.0;1.57;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;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1037 ] Include debugging info:
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1039 ]   _boost_INCLUDE_SEARCH_DIRS = PATHS;C:/boost/include;C:/boost;/sw/local/include
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1041 ]   _boost_PATH_SUFFIXES = boost-1_61_0;boost_1_61_0;boost/boost-1_61_0;boost/boost_1_61_0;boost-1_61;boost_1_61;boost/boost-1_61;boost/boost_1_61;boost-1_60_0;boost_1_60_0;boost/boost-1_60_0;boost/boost_1_60_0;boost-1_60;boost_1_60;boost/boost-1_60;boost/boost_1_60;boost-1_59_0;boost_1_59_0;boost/boost-1_59_0;boost/boost_1_59_0;boost-1_59;boost_1_59;boost/boost-1_59;boost/boost_1_59;boost-1_58_0;boost_1_58_0;boost/boost-1_58_0;boost/boost_1_58_0;boost-1_58;boost_1_58;boost/boost-1_58;boost/boost_1_58;boost-1_57_0;boost_1_57_0;boost/boost-1_57_0;boost/boost_1_57_0;boost-1_57;boost_1_57;boost/boost-1_57;boost/boost_1_57;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;boost-1_47_0;boost_1_47_0;boost/boost-1_47_0;boost/boost_1_47_0;boost-1_47;boost_1_47;boost/boost-1_47;boost/boost_1_47;boost-1_46_1;boost_1_46_1;boost/boost-1_46_1;boost/boost_1_46_1;boost-1_46_0;boost_1_46_0;boost/boost-1_46_0;boost/boost_1_46_0;boost-1_46;boost_1_46;boost/boost-1_46;boost/boost_1_46;boost-1_45_0;boost_1_45_0;boost/boost-1_45_0;boost/boost_1_45_0;boost-1_45;boost_1_45;boost/boost-1_45;boost/boost_1_45;boost-1_44_0;boost_1_44_0;boost/boost-1_44_0;boost/boost_1_44_0;boost-1_44;boost_1_44;boost/boost-1_44;boost/boost_1_44;boost-1_43_0;boost_1_43_0;boost/boost-1_43_0;boost/boost_1_43_0;boost-1_43;boost_1_43;boost/boost-1_43;boost/boost_1_43
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1061 ] location of version.hpp: /usr/include/boost/version.hpp
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1085 ] version.hpp reveals boost 1.58.0
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1171 ] guessed _boost_COMPILER = -gcc54
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1181 ] _boost_MULTITHREADED = -mt
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1224 ] _boost_RELEASE_ABI_TAG = -
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1226 ] _boost_DEBUG_ABI_TAG = -d
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1281 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/include/lib;/usr/include/../lib;/usr/include/../lib/x86_64-linux-gnu;/usr/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib_boost_LIBRARY_SEARCH_DIRS_DEBUG   = /usr/include/lib;/usr/include/../lib;/usr/include/../lib/x86_64-linux-gnu;/usr/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1404 ] Searching for SERIALIZATION_LIBRARY_RELEASE: boost_serialization-gcc54-mt-1_58;boost_serialization-gcc54-mt;boost_serialization-mt-1_58;boost_serialization-mt;boost_serialization
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_RELEASE = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1446 ] Searching for SERIALIZATION_LIBRARY_DEBUG: boost_serialization-gcc54-mt-d-1_58;boost_serialization-gcc54-mt-d;boost_serialization-mt-d-1_58;boost_serialization-mt-d;boost_serialization-mt;boost_serialization
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_DEBUG = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1404 ] Searching for SYSTEM_LIBRARY_RELEASE: boost_system-gcc54-mt-1_58;boost_system-gcc54-mt;boost_system-mt-1_58;boost_system-mt;boost_system
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_RELEASE = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1446 ] Searching for SYSTEM_LIBRARY_DEBUG: boost_system-gcc54-mt-d-1_58;boost_system-gcc54-mt-d;boost_system-mt-d-1_58;boost_system-mt-d;boost_system-mt;boost_system
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_DEBUG = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1404 ] Searching for FILESYSTEM_LIBRARY_RELEASE: boost_filesystem-gcc54-mt-1_58;boost_filesystem-gcc54-mt;boost_filesystem-mt-1_58;boost_filesystem-mt;boost_filesystem
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_RELEASE = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1446 ] Searching for FILESYSTEM_LIBRARY_DEBUG: boost_filesystem-gcc54-mt-d-1_58;boost_filesystem-gcc54-mt-d;boost_filesystem-mt-d-1_58;boost_filesystem-mt-d;boost_filesystem-mt;boost_filesystem
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_DEBUG = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1404 ] Searching for THREAD_LIBRARY_RELEASE: boost_thread-gcc54-mt-1_58;boost_thread-gcc54-mt;boost_thread-mt-1_58;boost_thread-mt;boost_thread
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_RELEASE = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1446 ] Searching for THREAD_LIBRARY_DEBUG: boost_thread-gcc54-mt-d-1_58;boost_thread-gcc54-mt-d;boost_thread-mt-d-1_58;boost_thread-mt-d;boost_thread-mt;boost_thread
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_DEBUG = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1404 ] Searching for PROGRAM_OPTIONS_LIBRARY_RELEASE: boost_program_options-gcc54-mt-1_58;boost_program_options-gcc54-mt;boost_program_options-mt-1_58;boost_program_options-mt;boost_program_options
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_RELEASE = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1446 ] Searching for PROGRAM_OPTIONS_LIBRARY_DEBUG: boost_program_options-gcc54-mt-d-1_58;boost_program_options-gcc54-mt-d;boost_program_options-mt-d-1_58;boost_program_options-mt-d;boost_program_options-mt;boost_program_options
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_DEBUG = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1404 ] Searching for DATE_TIME_LIBRARY_RELEASE: boost_date_time-gcc54-mt-1_58;boost_date_time-gcc54-mt;boost_date_time-mt-1_58;boost_date_time-mt;boost_date_time
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_RELEASE = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1446 ] Searching for DATE_TIME_LIBRARY_DEBUG: boost_date_time-gcc54-mt-d-1_58;boost_date_time-gcc54-mt-d;boost_date_time-mt-d-1_58;boost_date_time-mt-d;boost_date_time-mt;boost_date_time
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_DEBUG = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1404 ] Searching for TIMER_LIBRARY_RELEASE: boost_timer-gcc54-mt-1_58;boost_timer-gcc54-mt;boost_timer-mt-1_58;boost_timer-mt;boost_timer
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_RELEASE = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1446 ] Searching for TIMER_LIBRARY_DEBUG: boost_timer-gcc54-mt-d-1_58;boost_timer-gcc54-mt-d;boost_timer-mt-d-1_58;boost_timer-mt-d;boost_timer-mt;boost_timer
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_DEBUG = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1404 ] Searching for CHRONO_LIBRARY_RELEASE: boost_chrono-gcc54-mt-1_58;boost_chrono-gcc54-mt;boost_chrono-mt-1_58;boost_chrono-mt;boost_chrono
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_RELEASE = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1446 ] Searching for CHRONO_LIBRARY_DEBUG: boost_chrono-gcc54-mt-d-1_58;boost_chrono-gcc54-mt-d;boost_chrono-mt-d-1_58;boost_chrono-mt-d;boost_chrono-mt;boost_chrono
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_DEBUG = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1404 ] Searching for ATOMIC_LIBRARY_RELEASE: boost_atomic-gcc54-mt-1_58;boost_atomic-gcc54-mt;boost_atomic-mt-1_58;boost_atomic-mt;boost_atomic
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_RELEASE = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1446 ] Searching for ATOMIC_LIBRARY_DEBUG: boost_atomic-gcc54-mt-d-1_58;boost_atomic-gcc54-mt-d;boost_atomic-mt-d-1_58;boost_atomic-mt-d;boost_atomic-mt;boost_atomic
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:378 ]  Boost_LIBRARY_DIR_DEBUG = /usr/lib/x86_64-linux-gnu _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/lib/x86_64-linux-gnu;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/share/cmake-3.5/Modules/FindBoost.cmake:1516 ] Boost_FOUND = 1
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   serialization
--   system
--   filesystem
--   thread
--   program_options
--   date_time
--   timer
--   chrono
--   atomic
Ignoring Boost restriction on optional lvalue assignment from rvalues
-- Found Intel TBB
-- Could NOT find MKL (missing:  MKL_INCLUDE_DIR MKL_LIBRARIES)
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp
CMake Error at CMakeLists.txt:349 (add_subdirectory):
  add_subdirectory given source "wrap" which is not an existing directory.


CMake Error at CMakeLists.txt:353 (add_subdirectory):
  add_subdirectory given source "gtsam" which is not an existing directory.


CMake Error at CMakeLists.txt:356 (add_subdirectory):
  add_subdirectory given source "tests" which is not an existing directory.


CMake Warning at cmake/GtsamTesting.cmake:230 (message):
  The script exclusion pattern
  'DiscreteBayesNet_FG.cpp;UGM_chain.cpp;UGM_small.cpp;elaboratePoint2KalmanFilter.cpp'
  did not match any files
Call Stack (most recent call first):
  cmake/GtsamTesting.cmake:55 (gtsamAddExesGlob_impl)
  examples/CMakeLists.txt:8 (gtsamAddExamplesGlob)


CMake Error at CMakeLists.txt:362 (add_subdirectory):
  add_subdirectory given source "timing" which is not an existing directory.


CMake Error: File /mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/gtsam_extra.cmake.in does not exist.
CMake Error at cmake/GtsamMakeConfigFile.cmake:17 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:389 (GtsamMakeConfigFile)


-- Wrote /mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/GTSAMConfig.cmake
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.11")
-- ===============================================================
-- ================  Configuration Options  ======================
--   CMAKE_CXX_COMPILER_ID type     : GNU
--   CMAKE_CXX_COMPILER_VERSION     : 5.4.0
-- Build flags
--   Build Tests                    : Enabled
--   Build examples with 'make all' : Enabled
--   Build timing scripts with 'make all': Disabled
--   Build Docs                     : Enabled
--   Build static GTSAM library instead of shared: Disabled
--   Put build type in library name : Enabled
--   Build type                     : Release
--   C compilation flags            :  -std=c11   -Wall -O3 -DNDEBUG    -O3 -DNDEBUG
--   C++ compilation flags          :  -std=c++11 -Wall -O3 -DNDEBUG    -O3 -DNDEBUG
--   Use System Eigen               : No
--   Use Intel TBB                  : Yes
--   Eigen will use MKL             : MKL not found
--   Eigen will use MKL and OpenMP  : OpenMP found but MKL not found
--   Default allocator              : TBB
-- Packaging flags
--   CPack Source Generator         : TGZ
--   CPack Generator                : TGZ
-- GTSAM flags
--   Quaternions as default Rot3     : Disabled
--   Runtime consistency checking    : Disabled
--   Rot3 retract is full ExpMap     : Disabled
--   Pose3 retract is full ExpMap    : Disabled
--   Deprecated in GTSAM 4 allowed   : Enabled
--   Point3 is typedef to Vector3    : Disabled
--   Metis-based Nested Dissection   : Enabled
--   Use tangent-space preintegration: Enabled
-- MATLAB toolbox flags
--   Install matlab toolbox         : Disabled
--   Build Wrap                     : Enabled
-- Python module flags
--   Build python module            : Disabled
-- ===============================================================
CMake Warning at CMakeLists.txt:521 (message):
  MKL was not found - this is ok, but note that MKL yields better
  performance.  Set GTSAM_WITH_EIGEN_MKL to 'Off' to disable this warning.


-- Configuring incomplete, errors occurred!
See also "/mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeOutput.log".
See also "/mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeError.log".

这是来自 CMakeError.log

Determining if the pthread_create exist failed with the following output:
Change Dir: /mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_73ef2/fast"
/usr/bin/make -f CMakeFiles/cmTC_73ef2.dir/build.make CMakeFiles/cmTC_73ef2.dir/build
make[1]: Entering directory '/mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_73ef2.dir/CheckSymbolExists.c.o
/usr/bin/cc    -std=c11   -Wall    -o CMakeFiles/cmTC_73ef2.dir/CheckSymbolExists.c.o   -c /mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_73ef2
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_73ef2.dir/link.txt --verbose=1
/usr/bin/cc   -std=c11   -Wall     CMakeFiles/cmTC_73ef2.dir/CheckSymbolExists.c.o  -o cmTC_73ef2 -rdynamic 
CMakeFiles/cmTC_73ef2.dir/CheckSymbolExists.c.o: In function `main':
CheckSymbolExists.c:(.text+0x16): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_73ef2.dir/build.make:97: recipe for target 'cmTC_73ef2' failed
make[1]: *** [cmTC_73ef2] Error 1
make[1]: Leaving directory '/mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_73ef2/fast' failed
make: *** [cmTC_73ef2/fast] Error 2

File /mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_fafaf/fast"
/usr/bin/make -f CMakeFiles/cmTC_fafaf.dir/build.make CMakeFiles/cmTC_fafaf.dir/build
make[1]: Entering directory '/mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_fafaf.dir/CheckFunctionExists.c.o
/usr/bin/cc    -std=c11   -Wall -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_fafaf.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.5/Modules/CheckFunctionExists.c
Linking C executable cmTC_fafaf
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_fafaf.dir/link.txt --verbose=1
/usr/bin/cc   -std=c11   -Wall -DCHECK_FUNCTION_EXISTS=pthread_create    CMakeFiles/cmTC_fafaf.dir/CheckFunctionExists.c.o  -o cmTC_fafaf -rdynamic -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_fafaf.dir/build.make:97: recipe for target 'cmTC_fafaf' failed
make[1]: *** [cmTC_fafaf] Error 1
make[1]: Leaving directory '/mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_fafaf/fast' failed
make: *** [cmTC_fafaf/fast] Error 2


Determining if the pthread_create exist failed with the following output:
Change Dir: /mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_fb1b9/fast"
/usr/bin/make -f CMakeFiles/cmTC_fb1b9.dir/build.make CMakeFiles/cmTC_fb1b9.dir/build
make[1]: Entering directory '/mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_fb1b9.dir/CheckSymbolExists.c.o
/usr/bin/cc    -std=c11   -Wall    -o CMakeFiles/cmTC_fb1b9.dir/CheckSymbolExists.c.o   -c /mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_fb1b9
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_fb1b9.dir/link.txt --verbose=1
/usr/bin/cc   -std=c11   -Wall     CMakeFiles/cmTC_fb1b9.dir/CheckSymbolExists.c.o  -o cmTC_fb1b9 -rdynamic 
CMakeFiles/cmTC_fb1b9.dir/CheckSymbolExists.c.o: In function `main':
CheckSymbolExists.c:(.text+0x16): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_fb1b9.dir/build.make:97: recipe for target 'cmTC_fb1b9' failed
make[1]: *** [cmTC_fb1b9] Error 1
make[1]: Leaving directory '/mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_fb1b9/fast' failed
make: *** [cmTC_fb1b9/fast] Error 2

File /mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_5d77a/fast"
/usr/bin/make -f CMakeFiles/cmTC_5d77a.dir/build.make CMakeFiles/cmTC_5d77a.dir/build
make[1]: Entering directory '/mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_5d77a.dir/CheckFunctionExists.c.o
/usr/bin/cc    -std=c11   -Wall -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_5d77a.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.5/Modules/CheckFunctionExists.c
Linking C executable cmTC_5d77a
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_5d77a.dir/link.txt --verbose=1
/usr/bin/cc   -std=c11   -Wall -DCHECK_FUNCTION_EXISTS=pthread_create    CMakeFiles/cmTC_5d77a.dir/CheckFunctionExists.c.o  -o cmTC_5d77a -rdynamic -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_5d77a.dir/build.make:97: recipe for target 'cmTC_5d77a' failed
make[1]: *** [cmTC_5d77a] Error 1
make[1]: Leaving directory '/mnt/d/Downloads/gtborg-gtsam/gtborg-gtsam/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_5d77a/fast' failed
make: *** [cmTC_5d77a/fast] Error 2

最佳答案

恕我直言,你的问题不在于 boost ,因为你最终会得到这些:

-- Looking for pthread.h - found
...
-- Looking for pthread_create in pthread - found

我会更关心这些:

CMake Error at CMakeLists.txt:349 (add_subdirectory):
  add_subdirectory given source "wrap" which is not an existing directory.


CMake Error at CMakeLists.txt:353 (add_subdirectory):
  add_subdirectory given source "gtsam" which is not an existing directory.


CMake Error at CMakeLists.txt:356 (add_subdirectory):
  add_subdirectory given source "tests" which is not an existing directory.

关于c++ - CMake 找不到 boost 。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46722094/

相关文章:

c++ - 如何制作过滤掉非整数的 C++ 程序?

c++ - 使用来自 Cython 构造函数的参数初始化 C++ 对象

linux - 无法写入/dev/* 文件

c++ - boost::unordered_map 中的迭代器失效

c++ - 编译时对 boost::system::system_category() 的 undefined reference

c++ - 返回对 InputIterator 内部状态的引用是否合法?

C++ 缩进输出类继承 ofstream

linux - 暂停后台运行的 bash 脚本

linux - 对字符串中的特殊字符采取措施后,BASH错误 "[: too many arguments"是什么原因造成的?

c++ - boost lib 构建配置变化