http://stackoverflow.com/questions/13280823/cmake-not-finding-boost

 

 

 

 

I saw at least 3 questions with the same title as this question. Each of them had a different answer that worked for the OP but not for me, so I am sorry to repeat the question...

I am trying to install CGAL. They describe their installation process as ever-so-simple here, section 6.1. When I run cmake-gui and then click configure, I get the following output

CMake Error at D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1192 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.51.0

  Boost include path: D:/program files/boost_1_51

  The following Boost libraries could not be found:

          boost_thread
          boost_system

  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):
  cmake/modules/CGAL_SetupBoost.cmake:6 (find_package)
  cmake/modules/CGAL_SetupDependencies.cmake:85 (include)
  CMakeLists.txt:590 (include)

But I DID set up BOOST_ROOT, in cmake's gui, to D:/program files/boost_1_51, which exists. And the two libraries it mentions are definitely installed. What is happening here? What do I need to do?

EDIT: Attached is the output when running cmake -DBoost_DEBUG=ON

D:\program files\CGAL-4.1>cmake -DBoost_DEBUG=ON
== Setting paths ==
-- Build CGAL from release in directory CGAL-4.1
-- Packagenames: CGAL-4.1
== Setting paths (DONE) ==

== Generate version files ==
-- CGAL_MAJOR_VERSION=4
-- CGAL_MINOR_VERSION=1
-- CGAL_BUGFIX_VERSION=0
-- CGAL_SONAME_VERSION=10
-- CGAL_SOVERSION     =10.0.0
-- CGAL_REFERENCE_CACHE_DIR=
-- Building shared libraries
-- Targetting Visual Studio 10 Win64
-- Target build enviroment supports auto-linking
-- Using VC10 compiler.
-- Generator uses intermediate configuration directory: $(Configuration)
-- USING CMake version: 2.8.10
-- System: Windows
== Generate version files (DONE) ==

== Set up flags ==
-- Build type: Release
-- USING CXXFLAGS = ' /DWIN32 /D_WINDOWS /W3 /Zm1000 /GR /EHsc -D_CRT_SECURE_NO_
DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_
WARNINGS /fp:strict /fp:except- /MD /O2 /Ob2 /D NDEBUG'
-- USING LDFLAGS = ' /STACK:10000000 /machine:x64  /INCREMENTAL:NO'
== Set up flags (DONE) ==

== Detect external libraries ==
-- External libraries supported: GMP;MPFR;ZLIB;OpenGL;LEDA;MPFI;RS;RS3;OpenNL;TA
UCS;Eigen3;BLAS;LAPACK;QGLViewer;ESBTL;Coin3D;NTL;IPE
-- Preconfiguring library: GMP ...
-- GMP has been preconfigured:
--   CGAL_UseGMP-file:
--   GMP include:      D:/program files/CGAL-4.1/auxiliary/gmp/include
--   GMP libraries:    D:/program files/CGAL-4.1/auxiliary/gmp/lib/libgmp-10.lib

--   GMP definitions:
-- USING GMP_VERSION = '5.0.1'
-- Preconfiguring library: MPFR ...
-- MPFR has been preconfigured:
--   CGAL_UseMPFR-file:

---------------------------------

 

 

 

 

Your output shows that CMake is searching for the libraries in the following places:

D:/program files/boost_1_51/bin/lib
D:/program files/boost_1_51/bin/stage/lib
D:/program files/boost_1_51/lib
D:/program files/boost_1_51/../lib
D:/program files/boost_1_51/stage/lib
C:/boost/lib
C:/boost
C:\Program Files (x86)/boost/boost_1_51_0/lib
C:\Program Files (x86)/boost/boost_1_51/lib
C:\Program Files (x86)/boost/lib
C:\Program Files (x86)/boost
/sw/local/lib

It also shows that it's expecting the libraries to be named in a certain way. For example, the release version of Boost.Thread:

