簡體   English   中英

使用CMake構建32位CGAL:即使指定了32位,還是生成64位二進制文​​件?

[英]Building 32-bit CGAL with CMake: makes 64-bit binaries even though 32-bit specified?

我在Windows 7上。我在系統上安裝了32位CGAL 4.6.2和Boost。 我還成功構建了Boost並測試了它的工作原理(簡單的regex程序)。

現在,我正在按照本教程的說明嘗試使用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的生成代碼塊項目對我來說,但我從來沒有成功地使用了它內置了,因為它似乎永遠能夠找到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中使用另一個選項還是...?

我找到了解決方案。 顯然, windres.exe可以在64位模式下運行,因此我需要在配置CMake之前添加一些標志。 具體來說,我需要為Windows 7系統的CMAKE_RC_FLAGS添加--output-format=coff --target=pe-i386

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM