【发布时间】:2015-08-25 16:18:31
【问题描述】:
我使用的是 Windows 7。我在我的系统上安装了 32 位 CGAL 4.6.2 和 Boost。我还成功构建了 Boost 并测试了它的工作原理(简单的正则表达式程序)。
现在我正在尝试按照this tutorial 的指示使用 CMake 构建 CGAL。我唯一要添加到该教程中的是,我在所有标志中引入了-m32 标志;静态链接器、动态链接器、exe 链接器、c 和 c++ 编译器。配置然后生成就好了,我得到了 CMake 输出:
== Setting paths ==
Build CGAL from release in directory CGAL-4.6.2-x86
Packagenames: CGAL-4.6.2-x86
== Setting paths (DONE) ==
== Generate version files ==
CGAL_MAJOR_VERSION=4
CGAL_MINOR_VERSION=6
CGAL_BUGFIX_VERSION=2
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/x86_64-w64-mingw32-g++.exe compiler.
USING CMake version: 2.8.8
System: Windows
USING GCC_VERSION = '5.1.0'
Using gcc version 4 or later. Adding -frounding-math
== Generate version files (DONE) ==
== Set up flags ==
Build type: Release
USING CXXFLAGS = ' -frounding-math -m32 -O3 -DNDEBUG -m32'
USING LDFLAGS = '-m32 -m32'
== 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 ...
GMP has been preconfigured:
UseGMP-file:
GMP include: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6.2-x86/auxiliary/gmp/include
GMP libraries: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6.2-x86/auxiliary/gmp/lib/libgmp-10.dll
GMP definitions:
USING GMP_VERSION = '5.0.1'
Preconfiguring library: MPFR ...
MPFR has been preconfigured:
UseMPFR-file:
MPFR include: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6.2-x86/auxiliary/gmp/include
MPFR libraries: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6.2-x86/auxiliary/gmp/lib/libmpfr-4.dll
MPFR definitions:
USING MPFR_VERSION = '3.0.0'
Boost version: 1.59.0
Found the following Boost libraries:
thread
system
Boost include: e:/Users/Bombax/Cpp/Libraries/boost_1_59_0-x86
Boost libraries: optimized;e:/Users/Bombax/Cpp/Libraries/boost_1_59_0-x86/stage/lib/libboost_thread-mgw51-mt-1_59.a;debug;e:/Users/Bombax/Cpp/Libraries/boost_1_59_0-x86/stage/lib/libboost_thread-mgw51-mt-d-1_59.a;optimized;e:/Users/Bombax/Cpp/Libraries/boost_1_59_0-x86/stage/lib/libboost_system-mgw51-mt-1_59.a;debug;e:/Users/Bombax/Cpp/Libraries/boost_1_59_0-x86/stage/lib/libboost_system-mgw51-mt-d-1_59.a
Boost definitions:
USING BOOST_VERSION = '1.59.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 'CGAL_Core' detected
Configuring libCGAL_Core
Requested component: MPFR
Requested component: GMP
libCGAL_Core is configured
Sources for CGAL component library 'CGAL_ImageIO' detected
Sources for CGAL component library 'CGAL_Qt3' detected
Sources for CGAL component library 'CGAL_Qt4' detected
Sources for CGAL component libraries 'CGAL_Core;CGAL_ImageIO;CGAL_Qt3;CGAL_Qt4' detected
== Generating build files (DONE) ==
Configuring done
Generating done
CMake 为我生成了一个 CodeBlocks 项目,但我从未使用它成功构建,因为无论我如何移动和重命名 mingw32-make.exe,它似乎永远无法找到 make.exe。无论如何,在过去,我可以手动构建 CGAL,我只需将 mingw32-make.exe 复制到我的 CGAL 文件夹中,然后从命令行运行该文件夹:
mingw32-make.exe -s -f Makefile all
但是我得到了这个输出!
Scanning dependencies of target CGAL
[ 25%] Building CXX object src/CGAL/CMakeFiles/CGAL.dir/all_files.cpp.obj
[ 50%] Building RC object src/CGAL/CMakeFiles/CGAL.dir/CGAL_verinfo.rc.obj
Linking CXX shared library ..\..\bin\libCGAL.dll
E:/PROGRA~3/CODEBL~1/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../
86_64-w64-mingw32/bin/ld.exe: i386:x86-64 architecture of input file `CMakeFile
\CGAL.dir/objects.a(CGAL_verinfo.rc.obj)' is incompatible with i386 output
collect2.exe: error: ld returned 1 exit status
src\CGAL\CMakeFiles\CGAL.dir\build.make:107: recipe for target 'bin/libCGAL.dll
failed
mingw32-make.exe[2]: *** [bin/libCGAL.dll] Error 1
CMakeFiles\Makefile2:185: recipe for target 'src/CGAL/CMakeFiles/CGAL.dir/all'
ailed
mingw32-make.exe[1]: *** [src/CGAL/CMakeFiles/CGAL.dir/all] Error 2
Makefile:112: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2
我以为我已正确完成所有操作,以便 CMake 生成 32 位二进制文件而不是 64 位二进制文件,但错误提示生成的二进制文件是 64 位?我该如何解决这个问题,我需要 CMake 中的其他选项还是...?
【问题讨论】:
-
将 -m32 添加到 CXX 而不是大量 *_FLAGS 变量不是更快吗?还是cmake无法处理?
-
可能是,哈哈,但我想绝对确定这不是问题。
标签: c++ boost cmake makefile cgal