boost_thread-vc100-mt-1_51
boost_thread-vc100-mt
boost_thread-mt-1_51
boost_thread-mt
boost_thread

If your boost libraries do exist in one of the searched locations, then it's probably the name of the library that's the problem. You can adjust the expected name of the boost libs by setting the appropriate CMake variables relevant to the FindBoost module

For example, if you built boost using bjam with link=static threading=multi then in your CMakeLists.txt before find_package(Boost ...) you'll want to do

set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)

or invoke cmake with -DBoost_USE_STATIC_LIBS=ON -DBoost_USE_MULTITHREADED=ON

Edit

As @noam has pointed out in the comments below, in this particular case, it appears that CGAL requires the shared (dll) versions of the boost libs; passing -DBoost_USE_STATIC_LIBS=ON on the command line has no effect.

shareimprove this answer
    
I am using a university computer which already has boost on it. How can I know how did they compile boost (I really have no one to ask :) ) – olamundo Nov 8 '12 at 3:22
    
@noam It can usually be deduced from the libraries' names. What is the full name and path of say the debug and release versions of Boost.Thread there? – Fraser Nov 8 '12 at 3:36
    
I hope I understand you correctly: libboost_thread-vc100-mt-gd-1_51.lib and libboost_thread-vc100-mt-1_51.lib – olamundo Nov 8 '12 at 3:40
    
@noam OK - the libraries are static (you can tell because they begin with "lib" - see Boost's getting started guide) so you need Boost_USE_STATIC_LIBS set to ON. In your output above, you can see that you currently have this value set to OFF. Once you do that, assuming the libs are actually in one of the search paths listed in my answer, it should all work. – Fraser Nov 8 '12 at 3:52
    
Nope, it doesn't work. The libs are in D:\program files\boost_1_51\lib, but it still outputs the same error, when running cmake -DBoost_USE_STATIC_LIBS=ON. (Thank you for your patience, by the way) – olamundo Nov 8 '12 at 4:10

I had this error but have progressed.

I was using the cmake-gui, then I ticked the checkbox "Advanced" (between checkbox "Grouped" and button "Add Entry"), then I ticked the newly seen checkbox "CGAL_Boost_USE_STATIC_LIBS".

You may need to press "Configure" an extra time or two before the extra options are revealed.

shareimprove this answer

Today I tried installing CGAL with Boost 1.57 x64 on Windows and encountered the same problem. I installed boost via pre-build binaries and the .lib files that CMake searches for are in the lib64-msvc-12.0 folder. Therefore adding BOOST_LIBRARYDIR=.../boost_1_57_0/lib64-msvc-12.0 to CMake options was the solution for me.

shareimprove this answer
    
Thanks, same here with boost 1.60 x64 binary install on Windows 7 and CGAL 1.47. I addedBOOST_LIBRARYDIR=C:\boost\lib64-msvc-14.0 in my case. – Paul Jurczak Jan 3 at 7:06 
  1. CGAL use the shared boost libraries. So, the libraries like "libboost_thread-vc100-mt-p-1_49.lib" is a statically linked library.

  2. It's because cmake(I used v2.8.9) can not read the name of boost libraries correctly. When I changed the library names boost_thread-vc100-mt-p-1_49.dll and boost_thread-vc100-mt-p-1_49.lib to boost_thread-vc100-mt-1_49.dll and boost_thread-vc100-mt-1_49, respectively, it fixed the problem.

shareimprove this answer
1  
For reference: Do NOT do this. The naming reflects how boost was compiled. So you need to set the correct options for the Find module or you will end up with problems of any kind (using debug versions for release, multi-threaded for single-threaded etc) – Flamefire Jan 11 at 9:54

'C,C++ > Other Library' 카테고리의 다른 글

[boost] boost build하기  (0) 2016.09.21
[boost] CMake is not able to find BOOST libraries  (0) 2016.09.20
Posted by uniqueone
,