could not find the following boost libraries

3.3k views Asked by At

I am not able to figure out why am I getting this error.

CMake Error at C:/Program Files/CMake/share/cmake-3.6/Modules/FindBoost.cmake:1753 (message):
Unable to find the requested Boost libraries.

Boost version: 1.48.0

Boost include path: D:/Shark/boost_1_48_0

Could not find the following Boost libraries:

      boost_system
      boost_date_time
      boost_filesystem
      boost_program_options
      boost_serialization
      boost_thread
      boost_unit_test_framework

 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:146 (find_package)


 CMake Error at CMakeLists.txt:154 (message):
 Please make sure Boost 1.48.0 is installed on your system

It says, Unable to find requested boost library. But I have installed boost 1.48.0 and build it using Visual studio console, and have passed BOOST_LIBRARYDIR=D:/Shark/boost_1_48_0/stage/lib and BOOST_ROOT=D:/Shark/boost_1_48_0.

2

There are 2 answers

2
Benjamin Close On

CMake's FindBoost macros look for the libs in various spots based on the compiler your using. Even if you specify BOOST_LIBRARYDIR, you still have to conform to the standards the FindBoost macro expects for filenames ie:

${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
${Boost_LIB_PREFIX}boost_${COMPONENT} )

Example filenames matching this template for visual studio 2013 (aka msvc 12)

$BOOST_LIBRARY_DIR/boost_atomic-vc120-mt-1_58.dll
$BOOST_LIBRARY_DIR/boost_atomic-vc120-mt-gd-1_58.dll

You'll note that the mt for multithreaded build and the gd to indicate it's a debug build. FindBoost is fussy and will look for the debug build if your CMake project has a CMAKE_BUILD_TYPE=Debug

Additionally if your building multithreaded you'll need to define:

Boost_USE_MULTITHREADED=ON

If your still having trouble you define: Boost_DEBUG=1 and you'll see a lot of additional output about how and where FindBoost is searching.

0
Gopi Shankar On

I was building the boost library by downloading source file. The problem was it was not creating .dll (only .lib).

I downloaded boost binary and installed it from installer to get those files, and set the path BOOL_LIBRARYDIR=C:/local/boost/lib64-msvc-14.0 and BOOL_ROOT=C:/local/boost to make it done.