我正在尝试在 Windows 7 x64 上从 libpython27.a 构建 64 位版本的 python27.dll

在这些 instructions 之后,我尝试了:

E:\temp>gendef python27.dll
 * [python27.dll] Found PE+ image

E:\temp>dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libpython27.a --i
nput-def python27.def
dlltool: Can't create .lib file: libpython27.a: Invalid bfd target

什么可以解释 dlltool: Can't create .lib file: libpython27.a: Invalid bfd target

dll工具版本:
E:\temp>dlltool -V
GNU dlltool (GNU Binutils) 2.23.2
Copyright 2012 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.

最佳答案

我正是有这个问题。我的 MinGw 是用 architecture = i686 安装的。这是默认选择,我在安装过程中忘记更改它。

通过使用以下标志安装 MinGw 解决了该问题: architecture = x86_64, threads = posix, exception = sehMinGw\bin 的 Path 必须添加到 Windows 的 Path 环境变量中。

关于python - dlltool:无法创建 .lib 文件:libpython27.a:无效的 bfd 目标,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33686922/

10-12 20:59