我在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项目,但我从未成功使用它,因为无论我如何移动和重命名make.exe
,它似乎永远无法找到mingw32-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中还需要另一个选项还是......?
答案 0 :(得分:0)
我找到了解决方案。显然windres.exe
也在64位模式下运行,或者我需要在配置CMake之前添加一些标志。具体来说,CMAKE_RC_FLAGS
我需要为我的Windows 7系统添加--output-format=coff --target=pe-i386
。