34

我正在尝试安装 CGAL。他们在这里描述他们的安装过程非常简单,第 6.1 节。当我运行cmake-gui然后单击configure时,我得到以下输出:

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)

但我确实BOOST_ROOT在 CMake 的 GUI 中设置了D:/program files/boost_1_51存在的 。它提到的两个库肯定是安装的。这里发生了什么?我需要做什么?

附上运行时的输出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:
--   MPFR include:      D:/program files/CGAL-4.1/auxiliary/gmp/include
--   MPFR libraries:    D:/program files/CGAL-4.1/auxiliary/gmp/lib/libmpfr-4.li
b
--   MPFR definitions:
-- USING MPFR_VERSION = '3.0.0'
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:566 ] _b
oost_TEST_VERSIONS = 1.56.1;1.56.0;1.56;1.55.1;1.55.0;1.55;1.54.1;1.54.0;1.54;1.
53.1;1.53.0;1.53;1.52.1;1.52.0;1.52;1.51.1;1.51.0;1.51;1.50.1;1.50.0;1.50;1.49.1
;1.49.0;1.49;1.48.1;1.48.0;1.48;1.47.1;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.1;1.4
5.0;1.45;1.44.1;1.44.0;1.44;1.43.1;1.43.0;1.43;1.42.1;1.42.0;1.42;1.41.1;1.41.0;
1.41;1.40.1;1.40.0;1.40;1.39.1;1.39.0;1.39;1.38.1;1.38.0;1.38;1.37.1;1.37.0;1.37
;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;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37
.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:568 ] Bo
ost_USE_MULTITHREADED = TRUE
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:570 ] Bo
ost_USE_STATIC_LIBS = OFF
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:572 ] Bo
ost_USE_STATIC_RUNTIME =
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:574 ] Bo
ost_ADDITIONAL_VERSIONS = 1.56.1;1.56.0;1.56;1.55.1;1.55.0;1.55;1.54.1;1.54.0;1.
54;1.53.1;1.53.0;1.53;1.52.1;1.52.0;1.52;1.51.1;1.51.0;1.51;1.50.1;1.50.0;1.50;1
.49.1;1.49.0;1.49;1.48.1;1.48.0;1.48;1.47.1;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.
1;1.45.0;1.45;1.44.1;1.44.0;1.44;1.43.1;1.43.0;1.43;1.42.1;1.42.0;1.42;1.41.1;1.
41.0;1.41;1.40.1;1.40.0;1.40;1.39.1;1.39.0;1.39;1.38.1;1.38.0;1.38;1.37.1;1.37.0
;1.37
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:576 ] Bo
ost_NO_SYSTEM_PATHS =
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:644 ] De
clared as CMake or Environmental Variables:
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:646 ]
BOOST_ROOT = D:/program files/boost_1_51/bin
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:648 ]
BOOST_INCLUDEDIR =
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:650 ]
BOOST_LIBRARYDIR =
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:652 ] _b
oost_TEST_VERSIONS = 1.56.1;1.56.0;1.56;1.55.1;1.55.0;1.55;1.54.1;1.54.0;1.54;1.
53.1;1.53.0;1.53;1.52.1;1.52.0;1.52;1.51.1;1.51.0;1.51;1.50.1;1.50.0;1.50;1.49.1
;1.49.0;1.49;1.48.1;1.48.0;1.48;1.47.1;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.1;1.4
5.0;1.45;1.44.1;1.44.0;1.44;1.43.1;1.43.0;1.43;1.42.1;1.42.0;1.42;1.41.1;1.41.0;
1.41;1.40.1;1.40.0;1.40;1.39.1;1.39.0;1.39;1.38.1;1.38.0;1.38;1.37.1;1.37.0;1.37
;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;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37
.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:734 ] lo
cation of version.hpp: D:/program files/boost_1_51/boost/version.hpp
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:754 ] ve
rsion.hpp reveals boost 1.51.0
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:786 ] gu
essed _boost_COMPILER = -vc100
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:796 ] _b
oost_MULTITHREADED = -mt
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:839 ] _b
oost_RELEASE_ABI_TAG = -
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:841 ] _b
oost_DEBUG_ABI_TAG = -gd
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:884 ] _b
oost_LIBRARY_SEARCH_DIRS = 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:\Progr
am Files (x86)/boost/boost_1_51_0/lib;C:\Program Files (x86)/boost/boost_1_51/li
b;C:\Program Files (x86)/boost/lib;C:\Program Files (x86)/boost;/sw/local/lib
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:962 ] Se
arching for THREAD_LIBRARY_RELEASE: boost_thread-vc100-mt-1_51;boost_thread-vc10
0-mt;boost_thread-mt-1_51;boost_thread-mt;boost_thread
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:994 ] Se
arching for THREAD_LIBRARY_DEBUG: boost_thread-vc100-mt-gd-1_51;boost_thread-vc1
00-mt-gd;boost_thread-mt-gd-1_51;boost_thread-mt-gd;boost_thread-mt;boost_thread

-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:962 ] Se
arching for SYSTEM_LIBRARY_RELEASE: boost_system-vc100-mt-1_51;boost_system-vc10
0-mt;boost_system-mt-1_51;boost_system-mt;boost_system
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:994 ] Se
arching for SYSTEM_LIBRARY_DEBUG: boost_system-vc100-mt-gd-1_51;boost_system-vc1
00-mt-gd;boost_system-mt-gd-1_51;boost_system-mt-gd;boost_system-mt;boost_system

