[GRASS-dev] Re: [GRASS-SVN] r38872 - grass/trunk

Glynn Clements glynn at gclements.plus.com
Thu Aug 27 11:46:33 EDT 2009


Hamish wrote:

> FWIW the error is as so:
> 
> [...]
> gcc -I/usr/local/src/grass/svn/grass65/dist.i686-pc-linux-gnu/include  -ggdb -march=pentium4 -Wall -Werror-implicit-function-declaration    -fPIC   -DPACKAGE=\""grasslibs"\" -fPIC -I/usr/include/python2.4 -I/usr/include/python2.4    -DPACKAGE=\""grasslibs"\"  -I/usr/include/gdal -I/usr/include/gdal -I/usr/local/src/grass/svn/grass65/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'

Oops. It's not your distro; utils.i and my_typemaps.i are using
Py_ssize_t although that type only exists in Python 2.5. Later
versions of SWIG define it (as an alias for "int") for earlier
versions of Python.

Try this:

--- swig/include/python/common.i	(revision 38884)
+++ swig/include/python/common.i	(working copy)
@@ -2,6 +2,13 @@
 #include <stdio.h>
 #include <grass/gis.h>
 #include <grass/raster.h>
+
+#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
+typedef int Py_ssize_t;
+# define PY_SSIZE_T_MAX INT_MAX
+# define PY_SSIZE_T_MIN INT_MIN
+#endif
+
 %}
 
 %rename(my_def) def;

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


More information about the grass-dev mailing list