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.<br><br>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.py script, and the error messages I get when I attempt to build
setup.py.<br><br>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.
<br><br>Thanks in advance!<br><br>*** test.pyx ***<br>def Midpoint(a, b):<br> return (a+b)/2<br><br>*** setup.py ***<br>from distutils.core import setup<br>from distutils.extension import Extension<br>from Pyrex.Distutils
import build_ext<br><br>setup(<br> name = 'Demos',<br> ext_modules=[ <br> Extension("test", ["test.pyx"]),<br> ],<br> cmdclass = {'build_ext': build_ext}<br>)<br><br>*** Results when running
setup.py ***<br>mwyatt@mwyatt-laptop:~/python$ python setup.py build<br>running build<br>running build_ext<br>building 'test' extension<br>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<br>test.c:3:20: error: Python.h: No such file or directory<br>test.c:4:26: error: structmember.h: No such file or directory<br>test.c:16: error: expected specifier-qualifier-list before 'PyObject'
<br>test.c:17: error: expected specifier-qualifier-list before 'PyObject'<br>test.c:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token<br>
test.c:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
<br>test.c:35: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token<br>test.c:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
<br>test.c:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
<br>test.c:75: error: '__pyx_n_Midpoint' undeclared here (not in a function)<br>test.c:75: warning: excess elements in struct initializer<br>test.c:75: warning: (near initialization for '__pyx_intern_tab[0]')
<br>test.c:75: warning: excess elements in struct initializer
<br>test.c:75: warning: (near initialization for '__pyx_intern_tab[0]')<br>test.c:76: warning: excess elements in struct initializer<br>test.c:76: warning: (near initialization for '__pyx_intern_tab[1]')<br>
test.c:76: warning: excess elements in struct initializer
<br>test.c:76: warning: (near initialization for '__pyx_intern_tab[1]')<br>test.c:79: error: array type has incomplete element type<br>test.c:80: error: 'PyCFunction' undeclared here (not in a function)<br>
test.c:80: error: expected '}' before '__pyx_f_4test_Midpoint'
<br>test.c:86: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'inittest'<br>test.c:87: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'inittest'
<br>test.c: In function '__Pyx_InternStrings':
<br>test.c:113: error: '__Pyx_InternTabEntry' has no member named 'p'<br>test.c:114: error: '__Pyx_InternTabEntry' has no member named 'p'<br>test.c:114: warning: implicit declaration of function 'PyString_InternFromString'
<br>test.c:114: error: '__Pyx_InternTabEntry' has no member named 's'<br>test.c:115: error: '__Pyx_InternTabEntry' has no member named 'p'<br>test.c:122:21: error: compile.h: No such file or directory
<br>test.c:123:25: error:
frameobject.h: No such file or directory<br>test.c:124:23: error: traceback.h: No such file or directory<br>test.c: In function '__Pyx_AddTraceback':<br>test.c:127: error: 'PyObject' undeclared (first use in this function)
<br>test.c:127: error: (Each undeclared identifier is reported only once<br>test.c:127: error: for each function it appears in.)<br>test.c:127: error: 'py_srcfile' undeclared (first use in this function)<br>test.c
:128: error: 'py_funcname' undeclared (first use in this function)
<br>test.c:129: error: 'py_globals' undeclared (first use in this function)<br>test.c:130: error: 'empty_tuple' undeclared (first use in this function)<br>test.c:131: error: 'empty_string' undeclared (first use in this function)
<br>test.c:132: error: 'PyCodeObject' undeclared (first use in this function)<br>test.c:132: error: 'py_code' undeclared (first use in this function)<br>test.c:133: error: 'PyFrameObject' undeclared (first use in this function)
<br>test.c:133: error: 'py_frame' undeclared (first use in this function)<br>test.c:135: warning: implicit declaration of function 'PyString_FromString'<br>test.c:139: warning: implicit declaration of function 'PyModule_GetDict'
<br>test.c:139: error: '__pyx_m' undeclared (first use in this function)<br>test.c:141: warning: implicit declaration of function 'PyTuple_New'<br>test.c:145: warning: implicit declaration of function 'PyCode_New'
<br>test.c
:162: warning: implicit declaration of function 'PyFrame_New'<br>test.c:163: warning: implicit declaration of function 'PyThreadState_Get'<br>test.c:170: warning: implicit declaration of function 'PyTraceBack_Here'
<br>test.c
:172: warning: implicit declaration of function 'Py_XDECREF'<br>error: command 'gcc' failed with exit status 1