[GRASS-dev] grass7 build failing for swig/python

Hi

latest grass7 build fails in swig/python with:

[...]/trunk/dist.i686-pc-linux-gnu/include -I/usr/local/src/grass/svn/trunk/dist.i686-pc-linux-gnu/include -o OBJ.i686-pc-linux-gnu/utils_wrap.o -c utils_wrap.c
utils_wrap.c: In function 'pyseq_to_ptr':
utils_wrap.c:2495: error: 'Py_ssize_t' undeclared (first use in this function)
utils_wrap.c:2495: error: (Each undeclared identifier is reported only once
utils_wrap.c:2495: error: for each function it appears in.)
utils_wrap.c:2495: error: expected ';' before 'len'
utils_wrap.c:2522: error: 'len' undeclared (first use in this function)
utils_wrap.c: In function 'pyobj_to_ptr':
utils_wrap.c:2570: error: 'Py_ssize_t' undeclared (first use in this function)
utils_wrap.c:2570: error: expected ';' before 'len'
[...]
make[1]: *** [OBJ.i686-pc-linux-gnu/utils_wrap.o] Error 1
make[1]: Leaving directory `/usr/local/src/grass/svn/trunk/swig/python'
make: *** [default] Error 2

Py_ssize_t is defined in /usr/include/python2.4/pymem.h, so I guess that
needs to be #included somewhere?

Hamish

Hamish wrote:

latest grass7 build fails in swig/python with:

[...]/trunk/dist.i686-pc-linux-gnu/include -I/usr/local/src/grass/svn/trunk/dist.i686-pc-linux-gnu/include -o OBJ.i686-pc-linux-gnu/utils_wrap.o -c utils_wrap.c
utils_wrap.c: In function 'pyseq_to_ptr':
utils_wrap.c:2495: error: 'Py_ssize_t' undeclared (first use in this function)
utils_wrap.c:2495: error: (Each undeclared identifier is reported only once
utils_wrap.c:2495: error: for each function it appears in.)
utils_wrap.c:2495: error: expected ';' before 'len'
utils_wrap.c:2522: error: 'len' undeclared (first use in this function)
utils_wrap.c: In function 'pyobj_to_ptr':
utils_wrap.c:2570: error: 'Py_ssize_t' undeclared (first use in this function)
utils_wrap.c:2570: error: expected ';' before 'len'
[...]
make[1]: *** [OBJ.i686-pc-linux-gnu/utils_wrap.o] Error 1
make[1]: Leaving directory `/usr/local/src/grass/svn/trunk/swig/python'
make: *** [default] Error 2

I can't reproduce this.

Py_ssize_t is defined in /usr/include/python2.4/pymem.h, so I guess that
needs to be #included somewhere?

It shouldn't be necessary to include headers other than <Python.h>.
SWIG should add that include itself.

--
Glynn Clements <glynn@gclements.plus.com>

Hi,

2009/6/14 Glynn Clements <glynn@gclements.plus.com>:

[...]/trunk/dist.i686-pc-linux-gnu/include -I/usr/local/src/grass/svn/trunk/dist.i686-pc-linux-gnu/include -o OBJ.i686-pc-linux-gnu/utils_wrap.o -c utils_wrap.c
utils_wrap.c: In function 'pyseq_to_ptr':
utils_wrap.c:2495: error: 'Py_ssize_t' undeclared (first use in this function)
utils_wrap.c:2495: error: (Each undeclared identifier is reported only once
utils_wrap.c:2495: error: for each function it appears in.)
utils_wrap.c:2495: error: expected ';' before 'len'
utils_wrap.c:2522: error: 'len' undeclared (first use in this function)
utils_wrap.c: In function 'pyobj_to_ptr':
utils_wrap.c:2570: error: 'Py_ssize_t' undeclared (first use in this function)
utils_wrap.c:2570: error: expected ';' before 'len'
[...]
make[1]: *** [OBJ.i686-pc-linux-gnu/utils_wrap.o] Error 1
make[1]: Leaving directory `/usr/local/src/grass/svn/trunk/swig/python'
make: *** [default] Error 2

I can't reproduce this.

Probably related to the Swig version. Which version of swig do you
use. With swig 1.3.29 the wrap C files do not include typedef for
Py_ssize_t which are needed for Python <= 2.4.

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa