SWIG compilation woes.

Steve Juranich sjuranic at condor.ee.washington.edu
Fri Nov 10 13:05:43 EST 2000


I'm confronted with the task of setting up SWIG myself.  We have a very
non-standard (degrees of non-standardness?? hmm...) distribution of tcl,
perl, and python.  Obviously, my first priority is getting the python tools
working.

When I run make testbuild, none of the statically linked modules work (which
is fine with me) and dynamic modules will work for tcl and Python if the
modules were written in C.  However, when it gets to testing the C++ code,
nothing works at all.  For the Python modules in C++, I get a bunch of
linker errors.  Here's was Test/Build/python_dynamic.c++.output says:


make[3]: Entering directory `/atm/homes/raven0/sjuranic/tmp/SWIG1.1p5/Tests/Build'
make -f ../../Makefile.template SRCS='' SWIG='../../swig' \
SWIGOPT='-I../../swig_lib' \
TARGET='shapes' INTERFACE='shapes.i	' python_cpp
make[4]: Entering directory `/atm/homes/raven0/sjuranic/tmp/SWIG1.1p5/Tests/Build'
../../swig -c++ -python -I../../swig_lib shapes.i	
Generating wrappers for Python
/g/rcs/sw/bin/g++ -c   shapes_wrap.c	   -DHAVE_CONFIG_H -I/g/rcs/sw/pkgs/python-1.6/include/python1.6
/g/rcs/sw/bin/g++ -shared   shapes_wrap.o	   -o shapesmodule.so
Text relocation remains                 	referenced
    against symbol		    offset	in file
<unknown>                           0x24      	shapes_wrap.o
... (I get about 500 of these) ...
Py_InitModule4                      0x1f8c    	shapes_wrap.o
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: ld returned 1 exit status
make[4]: *** [python_cpp] Error 1
make[4]: Leaving directory `/atm/homes/raven0/sjuranic/tmp/SWIG1.1p5/Tests/Build'
make[3]: *** [python_dynamic] Error 2
make[3]: Leaving directory `/atm/homes/raven0/sjuranic/tmp/SWIG1.1p5/Tests/Build'

Can anybody tell me what is going on and how to fix it?  I'm fairly certain
that SWIG is (for the most part) configured correctly because it will
compile Python modules written in C.  But given the OO-ness of Python, I
will obviously want to be writing some C++ code as well.

Thanks for the help.

----------------------------------------------------------------------
Stephen W. Juranich                         sjuranic at ee.washington.edu
Electrical Engineering         http://students.washington.edu/sjuranic
University of Washington             http://rcs.ee.washington.edu/ssli





More information about the Python-list mailing list