[Pyrex] Newbie compiler problem

len-l at telus.net len-l at telus.net
Mon Aug 29 22:53:58 CEST 2005


On 30 Aug 2005 at 13:04, me2lon at freenet.de wrote:

> Hi,
> I'm new to pyrex and  have now tried to get it work properly for some hours.
> I read through several tutorials als also through this mailing list. All 
> went well excet for the
> last step: compiling.
> I'm using Python 2.4.1 / Pyrex 0.9.3 / mingW32  3.2.3
> I've now tried several other versions of  mingW compilers but I keep 
> getting
> this error ( I know that these warnings aren't critical ):
> 
> C:\Downloads\Pyrex-0.9.3\Pyrex-0.9.3\Demos>c:\python24\python setup.py 
> build_ext
>  --compiler=mingw32
> running build_ext
> building 'primes' extension
> creating build
> creating build\temp.win32-2.4
> creating build\temp.win32-2.4\Release
> c:\dev-cpp\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Ic:\python24\include 
> -Ic:\pyt
> hon24\PC -c primes.c -o build\temp.win32-2.4\Release\primes.o

[snip some primes module build messages]

> creating build\lib.win32-2.4
> c:\dev-cpp\bin\gcc.exe -mno-cygwin -shared -s 
> build\temp.win32-2.4\Release\prime
> s.o build\temp.win32-2.4\Release\primes.def -Lc:\python24\libs 
> -Lc:\python24\PCB
> uild -lpython24 -lmsvcr71 -o build\lib.win32-2.4\primes.pyd
> building 'spam' extension
> c:\dev-cpp\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Ic:\python24\include 
> -Ic:\pyt
> hon24\PC -c spam.c -o build\temp.win32-2.4\Release\spam.o

[snip some spam module build messages]

> c:\dev-cpp\bin\gcc.exe -mno-cygwin -shared -s 
> build\temp.win32-2.4\Release\spam.
> o build\temp.win32-2.4\Release\spam.def -Lc:\python24\libs 
> -Lc:\python24\PCBuild
>  -lpython24 -lmsvcr71 -o build\lib.win32-2.4\spam.pyd
> building 'numeric_demo' extension
> 
> c:\dev-cpp\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Ic:\python24\include 
> -Ic:\pyt
> hon24\PC -c numeric_demo.c -o build\temp.win32-2.4\Release\numeric_demo.o
> 
> numeric_demo.c:8:33: Numeric/arrayobject.h: No such file or directory

Do you have the Numeric package installed for Python 2.4? It is not part of the 
standard library.

> numeric_demo.c: In function `__pyx_f_12numeric_demo_print_2d_array':
> numeric_demo.c:74: error: `PyArrayObject' undeclared (first use in this 
> function)
> numeric_demo.c:74: error: (Each undeclared identifier is reported only once
> numeric_demo.c:74: error: for each function it appears in.)
> numeric_demo.c:74: error: `__pyx_v_a' undeclared (first use in this 
> function)

[snip usual warnings]

> numeric_demo.c: In function `initnumeric_demo':
> numeric_demo.c:323: error: `PyArrayObject' undeclared (first use in this 
> function)
> numeric_demo.c: At top level:
> 
> [snip]
> another pile of warnings
> 
> error: command 'gcc' failed with exit status 1
> 
> It just seems the compiler doesn't import the header files but i don't 
> know why.
> I'd be pleased if you could hel me.
> 
It looks like two of the three demo modules were built. Did you look for primes.pyd 
and spam.pyd in the build\lib.win32-2.4 subdirectory of the pyrex Demos directory?

Anyways, what I am interested in is if the modules, once built, will actually import 
into python, or raise an "ImportError: DLL load failed". I suspect there is a problem 
with Python's distutils and MinGW, but am not sure.

Lenard Lindstrom
<len-l at telus.net>




More information about the Pyrex mailing list