0

When running

mkdir -p build && cd build && cmake -DCMAKE_INSTALL_PREFIX=/home/install -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=On ..; cd ../

inside a 3rd party library. I get the following error.

CMake Error at /usr/local/share/cmake-3.5/Modules/FindBoost.cmake:1657 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.67.0

  Boost include path: /usr/local/include

  Could not find the following static Boost libraries:

          boost_thread
          boost_date_time

  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.

So according to several other posts I have added:

set(BOOST_ROOT /usr/local)
set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib)
message(STATUS "BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")

to their CMakeLists.txt. Which gives me the following message:

-- BOOST_LIBRARYDIR = /usr/local/lib
-- Using CPU native flags for SSE optimization: -march=native
-- -- GCC > 4.3 found, enabling -Wabi
-- Found OpenMP
...

However, I still am getting the same error. Listing the contents of BOOST_LIBRARYDIR indicates the libraries are there.

root@74fdb1dd14f4:~/code/pcl# ls /usr/local/lib
cmake                  libboost_prg_exec_monitor.so.1.67.0     libflann.so.1.9
libboost_atomic.a          libboost_program_options.a          libflann.so.1.9.1-003
libboost_atomic.so         libboost_program_options.so         libflann_cpp.so
libboost_atomic.so.1.67.0      libboost_program_options.so.1.67.0      libflann_cpp.so.1.9
libboost_chrono.a          libboost_regex.a                libflann_cpp.so.1.9.1-003
libboost_chrono.so         libboost_regex.so               libflann_cpp_s.a
libboost_chrono.so.1.67.0      libboost_regex.so.1.67.0            libflann_s.a
libboost_date_time.a           libboost_system.a               libload_qos_controller-1.0.1.so
libboost_date_time.so          libboost_system.so              libload_qos_controller.la
libboost_date_time.so.1.67.0   libboost_system.so.1.67.0           libload_qos_controller.so
libboost_filesystem.a          libboost_test_exec_monitor.a        liblogrotate_container_logger-1.0.1.so
libboost_filesystem.so         libboost_thread.a               liblogrotate_container_logger.la
libboost_filesystem.so.1.67.0  libboost_thread.so              liblogrotate_container_logger.so
libboost_graph.a           libboost_thread.so.1.67.0           libmesos-1.0.1.so
libboost_graph.so          libboost_timer.a                libmesos.la
libboost_graph.so.1.67.0       libboost_timer.so               libmesos.so
libboost_log.a             libboost_timer.so.1.67.0            mesos
libboost_log.so            libboost_unit_test_framework.a          mesos-modules
libboost_log.so.1.67.0         libboost_unit_test_framework.so         pkgconfig
libboost_log_setup.a           libboost_unit_test_framework.so.1.67.0  python2.7
libboost_log_setup.so          libfixed_resource_estimator-1.0.1.so    python3.4
libboost_log_setup.so.1.67.0   libfixed_resource_estimator.la          python3.5
libboost_prg_exec_monitor.a    libfixed_resource_estimator.so
libboost_prg_exec_monitor.so   libflann.so

Why can't CMake find the libraries?

Matthew Hoggan
  • 7,402
  • 16
  • 75
  • 140
  • Judging from your directory layout, it should work out of the box. Try removing `set(BOOST*)` lines, cleaning the cache and running cmake again. – arrowd Jan 01 '19 at 21:06

1 Answers1

1

Your CMake version (3.5 I guessed from the command line) is too old for Boost 1.67. Boost changed its naming scheme starting with version 1.66.0 so a set(Boost_ADDITIONAL_VERSIONS 1.67 1.67.0) will not work. See this answer for further details. Either upgrade your CMake version or lower your Boost version requirements (if possible).

vre
  • 6,041
  • 1
  • 25
  • 39