[Distutils] mingw32 exe problem

pkienzle pkienzle at gmail.com
Mon Oct 1 05:19:12 CEST 2007

Summary: cannot create windows exe files with distutils and mingw gcc-4.2. 
The fix is to remove the def_file from the list of objects in the link line.

When building my own version of py2exe with --compiler=mingw32, I was able
to compile (with some hacking of the py2exe source) but could not create
usable windows binaries.   The error I got when trying to run them is,
"myapp.exe is not a valid Win32 application".

Laboriously tracing code and modifying the link line by hand, I found I
could build usable EXEs if I eliminated the following line from


The def file itself contains:

  LIBRARY run.exe

I'm using the technology preview gcc-4.2.1-dw2 prerelease from the mingw
download site.  I don't know if the def file is required on the current
release gcc-3.4.5.

Let me know if this is considered a bug in distutils, or if I need to post
this message to the mingw list.

Thanks in advance

  - Paul

View this message in context: http://www.nabble.com/mingw32-exe-problem-tf4546042.html#a12972801
Sent from the Python - distutils-sig mailing list archive at Nabble.com.

More information about the Distutils-SIG mailing list