[Pyrex] [Cython] Installing Cython - compiling primes demo fails

Lenard Lindstrom len-l at telus.net
Tue Feb 26 08:55:55 CET 2008


I have no experience with ActivePython but plenty of MinGW experience. 
First, what version of gcc is being used. gcc 3.4.5 works well. Second, 
does the C:\Python25\libs directory contain the export library 
libpython25.a . This should not matter if gcc 3.4.5 is used since it can 
read .lib files. But there may be something peculiar with those provided 
with ActivePython. If libpython25.a is missing then try using the actual 
Python dll as an import library. Copy python25.dll to libs and rename to 
libpython25.dll.a . Third, is the environment variable 
MINGW_ROOT_DIRETORY set to c:\mingw . Finally,  is c:\mingw\bin added to 
PATH?


Lenard

Robert Bradshaw wrote:
> I don't have any experience with mingw32, but it does look like some  
> kind of linking error.
>
> However, this thread might be able to point you in the right direction:
>
> http://osdir.com/ml/python.pyrex/2004-04/msg00028.html
>
> - Robert
>
>
> On Feb 25, 2008, at 2:58 PM, Niclas Mattsson wrote:
>
>   
>> Hello listers,
>>
>> Newbie here, trying to get Cython running on Windows XP SP2 with
>> ActivePython 2.5.1.1 using mingw32-gcc. Cython itself seems to install
>> correctly (no warnings or errors from "python setup.py install"), but
>> building the demos fails with "undefined reference" errors when  
>> linking
>> primes.o. See dump below.
>>
>> Do I need to link to some missing library manually? What's going on?
>>
>> Please let me know if this is an inappropriate place for newbie
>> questions - and if so, sorry for barging in!
>>
>> Thanks,
>> Niclas
>>
>> -------------
>>
>> C:\Cython-0.9.6.12\Demos>python Setup.py build_ext --inplace -c  
>> mingw32
>>
>> running build_ext
>> building 'primes' extension
>> creating build
>> creating build\temp.win32-2.5
>> creating build\temp.win32-2.5\Release
>> c:\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python25\include
>> -IC:\Python25\PC -c primes.c -o build\temp.win32-2.5\Release\primes.o
>> primes.c: In function `__pyx_pf_6primes_primes':
>> primes.c:125: warning: '__pyx_v_result' might be used uninitialized in
>> this function
>> writing build\temp.win32-2.5\Release\primes.def
>> c:\mingw\bin\gcc.exe -mno-cygwin -shared -s
>> build\temp.win32-2.5\Release\primes.o
>> build\temp.win32-2.5\Release\primes.def -LC:\Python25\libs
>> -LC:\Python25\PCbuild -lpython25 -lmsvcr71 -o primes.pyd
>> build\temp.win32-2.5\Release\primes.o:primes.c:(.text+0x85): undefined
>> reference to `_imp___Py_NoneStruct'
>> build\temp.win32-2.5\Release\primes.o:primes.c:(.text+0x4c8):  
>> undefined
>> reference to `_imp__PyExc_RuntimeError'
>> build\temp.win32-2.5\Release\primes.o:primes.c:(.text+0x559):  
>> undefined
>> reference to `_imp__PyString_Type'
>> build\temp.win32-2.5\Release\primes.o:primes.c:(.text+0x560):  
>> undefined
>> reference to `_imp__PyString_Type'
>> build\temp.win32-2.5\Release\primes.o:primes.c:(.text+0x81f):  
>> undefined
>> reference to `_imp__PyInt_Type'
>> collect2: ld returned 1 exit status
>> error: command 'gcc' failed with exit status 1
>> _______________________________________________
>>     




More information about the Pyrex mailing list