[GRASS-dev] [GRASS GIS] #658: swig/python fails to build with older version of swig

#658: swig/python fails to build with older version of swig
---------------------------------+------------------------------------------
Reporter: hamish | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: SWIG (all bindings) | Version: 6.4.0 RCs
Keywords: python | Platform: Linux
      Cpu: x86-32 |
---------------------------------+------------------------------------------
Hi,

as per this thread:
  http://thread.gmane.org/gmane.comp.gis.grass.devel/33808

swig/python from releasebranch_6_4 thru trunk now fail to build on
Debian/Etch, (apparently) because Etch shipped with SWIG 1.3.29-2.1 and
Python 2.4, which is (apparently) just slightly too old for the newer
functions used.

The exact error is: (6.4svn)
{{{
gcc -I/usr/local/src/grass/svn/releasebranch_6_4/dist.i686-pc-linux-
gnu/include -g -O2 -fPIC -DPACKAGE=\""grasslibs"\" -fPIC
-I/usr/include/python2.4 -I/usr/include/python2.4
-DPACKAGE=\""grasslibs"\"
-I/usr/local/src/grass/svn/releasebranch_6_4/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)
...
}}}

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/658&gt;
GRASS GIS <http://grass.osgeo.org>

#658: swig/python fails to build with older version of swig
----------------------------------+-----------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.5.0
Component: SWIG (all bindings) | Version: svn-develbranch6
Resolution: | Keywords: python
  Platform: Linux | Cpu: x86-32
----------------------------------+-----------------------------------------
Changes (by hamish):

  * version: 6.4.0 RCs => svn-develbranch6
  * milestone: 6.4.0 => 6.5.0

Comment:

I'm pretty sure Glynn fixed this bug some time later (see ML archives).
Now 6.4 swig/python builds fine for me.

But now I get an error building 6.5svn

{{{
cd swig/python
make clean
make
[...]
make[1]: Entering directory `/usr/local/src/grass/svn/grass65/swig/python'
test -d OBJ.i686-pc-linux-gnu || mkdir -p OBJ.i686-pc-linux-gnu
I/usr/local/src/grass/svn/grass65/dist.i686-pc-linux-gnu/include
-I../include/python -outdir . -python -o utils_wrap.c -module utils
-shadow ../include/python/utils.i
make[1]: I/usr/local/src/grass/svn/grass65/dist.i686-pc-linux-gnu/include:
Command not found
make[1]: [utils_wrap.c] Error 127 (ignored)
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 -DPACKAGE=\""grasslibs"\"
-I/usr/include/gdal -I/usr/include/gdal -I/usr/include
-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
gcc: utils_wrap.c: No such file or directory
gcc: no input files
make[1]: *** [OBJ.i686-pc-linux-gnu/utils_wrap.o] Error 1
make[1]: Leaving directory `/usr/local/src/grass/svn/grass65/swig/python'
make: *** [default] Error 2
}}}

-I becomes I in "`make[1] I$(GISBASE)/include`" .... ??

also, is this a typo?? (6.5svn swig/python/Makefile)
{{{
Index: Makefile

--- Makefile (revision 41135)
+++ Makefile (working copy)
@@ -36,7 +36,7 @@

  EXTRA_INC = $(VECT_INC) $(PROJINC) $(GDALCFLAGS) $(GEOSCFLAGS)

-EXTRA_SWG = ../include/python/my_typemaps.i ../include/python/common.i
+EXTRA_SWIG = ../include/python/my_typemaps.i ../include/python/common.i
  SWIGFLAGS = $(ARCH_INC) -I../include/python -outdir .
  EXTRA_CFLAGS = $(PYMOD_CFLAGS)
  EXTRA_CLEAN_FILES := $(foreach M,$(MODULES),$(M)_wrap.o $(M)_wrap.c
$(M).pyc $(M).py _$(M).so)
}}}

6.4 builds ok. there are some differences:

