Opened 15 years ago

Closed 15 years ago

#658 closed defect (fixed)

swig/python fails to build with older version of swig

Reported by: hamish Owned by: grass-dev@…
Priority: major Milestone: 6.5.0
Component: Python ctypes Version: svn-develbranch6
Keywords: python Cc:
CPU: x86-32 Platform: Linux

Description

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

Change History (4)

comment:1 by hamish, 15 years ago

Milestone: 6.4.06.5.0
Version: 6.4.0 RCssvn-develbranch6

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 $<

in reply to:  1 ; comment:2 by glynn, 15 years ago

Replying to 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.

in reply to:  2 comment:3 by neteler, 15 years ago

Replying to glynn:

Replying to 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.

in reply to:  2 comment:4 by hamish, 15 years ago

Resolution: fixed
Status: newclosed

Replying to 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

Note: See TracTickets for help on using tickets.