468,766 Members | 1,266 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,766 developers. It's quick & easy.

Re: problem compiling extensions with mingw

On Jun 27, 3:10 pm, eliben <eli...@gmail.comwrote:
Hello,
I'm trying to compile the minimal example fromhttp://en.wikibooks.org/wiki/Python_Programming/Extending_with_Cwith
MinGW (latest version) and Python 2.5 (latest ActiveState binary
install). When running the setup file, the following happens:

running build
running build_ext
building 'hello' extension
writing build\temp.win32-2.5\Release\hello.def
d:\mingw\bin\gcc.exe -mno-cygwin -shared -s build
\temp.win32-2.5\Release\hellomo
dule.o build\temp.win32-2.5\Release\hello.def -LC:\Python25\libs -LC:
\Python25\P
Cbuild -lpython25 -lmsvcr71 -o build\lib.win32-2.5\hello.pyd
build\temp.win32-2.5\Release\hellomodule.o:hellomodule.c:(.text+0x3 e):
undefined
reference to `_imp___Py_NoneStruct'
build\temp.win32-2.5\Release\hellomodule.o:hellomodule.c:(.text+0x4 6):
undefined
reference to `_imp___Py_NoneStruct'
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

What's more, compiling the same extension with Visual Studio 2005
(without using distutils) works fine, the extension is loaded and ran
successfully from Python. Any ideas about this error ?

Eli
Problem solved:
http://eli.thegreenplace.net/2008/06...ils-and-mingw/
Jun 28 '08 #1
2 3362
On Jun 28, 3:41 pm, eliben <eli...@gmail.comwrote:
On Jun 27, 3:10 pm, eliben <eli...@gmail.comwrote:
Hello,
I'm trying to compile the minimal example fromhttp://en.wikibooks.org/wiki/Python_Programming/Extending_with_Cwith
MinGW (latest version) and Python 2.5 (latest ActiveState binary
install). When running the setup file, the following happens:
running build
running build_ext
building 'hello' extension
writing build\temp.win32-2.5\Release\hello.def
d:\mingw\bin\gcc.exe -mno-cygwin -shared -s build
\temp.win32-2.5\Release\hellomo
dule.o build\temp.win32-2.5\Release\hello.def -LC:\Python25\libs -LC:
\Python25\P
Cbuild -lpython25 -lmsvcr71 -o build\lib.win32-2.5\hello.pyd
build\temp.win32-2.5\Release\hellomodule.o:hellomodule.c:(.text+0x3 e):
undefined
reference to `_imp___Py_NoneStruct'
build\temp.win32-2.5\Release\hellomodule.o:hellomodule.c:(.text+0x4 6):
undefined
reference to `_imp___Py_NoneStruct'
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
What's more, compiling the same extension with Visual Studio 2005
(without using distutils) works fine, the extension is loaded and ran
successfully from Python. Any ideas about this error ?
Eli

Problem solved:http://eli.thegreenplace.net/2008/06...n-extensions-w...
libpython2?.a is now *supplied* with the official CPython distribution
from www.python.org.

The procedure that you followed is described in the manual:
http://docs.python.org/inst/tweak-fl...00000000000000

Cheers,
John
Jun 28 '08 #2
On Jun 28, 8:20 am, John Machin <sjmac...@lexicon.netwrote:
On Jun 28, 3:41 pm, eliben <eli...@gmail.comwrote:
On Jun 27, 3:10 pm, eliben <eli...@gmail.comwrote:
Hello,
I'm trying to compile the minimal example fromhttp://en.wikibooks.org/wiki/Python_Programming/Extending_with_Cwith
MinGW (latest version) and Python 2.5 (latest ActiveState binary
install). When running the setup file, the following happens:
running build
running build_ext
building 'hello' extension
writing build\temp.win32-2.5\Release\hello.def
d:\mingw\bin\gcc.exe -mno-cygwin -shared -s build
\temp.win32-2.5\Release\hellomo
dule.o build\temp.win32-2.5\Release\hello.def -LC:\Python25\libs -LC:
\Python25\P
Cbuild -lpython25 -lmsvcr71 -o build\lib.win32-2.5\hello.pyd
build\temp.win32-2.5\Release\hellomodule.o:hellomodule.c:(.text+0x3 e):
undefined
reference to `_imp___Py_NoneStruct'
build\temp.win32-2.5\Release\hellomodule.o:hellomodule.c:(.text+0x4 6):
undefined
reference to `_imp___Py_NoneStruct'
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
What's more, compiling the same extension with Visual Studio 2005
(without using distutils) works fine, the extension is loaded and ran
successfully from Python. Any ideas about this error ?
Eli
Problem solved:http://eli.thegreenplace.net/2008/06...n-extensions-w...

libpython2?.a is now *supplied* with the official CPython distribution
fromwww.python.org.
I'm using ActiveState's distribution, because I was told that it comes
with more precompiled win32 goodies out of the box.
The procedure that you followed is described in the manual:http://docs.python.org/inst/tweak-fl...62200000000000...
Thanks, I didn't notice it :-)

Eli

Jun 28 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Joonas Paalasmaa | last post: by
1 post views Thread by A. B., Khalid | last post: by
reply views Thread by A. B., Khalid | last post: by
30 posts views Thread by Jive | last post: by
26 posts views Thread by Kevin D. Smith | last post: by
6 posts views Thread by JW | last post: by
8 posts views Thread by rays | last post: by
81 posts views Thread by =?utf-8?B?4piG4piG4piG4piG4piGIFPDvCBLZWl0aCBDaGFr | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.