编译boost时地址模型错误

2024-05-23 22:07:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我编写了一个混合Python 3和C++的程序。我正在Windows上使用BoostPython 1.62和mingw。我已经编译了很多很多机器上的C++ Python LIBs,它一直都很好用。现在我把源代码交给一位同事安装在他的机器上,而mingw抱怨符号和“文件格式无法识别”的问题导致编译失败

不过,我看到的是:在我的机器上,b2在编译开始时报告了这一点:

  • 32位:否(缓存)
  • 64位:是(缓存)
  • arm:否(缓存)
  • mips1:否(缓存)
  • 电源:否(缓存)
  • sparc:否(缓存)
  • x86:是(缓存)
  • 支持的符号链接:是

在我同事的机器上,它看起来像这样:

  • 32位:是(缓存)
  • arm:否(缓存)
  • mips1:否(缓存)
  • 电源:否(缓存)
  • sparc:否(缓存)
  • x86:是(缓存)
  • 支持的符号链接:是

我很确定这些问题与他的系统试图编译32位代码并试图将现有的64位代码链接到它有关。问题是,为什么它首先要编译32位代码?这台机器使用不到一年,所以它肯定是64位的。然而,更重要的问题是,如何说服机器使用64位进行编译

顺便说一下,这是我的user-config.jam:

using python : 3.6 : C:\\StreamTest\\WinPython-64bit-3.6.6.2\\python-3.6.6.amd64\\python.exe
  : C:\\StreamTest\\WinPython-64bit-3.6.6.2\\python-3.6.6.amd64\\include
  : C:\\StreamTest\\WinPython-64bit-3.6.6.2\\python-3.6.6.amd64\\libs
  : ;

Tags: 代码程序机器链接符号x86amd64arm
1条回答
网友
1楼 · 发布于 2024-05-23 22:07:34

您的同事肯定正在编译为32位,您可以添加参数-m64,该参数应强制mingw编译为64位(假设您的同事拥有支持交叉兼容性的版本,即mingw-w64)

我猜你的同事下载了http://www.mingw.org/,但他/她需要:http://mingw-w64.org

来自mingw.org:

"MinGW is a native Windows port of the GNU Compiler Collection (GCC), with freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. Although (currently) offering only a 32-bit compiler suite, all of MinGW's software will execute on the 64bit Windows platforms."

来自mingw-w64.org:

"Mingw-w64 is an advancement of the original mingw.org project, created to support the GCC compiler on Windows systems. It has forked it in 2007 in order to provide support for 64 bits and new APIs. It has since then gained widespread use and distribution. "

相关问题 更多 >