dlltool: Can't create .lib file: libpython27.a: Invalid bfd target

1k views Asked by At

I'm trying to build a 64-bit version of libpython27.a from python27.dll on Windows 7 x64.

Following these instructions, I tried:

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

What can explain dlltool: Can't create .lib file: libpython27.a: Invalid bfd target?

dlltool version:

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

There are 1 answers

0
nanenaro On

I had exactly this problem. My MinGw was installed with architecture = i686. It was the default selection and I forgot to change it during installation.

The problem was solved by installing MinGw with these flags: architecture = x86_64, threads = posix, exception = seh. The Path to MinGw\bin must be added to Path environment variable of Windows.