CMake 找不到增强库(CGAL,Windows)
CMake fails to find boost libraries (CGAL, Windows)
关于这个问题,我看到了几十个相同的问题。恐怕 None 他们的回答对我有用。
我正在尝试安装 CGAL。我正在按照 following tutorial 逐步描述该过程。唯一的区别是我使用的是 CodeBlocks,我选择了 "Specify native compilers" 并将它们指向 mingw32-gcc.exe
和 mingw32-g++.exe
,这似乎没问题。当我 运行 cmake-gui 然后单击配置时,我得到以下输出,勾选了高级选项:
The CXX compiler identification is GNU 4.4.1
The C compiler identification is GNU 4.4.1
Check for working CXX compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-g++.exe
Check for working CXX compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-g++.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working C compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-gcc.exe
Check for working C compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-gcc.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
== Setting paths ==
Build CGAL from release in directory CGAL-4.6
Packagenames: CGAL-4.6
== Setting paths (DONE) ==
== Generate version files ==
CGAL_MAJOR_VERSION=4
CGAL_MINOR_VERSION=6
CGAL_BUGFIX_VERSION=0
CGAL_SONAME_VERSION=11
CGAL_SOVERSION =11.0.0
CGAL_REFERENCE_CACHE_DIR=
Building shared libraries
Targetting MinGW Makefiles
Using E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-g++.exe compiler.
USING CMake version: 2.8.8
System: Windows
USING GCC_VERSION = '4.4.1'
Using gcc version 4 or later. Adding -frounding-math
== Generate version files (DONE) ==
== Set up flags ==
Build type: Release
USING CXXFLAGS = ' -frounding-math -O3 -DNDEBUG'
USING LDFLAGS = ' '
== Set up flags (DONE) ==
== Detect external libraries ==
External libraries supported: GMP;MPFR;ZLIB;OpenGL;LEDA;MPFI;RS;RS3;OpenNL;Eigen3;BLAS;LAPACK;QGLViewer;ESBTL;Coin3D;NTL;IPE
Preconfiguring library: GMP ...
Found GMP: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libgmp-10.dll
GMP has been preconfigured:
UseGMP-file:
GMP include: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/include
GMP libraries: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libgmp-10.dll
GMP definitions:
USING GMP_VERSION = '5.0.1'
Preconfiguring library: MPFR ...
Found MPFR: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libmpfr-4.dll
MPFR has been preconfigured:
UseMPFR-file:
MPFR include: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/include
MPFR libraries: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libmpfr-4.dll
MPFR definitions:
USING MPFR_VERSION = '3.0.0'
CMake Error at E:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1200 (message):
Unable to find the requested Boost libraries.
Boost version: 1.58.0
Boost include path: e:/Users/Bombax/Cpp/Libraries/boost_1_58_0
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:640 (include)
Boost include: e:/Users/Bombax/Cpp/Libraries/boost_1_58_0
Boost libraries:
Boost definitions:
USING BOOST_VERSION = '1.58.0'
== Detect external libraries (DONE) ==
== Write compiler_config.h ==
Performing Test CGAL_CFG_BOOST_VARIANT_SWAP_BUG - Failed
Performing Test CGAL_CFG_DENORMALS_COMPILE_BUG - Success
Performing Test CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG - Success
Performing Test CGAL_CFG_IEEE_754_BUG - Success
Performing Test CGAL_CFG_ISTREAM_INT_BUG - Success
Performing Test CGAL_CFG_MATCHING_BUG_5 - Success
Performing Test CGAL_CFG_MATCHING_BUG_6 - Success
Performing Test CGAL_CFG_MATCHING_BUG_7 - Success
Performing Test CGAL_CFG_MATCHING_BUG_8 - Success
Performing Test CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG - Success
Performing Test CGAL_CFG_NO_LIMITS - Success
Performing Test CGAL_CFG_NO_NEXTAFTER - Success
Performing Test CGAL_CFG_NO_STL - Success
Performing Test CGAL_CFG_NO_WARNING_CPP_DIRECTIVE_BUG - Success
Performing Test CGAL_CFG_NUMERIC_LIMITS_BUG - Success
Performing Test CGAL_CFG_OUTOFLINE_MEMBER_DEFINITION_BUG - Success
Performing Test CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG - Success
Performing Test CGAL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG - Success
Performing Test CGAL_CFG_USING_BASE_MEMBER_BUG_2 - Success
== Write compiler_config.h (DONE) ==
== Generating build files ==
Configuring libCGAL
Requested component: MPFR
Requested component: GMP
libCGAL is configured
Sources for CGAL component library 'CGAL_Core' detected
Configuring libCGAL_Core
Requested component: MPFR
Requested component: GMP
libCGAL_Core is configured
Sources for CGAL component library 'CGAL_ImageIO' detected
Configuring libCGAL_ImageIO
Found OpenGL: opengl32
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: libCGAL_ImageIO needs ZLib to read compressed files. That feature will not be activated.
Sources for CGAL component library 'CGAL_Qt3' detected
Configuring libCGAL_Qt3
libCGAL_Qt3 needs Qt3, cannot be configured.
Sources for CGAL component library 'CGAL_Qt4' detected
Configuring libCGAL_Qt4
libCGAL_Qt4 needs Qt4, cannot be configured.
Sources for CGAL component libraries 'CGAL_Core;CGAL_ImageIO;CGAL_Qt3;CGAL_Qt4' detected
== Generating build files (DONE) ==
Configuring incomplete, errors occurred!
我确实在 CMake 的 GUI 中将 BOOST_ROOT
设置为存在的 e:/Users/Bombax/Cpp/Libraries/boost_1_58_0
路径。它提到的两个库肯定已经安装了。我注意到我的 boost 安装中没有明确的 include 文件夹(尽管它们是 libs)。我试过检查 CGAL_Boost_USE_STATIC_LIBS 选项但没有更好的结果。这里发生了什么?我需要做什么?
好吧,我终于把一切都达到了我需要的状态。下面主要是描述如何用Code::Blocks.
在Windows7上得到你想要的神奇libCGAL.dll和libCGAL.a(库文件)
- 我下载并安装了 CMake。
- 我下载并安装了 Boost 1.58.0,其中包括手册和 GMP(但不包括示例,因为我不想在 Qt 上游手好闲)。目的地是一个没有空格的文件夹。
- 我下载并安装了 CGAL-4.6。同样,目标是没有空格的文件夹。
- 我将 CodeBlocks\MingW\bin 添加到我的
PATH
环境变量中。
- 我进入 boost_1_58_0 文件夹,打开命令提示符,输入
bootstrap gcc
,然后输入 b2 --toolset=gcc
,一切正常。这似乎将 Boost 构建到 stage\lib 文件夹中。
- 我创建了一个新的 Code::Blocks 项目来测试 Boost 文件。在项目构建选项中,我选择了根目录,在链接器设置下添加了
libboost_regex-mgw44-mt-1_58.a
的直接路径,在搜索目录下我在编译器下添加了 boost_1_58_0 文件夹,在链接器下添加了 boost_1_58_0\ stage\lib 文件夹。然后我成功编译并 运行 示例正则表达式程序 here(第 6 节)。
- 我进入 CGAL-4.6 文件夹并打开命令提示符。我输入了 cmake-gui。我按照 this tutorial 这封信,除了我(认为)我选择了 "Specify native compilers" 并将它们指向 MingW 文件夹中的
mingw32-gcc.exe
和 mingw32-g++.exe
(它可能适用于第一个选项,如果你已经添加 MingW\bin 到你必须的路径,稍后)
- 正确配置和构建后,创建了一个 Code::Blocks 项目文件以及一个 Makefile。 Code::Blocks 文件没有用并且无法正确构建,因为它试图 运行
make.exe
而不是 mingw32-make.exe
。我不知道如何解决这个问题,所以我只是转到我的 Code::Blocks 文件夹,打开命令提示符并键入 mingw32-make.exe -s -f <path-to-the-makefile> all
。没问题。
- 最后,我做了一个测试项目。就像在第 6 步中一样,我添加了来自 Boost 的所有非调试库(stage/lib 中的 blah-blah-NOT-d.a)和来自 CGAL-4 的 libCGAL.dll.a 库。6\lib。我还添加了步骤 6 中的 Boost 目录和 CGAL-4。6\include 目录。
- 超级好,我编译的例子here没有问题。在 运行 之前。我不得不将 CGAL-4.6\bin\libCGAL.dll 移动到 exe 文件夹中,即 bin\Debug.
现在已经非常简单了,不是吗?!
如果其他人遇到困难,请留言,我可以把每个人都想要的实际文件发给你:libCGAL.dll、libCGAL.dll.a,所有的 Boost 库文件和所有的头文件.
关于这个问题,我看到了几十个相同的问题。恐怕 None 他们的回答对我有用。
我正在尝试安装 CGAL。我正在按照 following tutorial 逐步描述该过程。唯一的区别是我使用的是 CodeBlocks,我选择了 "Specify native compilers" 并将它们指向 mingw32-gcc.exe
和 mingw32-g++.exe
,这似乎没问题。当我 运行 cmake-gui 然后单击配置时,我得到以下输出,勾选了高级选项:
The CXX compiler identification is GNU 4.4.1
The C compiler identification is GNU 4.4.1
Check for working CXX compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-g++.exe
Check for working CXX compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-g++.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working C compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-gcc.exe
Check for working C compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-gcc.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
== Setting paths ==
Build CGAL from release in directory CGAL-4.6
Packagenames: CGAL-4.6
== Setting paths (DONE) ==
== Generate version files ==
CGAL_MAJOR_VERSION=4
CGAL_MINOR_VERSION=6
CGAL_BUGFIX_VERSION=0
CGAL_SONAME_VERSION=11
CGAL_SOVERSION =11.0.0
CGAL_REFERENCE_CACHE_DIR=
Building shared libraries
Targetting MinGW Makefiles
Using E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-g++.exe compiler.
USING CMake version: 2.8.8
System: Windows
USING GCC_VERSION = '4.4.1'
Using gcc version 4 or later. Adding -frounding-math
== Generate version files (DONE) ==
== Set up flags ==
Build type: Release
USING CXXFLAGS = ' -frounding-math -O3 -DNDEBUG'
USING LDFLAGS = ' '
== Set up flags (DONE) ==
== Detect external libraries ==
External libraries supported: GMP;MPFR;ZLIB;OpenGL;LEDA;MPFI;RS;RS3;OpenNL;Eigen3;BLAS;LAPACK;QGLViewer;ESBTL;Coin3D;NTL;IPE
Preconfiguring library: GMP ...
Found GMP: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libgmp-10.dll
GMP has been preconfigured:
UseGMP-file:
GMP include: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/include
GMP libraries: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libgmp-10.dll
GMP definitions:
USING GMP_VERSION = '5.0.1'
Preconfiguring library: MPFR ...
Found MPFR: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libmpfr-4.dll
MPFR has been preconfigured:
UseMPFR-file:
MPFR include: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/include
MPFR libraries: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libmpfr-4.dll
MPFR definitions:
USING MPFR_VERSION = '3.0.0'
CMake Error at E:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1200 (message):
Unable to find the requested Boost libraries.
Boost version: 1.58.0
Boost include path: e:/Users/Bombax/Cpp/Libraries/boost_1_58_0
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:640 (include)
Boost include: e:/Users/Bombax/Cpp/Libraries/boost_1_58_0
Boost libraries:
Boost definitions:
USING BOOST_VERSION = '1.58.0'
== Detect external libraries (DONE) ==
== Write compiler_config.h ==
Performing Test CGAL_CFG_BOOST_VARIANT_SWAP_BUG - Failed
Performing Test CGAL_CFG_DENORMALS_COMPILE_BUG - Success
Performing Test CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG - Success
Performing Test CGAL_CFG_IEEE_754_BUG - Success
Performing Test CGAL_CFG_ISTREAM_INT_BUG - Success
Performing Test CGAL_CFG_MATCHING_BUG_5 - Success
Performing Test CGAL_CFG_MATCHING_BUG_6 - Success
Performing Test CGAL_CFG_MATCHING_BUG_7 - Success
Performing Test CGAL_CFG_MATCHING_BUG_8 - Success
Performing Test CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG - Success
Performing Test CGAL_CFG_NO_LIMITS - Success
Performing Test CGAL_CFG_NO_NEXTAFTER - Success
Performing Test CGAL_CFG_NO_STL - Success
Performing Test CGAL_CFG_NO_WARNING_CPP_DIRECTIVE_BUG - Success
Performing Test CGAL_CFG_NUMERIC_LIMITS_BUG - Success
Performing Test CGAL_CFG_OUTOFLINE_MEMBER_DEFINITION_BUG - Success
Performing Test CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG - Success
Performing Test CGAL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG - Success
Performing Test CGAL_CFG_USING_BASE_MEMBER_BUG_2 - Success
== Write compiler_config.h (DONE) ==
== Generating build files ==
Configuring libCGAL
Requested component: MPFR
Requested component: GMP
libCGAL is configured
Sources for CGAL component library 'CGAL_Core' detected
Configuring libCGAL_Core
Requested component: MPFR
Requested component: GMP
libCGAL_Core is configured
Sources for CGAL component library 'CGAL_ImageIO' detected
Configuring libCGAL_ImageIO
Found OpenGL: opengl32
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: libCGAL_ImageIO needs ZLib to read compressed files. That feature will not be activated.
Sources for CGAL component library 'CGAL_Qt3' detected
Configuring libCGAL_Qt3
libCGAL_Qt3 needs Qt3, cannot be configured.
Sources for CGAL component library 'CGAL_Qt4' detected
Configuring libCGAL_Qt4
libCGAL_Qt4 needs Qt4, cannot be configured.
Sources for CGAL component libraries 'CGAL_Core;CGAL_ImageIO;CGAL_Qt3;CGAL_Qt4' detected
== Generating build files (DONE) ==
Configuring incomplete, errors occurred!
我确实在 CMake 的 GUI 中将 BOOST_ROOT
设置为存在的 e:/Users/Bombax/Cpp/Libraries/boost_1_58_0
路径。它提到的两个库肯定已经安装了。我注意到我的 boost 安装中没有明确的 include 文件夹(尽管它们是 libs)。我试过检查 CGAL_Boost_USE_STATIC_LIBS 选项但没有更好的结果。这里发生了什么?我需要做什么?
好吧,我终于把一切都达到了我需要的状态。下面主要是描述如何用Code::Blocks.
在Windows7上得到你想要的神奇libCGAL.dll和libCGAL.a(库文件)- 我下载并安装了 CMake。
- 我下载并安装了 Boost 1.58.0,其中包括手册和 GMP(但不包括示例,因为我不想在 Qt 上游手好闲)。目的地是一个没有空格的文件夹。
- 我下载并安装了 CGAL-4.6。同样,目标是没有空格的文件夹。
- 我将 CodeBlocks\MingW\bin 添加到我的
PATH
环境变量中。 - 我进入 boost_1_58_0 文件夹,打开命令提示符,输入
bootstrap gcc
,然后输入b2 --toolset=gcc
,一切正常。这似乎将 Boost 构建到 stage\lib 文件夹中。 - 我创建了一个新的 Code::Blocks 项目来测试 Boost 文件。在项目构建选项中,我选择了根目录,在链接器设置下添加了
libboost_regex-mgw44-mt-1_58.a
的直接路径,在搜索目录下我在编译器下添加了 boost_1_58_0 文件夹,在链接器下添加了 boost_1_58_0\ stage\lib 文件夹。然后我成功编译并 运行 示例正则表达式程序 here(第 6 节)。 - 我进入 CGAL-4.6 文件夹并打开命令提示符。我输入了 cmake-gui。我按照 this tutorial 这封信,除了我(认为)我选择了 "Specify native compilers" 并将它们指向 MingW 文件夹中的
mingw32-gcc.exe
和mingw32-g++.exe
(它可能适用于第一个选项,如果你已经添加 MingW\bin 到你必须的路径,稍后) - 正确配置和构建后,创建了一个 Code::Blocks 项目文件以及一个 Makefile。 Code::Blocks 文件没有用并且无法正确构建,因为它试图 运行
make.exe
而不是mingw32-make.exe
。我不知道如何解决这个问题,所以我只是转到我的 Code::Blocks 文件夹,打开命令提示符并键入mingw32-make.exe -s -f <path-to-the-makefile> all
。没问题。 - 最后,我做了一个测试项目。就像在第 6 步中一样,我添加了来自 Boost 的所有非调试库(stage/lib 中的 blah-blah-NOT-d.a)和来自 CGAL-4 的 libCGAL.dll.a 库。6\lib。我还添加了步骤 6 中的 Boost 目录和 CGAL-4。6\include 目录。
- 超级好,我编译的例子here没有问题。在 运行 之前。我不得不将 CGAL-4.6\bin\libCGAL.dll 移动到 exe 文件夹中,即 bin\Debug.
现在已经非常简单了,不是吗?!
如果其他人遇到困难,请留言,我可以把每个人都想要的实际文件发给你:libCGAL.dll、libCGAL.dll.a,所有的 Boost 库文件和所有的头文件.