This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Misleading instructions for building extensions with mingw
Type: Stage:
Components: Documentation, Extension Modules Versions: Python 2.6, 3rd party
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: bdew, georg.brandl, loewis
Priority: normal Keywords:

Created on 2009-06-11 09:58 by bdew, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg89244 - (view) Author: Black Dew (bdew) Date: 2009-06-11 09:58
This page http://docs.python.org/install/index.html#gnu-c-cygwin-mingw 
says: 

"These instructions only apply if you’re using a version of Python 
prior to 2.4.1 with a MinGW prior to 3.0.0 (with binutils-2.13.90-
20030111-1)" 

But it seems that it is still needed for Python 2.6 with MinGW 3.15.2.

Without manually generating libpython26.a I can't compile any python 
extension, geting a bunch of undefined references, for example:

c:\mingw\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.6
\Release\zfec\fec.o build\temp.win32-2.6\Release\zfec\_fecmodule.o 
build\temp.win32-2.6\Release\zfec\_fec.def -LC:\Python26\libs -
LC:\Python26\PCbuild -lpython26 -lmsvcr90 -o build\lib.win32-2.6
\zfec\_fec.pyd
build\temp.win32-2.6\Release\zfec\_fecmodule.o:_fecmodule.c:
(.text+0xefa): undefined reference to `_imp___Py_TrueStruct'
build\temp.win32-2.6\Release\zfec\_fecmodule.o:_fecmodule.c:
(.text+0xf01): undefined reference to `_imp___Py_TrueStruct'
build\temp.win32-2.6\Release\zfec\_fecmodule.o:_fecmodule.c:
(.text+0xf08): undefined reference to `_imp___Py_ZeroStruct'
build\temp.win32-2.6\Release\zfec\_fecmodule.o:_fecmodule.c:
(.text+0xf0f): undefined reference to `_imp___Py_ZeroStruct'
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

If I do generate libpython26.a - everythong works fine.
msg89245 - (view) Author: Black Dew (bdew) Date: 2009-06-11 10:05
It seems this was writen to the docs after a discussion here: 
http://mail.python.org/pipermail/python-dev/2005-October/057717.html

>> As it turns out, MinGW also implemented, in version 3.0.0 (with
>> binutils-2.13.90-20030111-1), features which make the creation of
>> libpython24.a unnecessary

It looks like the current version of mingw sees python26.lib and 
incorrectly uses it.

If i remove python26.lib and place python26.dll instead - mingw uses 
the exports directly from the dll and everything works too (without 
needing libpython26.a).

This should be reflected in the documentation.
msg89261 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-06-11 21:09
What's wrong with using the libpython26.a that is included in the
Windows distribution?

I don't think anecdotal observations should be included in the
documentation; an expert would have to confirm first what the right
procedure is.
msg89263 - (view) Author: Black Dew (bdew) Date: 2009-06-11 22:04
It seems that the system I was testing on had the ActiveState python
distribution installed which does not include libpython26.a

I tried installing the official one from python.org and it has
libpython26.a and works fine.

Sorry about opening the bug at the wrong place :(
History
Date User Action Args
2022-04-11 14:56:50adminsetgithub: 50513
2009-06-11 22:04:53bdewsetstatus: open -> closed

messages: + msg89263
2009-06-11 21:09:33loewissetnosy: + loewis
messages: + msg89261
2009-06-11 10:05:58bdewsetmessages: + msg89245
title: Misleading instructions for installing extensions with mingw -> Misleading instructions for building extensions with mingw
2009-06-11 09:58:22bdewcreate