-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1108 ] B
oost_FOUND = FALSE
CMake Error at D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmak
e: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)


-- Boost include:     D:/program files/boost_1_51
-- Boost libraries:
-- Boost definitions:
-- USING BOOST_VERSION = '1.51.0'
== Detect external libraries (DONE) ==

== Write compiler_config.h ==
== Write compiler_config.h (DONE) ==

== Generating build files ==
Configuring libCGAL
-- Requested component: MPFR
-- Requested component: GMP
libCGAL is configured
-- Sources for CGAL component library 'Core' detected
Configuring libCGAL_Core
-- Requested component: MPFR
-- Requested component: GMP
libCGAL_Core is configured
-- Sources for CGAL component library 'ImageIO' detected
Configuring libCGAL_ImageIO
-- Could NOT find ZLIB (missing:  ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- OpenGL include:
-- OpenGL libraries:   glu32;opengl32
-- Requested component: MPFR
-- Requested component: GMP
libCGAL_ImageIO is configured
-- NOTICE: CGAL_ImageIO needs ZLib to read compressed files. That feature will n
ot be activated.
-- Sources for CGAL component library 'Qt3' detected
Configuring libCGAL_Qt3
-- CGAL_Qt3 needs Qt3, cannot be configured.
-- Sources for CGAL component library 'Qt4' detected
Configuring libCGAL_Qt4
-- USING OPENGL_VERSION = '1.1'
-- USING QT4_VERSION = '4.8.3'
-- OpenGL include:
-- OpenGL libraries:   glu32;opengl32
-- OpenGL definitions:
-- Qt4 include:        D:/QT/include
-- Qt4 libraries:      optimized;D:/QT/lib/qtmain.lib;debug;D:/QT/lib/qtmaind.li
b;optimized;D:/QT/lib/QtOpenGL4.lib;debug;D:/QT/lib/QtOpenGLd4.lib;optimized;D:/
QT/lib/QtGui4.lib;debug;D:/QT/lib/QtGuid4.lib;optimized;D:/QT/lib/QtCore4.lib;de
bug;D:/QT/lib/QtCored4.lib
-- Qt4 definitions:    -DQT_DLL
-- moc executable:     D:/QT/bin/moc.exe
-- uic executable:     D:/QT/bin/uic.exe
-- Requested component: MPFR
-- Requested component: GMP
libCGAL_Qt4 is configured
-- Sources for CGAL component libraries 'CGAL;Core;ImageIO;Qt3;Qt4' detected
== Generating build files (DONE) ==

-- Configuring incomplete, errors occurred!

(我看到至少三个与这个问题同名的问题。他们每个人都有不同的答案,适用于 OP,但不适用于我,所以很抱歉重复这个问题......)

4

5 回答 5

25

您的输出显示 CMake 正在以下位置搜索库:

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

它还表明它期望以某种方式命名库。比如Boost.Thread的发布版本:

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

如果您的 Boost 库确实存在于搜索到的位置之一,那么问题可能出在库的名称上。您可以通过设置与FindBoost 模块相关的适当 CMake 变量来调整 Boost 库的预期名称。

例如,如果您使用 bjam 构建 Boost,link=static threading=multi然后在您的 CMakeLists.txt 中find_package(Boost ...)使用

set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)

或调用 CMake 与-DBoost_USE_STATIC_LIBS=ON -DBoost_USE_MULTITHREADED=ON.

正如@noam 在下面的评论中指出的那样,在这种特殊情况下,CGAL 似乎需要 Boost 库的共享(DLL)版本;在命令行上传递-DBoost_USE_STATIC_LIBS=ON没有任何效果。

于 2012-11-08T01:58:57.570 回答
9

我有这个错误,但我已经进步了。

我使用的是 CMake GUI,勾选了“高级”复选框(在“分组”复选框和“添加条目”按钮之间),并勾选了新看到的复选框“CGAL_Boost_USE_STATIC_LIBS”。

在显示额外选项之前,您可能需要再按一两次“配置”。

于 2013-02-19T21:54:43.817 回答
2

今天我尝试在 Windows 上使用 Boost 1.57 x64 安装 CGAL 并遇到了同样的问题。我通过预构建二进制文件安装了 Boost,CMake 搜索的 .lib 文件位于该lib64-msvc-12.0文件夹中。

因此,添加BOOST_LIBRARYDIR=.../boost_1_57_0/lib64-msvc-12.0到 CMake 选项是我的解决方案。

于 2014-11-30T21:39:57.623 回答
1

您的系统(通过 CMake)无法找到 Boost 编译的静态库(.a 文件)。因此,请尝试在系统中存在 .a 文件的 CMake 文件中包含路径。例如,

set(BOOST_LIBRARYDIR {Path_here_to_boost_Static_libraries}).

这对我有用。

于 2018-03-28T13:46:09.813 回答
-1
  1. CGAL 使用共享的 Boost 库。因此,像“libboost_thread-vc100-mt-p-1_49.lib”这样的库是静态链接库。

  2. 这是因为 CMake(我使用的是 v2.8.9)无法正确读取 Boost 库的名称。当我将库名称 boost_thread-vc100-mt-p-1_49.dllboost_thread-vc100-mt-p-1_49.lib 分别更改boost_thread-vc100-mt-1_49.dllboost_thread-vc100-mt-1_49时,它解决了这个问题。

于 2013-02-27T07:29:03.690 回答