首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CMake找不到boost库(CGAL,Windows)

CMake找不到boost库(CGAL,Windows)
EN

Stack Overflow用户
提问于 2015-05-06 22:48:01
回答 1查看 2.4K关注 0票数 1

我在这个问题上看到了几十个相同的问题。恐怕他们的回答对我都没有用。

我在尝试安装CGAL。我正在跟踪描述这个过程的以下教程。唯一的区别是,我使用的是CodeBlocks,我选择了“指定本机编译器”,并将它们指向mingw32-gcc.exemingw32-g++.exe,这似乎很好。当我运行cmake,然后单击配置时,我将得到以下输出,并勾选Advanced选项:

代码语言:javascript
复制
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!

我确实设置了BOOST_ROOT到CMake的GUI中的路径,到e:/Users/Bombax/Cpp/Libraries/boost_1_58_0,这是存在的。其中提到的两个库是绝对安装的。我注意到在我的boost安装中没有明确的包含文件夹(尽管它们是lib)。我试过检查CGAL_Boost_USE_STATIC_LIBS选项,但没有更好的结果。这里发生了什么事?我该怎么办?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-05-07 01:19:24

好吧,我终于得到了我所需要的一切。下面是关于如何在Windows 7上使用代码::块获取神奇的libCGAL.dll和libCGAL.a (库文件)的描述。

  1. 我下载并安装了CMake。
  2. 我下载并安装了Boost 1.58.0,附带了手册和GMP (但不包括示例,因为我不想在Qt上乱搞)。目标是一个没有空格的文件夹。
  3. 我下载并安装了CGAL-4.6。同样,目的地是没有空格的文件夹。
  4. 我在我的PATH环境变量中添加了CodeBlock\明威\bin。
  5. 我进入boost_1_58_0文件夹,打开一个命令提示符,然后输入bootstrap gcc,然后是b2 --toolset=gcc,一切都很好。这似乎将Boost构建到了stage\lib文件夹中。
  6. 我做了一个新的代码::块项目来测试Boost文件。在项目构建选项中,我选择了根目录,在Linker下添加了到libboost_regex-mgw44-mt-1_58.a的直接路径,在我在编译器boost_1_58_0文件夹下添加的搜索目录下,在Linkertheboost_1_58_0\stage\lib文件夹下。然后,我成功地编译并运行了示例regex程序这里 (第6节)。
  7. 我进入CGAL-4.6文件夹并打开一个命令提示符。我输入了cmake。我遵循本教程的做法,但我(认为)选择了“指定本机编译器”,并将它们指向MingW文件夹中的mingw32-gcc.exemingw32-g++.exe (如果您在路径中添加了明威\bin,那么它可能会与第一个选项一起工作,无论如何,以后也是如此)。
  8. 正确配置和构建后,会创建代码::块项目文件以及Makefile。代码::块文件毫无用处,无法正确构建,因为它试图运行make.exe而不是mingw32-make.exe。我不知道如何解决这个问题,所以我只需转到代码::块文件夹,打开一个命令提示符并输入mingw32-make.exe -s -f <path-to-the-makefile> all。它没有问题。
  9. 最后,我做了一个测试项目。和第6步一样,我添加了Boost中的所有非调试库(bla-blah-no-D.A在stage/lib中)和来自CGAL-4.6\lib的libCGAL.dll.a库。我还添加了第6步中的Boost目录,以及CGAL-4.6\include目录。
  10. 最后,我编译了示例这里,没有问题。在运行之前。我不得不将CGAL-4.6\bin\libCGAL.dll移到exe文件文件夹中,即bin\Debug。

这很简单,不是吗?!

如果其他人被困在这上面,抛出一条消息,我可以向您发送每个人想要的实际文件: libCGAL.dll、libCGAL.dll.a、所有Boost库文件和所有头文件。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30089004

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档