dlltool:无法创建.lib文件:libpython27.a:无效的bfd目标

时间:2015-11-13 06:13:41

标签: python windows static-libraries dlltool

我试图在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

dlltool版本:

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.

1 个答案:

答案 0 :(得分:2)

我确实遇到了这个问题。我的MinGw安装了architecture = i686。这是默认选择,我忘了在安装过程中更改它。

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