{{{
grass65/swig/python$ diff ../../../releasebranch_6_4/swig/python/Makefile
Makefile
--- ../../../releasebranch_6_4/swig/python/Makefile 2009-09-10
14:47:27.000000000 +1200
+++ Makefile 2010-02-22 00:38:21.000000000 +1300
@@ -34,9 +34,9 @@
  trans_LIBS = $(TRANSLIB)
  vedit_LIBS = $(VEDITLIB)

-EXTRA_INC = $(VECT_INC) $(PROJINC) $(GDALCFLAGS)
+EXTRA_INC = $(VECT_INC) $(PROJINC) $(GDALCFLAGS) $(GEOSCFLAGS)

-EXTRA_SWIG = ../include/python/my_typemaps.i ../include/python/common.i
+EXTRA_SWG = ../include/python/my_typemaps.i ../include/python/common.i
  SWIGFLAGS = $(ARCH_INC) -I../include/python -outdir .
  EXTRA_CFLAGS = $(PYMOD_CFLAGS)
  EXTRA_CLEAN_FILES := $(foreach M,$(MODULES),$(M)_wrap.o $(M)_wrap.c
$(M).pyc $(M).py _$(M).so)
@@ -50,13 +50,14 @@

  LIBFILES := $(patsubst %,$(DSTDIR)/_%.so,$(MODULES))
  PYFILES := $(patsubst %,$(DSTDIR)/%.py,$(MODULES) __init__)
+PYCFILES := $(patsubst %,$(DSTDIR)/%.pyc,$(MODULES) __init__)
  LLIBFILES := $(patsubst %,_%.so,$(MODULES))
  WRAPFILES := $(patsubst %,%_wrap.c,$(MODULES))
  LPYFILES := $(patsubst %,%.py,$(MODULES))

  default:
         $(MAKE) $(DSTDIR)
- $(MAKE) $(LLIBFILES) $(WRAPFILES) $(LPYFILES) $(LIBFILES)
$(PYFILES)
+ $(MAKE) $(LLIBFILES) $(WRAPFILES) $(LPYFILES) $(LIBFILES)
$(PYFILES) $(PYCFILES)

  %_wrap.c %.py: ../include/%.i $(EXTRA_SWIG)
         $(SWIG) $(SWIGFLAGS) -python -o $*_wrap.c -module $* -shadow $<
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/658#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#658: swig/python fails to build with older version of swig
----------------------------------+-----------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.5.0
Component: SWIG (all bindings) | Version: svn-develbranch6
Resolution: | Keywords: python
  Platform: Linux | Cpu: x86-32
----------------------------------+-----------------------------------------
Comment (by glynn):

Replying to [comment:1 hamish]:
> But now I get an error building 6.5svn
>
{{{
I/usr/local/src/grass/svn/grass65/dist.i686-pc-linux-gnu/include
-I../include/python -outdir . -python -o utils_wrap.c -module utils
-shadow ../include/python/utils.i
make[1]: I/usr/local/src/grass/svn/grass65/dist.i686-pc-linux-gnu/include:
Command not found
}}}

This indicates that $(SWIG) is empty.

> also, is this a typo?? (6.5svn swig/python/Makefile)
{{{
-EXTRA_SWG = ../include/python/my_typemaps.i ../include/python/common.i
+EXTRA_SWIG = ../include/python/my_typemaps.i ../include/python/common.i
}}}

Yes.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/658#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#658: swig/python fails to build with older version of swig
----------------------------------+-----------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.5.0
Component: SWIG (all bindings) | Version: svn-develbranch6
Resolution: | Keywords: python
  Platform: Linux | Cpu: x86-32
----------------------------------+-----------------------------------------
Comment (by neteler):

Replying to [comment:2 glynn]:
> Replying to [comment:1 hamish]:
> > But now I get an error building 6.5svn
...
> > also, is this a typo?? (6.5svn swig/python/Makefile)
> {{{
> -EXTRA_SWG = ../include/python/my_typemaps.i ../include/python/common.i
> +EXTRA_SWIG = ../include/python/my_typemaps.i ../include/python/common.i
> }}}
>
> Yes.

Fixed in r41161.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/658#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#658: swig/python fails to build with older version of swig
----------------------------------+-----------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: major | Milestone: 6.5.0
Component: SWIG (all bindings) | Version: svn-develbranch6
Resolution: fixed | Keywords: python
  Platform: Linux | Cpu: x86-32
----------------------------------+-----------------------------------------
Changes (by hamish):

  * status: new => closed
  * resolution: => fixed

Comment:

Replying to [comment:2 glynn]:
> This indicates that $(SWIG) is empty.

right.
  ... which was caused by trying to build swig/python/ when --with-python
was not used in the ./configure step.

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/658#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>