[Pyrex] Building Pyrex module with Linux
Mike Wyatt
mikejohnwyatt at gmail.com
Wed May 9 03:12:45 UTC 2007
I'd like to build the modules on my new Ubuntu box. I made a trivial little
Pyrex script that I'm trying to build with distutils. I copied and modified
Setup.py from the Demos folder. I'm using Pyrex 0.9.5.1a and whatever the
default installation of GCC is for Ubuntu 7.04.
When I try to run the setup script (i.e. "python setup.py build"), I get a
ton of errors. Below you can see the content of my .pyx script, my
setup.pyscript, and the error messages I get when I attempt to build
setup.py.
It looks like GCC can't find Python.h. I'm not sure what to do about that,
though. I'm pretty new to Linux, and I was hoping that this setup script
would help me avoid most of these kind of issues.
Thanks in advance!
*** test.pyx ***
def Midpoint(a, b):
return (a+b)/2
*** setup.py ***
from distutils.core import setup
from distutils.extension import Extension
from Pyrex.Distutils import build_ext
setup(
name = 'Demos',
ext_modules=[
Extension("test", ["test.pyx"]),
],
cmdclass = {'build_ext': build_ext}
)
*** Results when running setup.py ***
mwyatt at mwyatt-laptop:~/python$ python setup.py build
running build
running build_ext
building 'test' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes
-fPIC -I/usr/include/python2.5 -c test.c -o build/temp.linux-x86_64-2.5
/test.o
test.c:3:20: error: Python.h: No such file or directory
test.c:4:26: error: structmember.h: No such file or directory
test.c:16: error: expected specifier-qualifier-list before 'PyObject'
test.c:17: error: expected specifier-qualifier-list before 'PyObject'
test.c:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
test.c:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
test.c:35: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
test.c:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
test.c:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
test.c:75: error: '__pyx_n_Midpoint' undeclared here (not in a function)
test.c:75: warning: excess elements in struct initializer
test.c:75: warning: (near initialization for '__pyx_intern_tab[0]')
test.c:75: warning: excess elements in struct initializer
test.c:75: warning: (near initialization for '__pyx_intern_tab[0]')
test.c:76: warning: excess elements in struct initializer
test.c:76: warning: (near initialization for '__pyx_intern_tab[1]')
test.c:76: warning: excess elements in struct initializer
test.c:76: warning: (near initialization for '__pyx_intern_tab[1]')
test.c:79: error: array type has incomplete element type
test.c:80: error: 'PyCFunction' undeclared here (not in a function)
test.c:80: error: expected '}' before '__pyx_f_4test_Midpoint'
test.c:86: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'inittest'
test.c:87: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'inittest'
test.c: In function '__Pyx_InternStrings':
test.c:113: error: '__Pyx_InternTabEntry' has no member named 'p'
test.c:114: error: '__Pyx_InternTabEntry' has no member named 'p'
test.c:114: warning: implicit declaration of function
'PyString_InternFromString'
test.c:114: error: '__Pyx_InternTabEntry' has no member named 's'
test.c:115: error: '__Pyx_InternTabEntry' has no member named 'p'
test.c:122:21: error: compile.h: No such file or directory
test.c:123:25: error: frameobject.h: No such file or directory
test.c:124:23: error: traceback.h: No such file or directory
test.c: In function '__Pyx_AddTraceback':
test.c:127: error: 'PyObject' undeclared (first use in this function)
test.c:127: error: (Each undeclared identifier is reported only once
test.c:127: error: for each function it appears in.)
test.c:127: error: 'py_srcfile' undeclared (first use in this function)
test.c:128: error: 'py_funcname' undeclared (first use in this function)
test.c:129: error: 'py_globals' undeclared (first use in this function)
test.c:130: error: 'empty_tuple' undeclared (first use in this function)
test.c:131: error: 'empty_string' undeclared (first use in this function)
test.c:132: error: 'PyCodeObject' undeclared (first use in this function)
test.c:132: error: 'py_code' undeclared (first use in this function)
test.c:133: error: 'PyFrameObject' undeclared (first use in this function)
test.c:133: error: 'py_frame' undeclared (first use in this function)
test.c:135: warning: implicit declaration of function 'PyString_FromString'
test.c:139: warning: implicit declaration of function 'PyModule_GetDict'
test.c:139: error: '__pyx_m' undeclared (first use in this function)
test.c:141: warning: implicit declaration of function 'PyTuple_New'
test.c:145: warning: implicit declaration of function 'PyCode_New'
test.c :162: warning: implicit declaration of function 'PyFrame_New'
test.c:163: warning: implicit declaration of function 'PyThreadState_Get'
test.c:170: warning: implicit declaration of function 'PyTraceBack_Here'
test.c :172: warning: implicit declaration of function 'Py_XDECREF'
error: command 'gcc' failed with exit status 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.copyleft.no/pipermail/pyrex/attachments/20070509/56ea0d05/attachment.html
More information about the Pyrex
mailing list