Hi everyone,
Sorry to ask this low-level question.
My friend introduced me DParser for python and I want to install it on my machine (Solaris).
I downloaded the package and first make the DParser package. It worked and 'make test' also worked.
However, I tried to install the python interface, I got relocation error. The error was generated when .so was generated:
# make install
python setup.py install
running install
running build
running build_py
creating build
creating build/lib.solaris-2.9-sun4u-2.4
copying dparser.py -> build/lib.solaris-2.9-sun4u-2.4
running build_ext
building 'dparser_swigc' extension
creating build/temp.solaris-2.9-sun4u-2.4
gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DSWIG_GLOBAL -I/usr/local/include/python2.4 -c dparser_wrap.c -o build/temp.solaris-2.9-sun4u-2.4/dparser_wrap.o -Wall
In file included from /usr/local/include/python2.4/Python.h:8,
from dparser_wrap.c:47:
/usr/local/include/python2.4/pyconfig.h:836:1: warning: "_FILE_OFFSET_BITS" redefined
In file included from /usr/include/iso/string_iso.h:31,
from /usr/include/string.h:18,
from dparser_wrap.c:22:
/usr/include/sys/feature_tests.h:96:1: warning: this is the location of the previous definition
dparser_wrap.c:1590: warning: function declaration isn't a prototype
gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DSWIG_GLOBAL -I/usr/local/include/python2.4 -c pydparser.c -o build/temp.solaris-2.9-sun4u-2.4/pydparser.o -Wall
gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DSWIG_GLOBAL -I/usr/local/include/python2.4 -c make_tables.c -o build/temp.solaris-2.9-sun4u-2.4/make_tables.o -Wall
gcc -shared build/temp.solaris-2.9-sun4u-2.4/dparser_wrap.o build/temp.solaris-2.9-sun4u-2.4/pydparser.o build/temp.solaris-2.9-sun4u-2.4/make_tables.o -L../ -lmkdparse -ldparse -o build/lib.solaris-2.9-sun4u-2.4/dparser_swigc.so
Text relocation remains referenced
against symbol offset in file
<unknown> 0x2a8 ..//libmkdparse.a(gram.o)
<unknown> 0x2ac ..//libmkdparse.a(gram.o)
<unknown> 0x2b0 ..//libmkdparse.a(gram.o)
<unknown> 0x2b4 ..//libmkdparse.a(gram.o)
... <snip> .... (many relocation errors)
I'm using the following versions:
Solaris 9 (sun4u)
gcc (GCC) 3.4.2
Python 2.4.4
SWIG Version 1.3.29
//
As I don't see any errors in the original DParser package, I don't have any clue why 'python setup.py install' generates these errors.
Any suggestions will be highly appreciated.
Best regards,
Aki Niimura
Hi Aki,
I had the same problem trying to build a Python module using the libdparse.a library on Solaris. It seems 'gcc -shared' passes some weird options to Solaris's 'ld', which makes it fail. I solved the problem by calling 'ld' directly, with the -dy and -G options. In your case, the command would be:
ld -dy -G build/temp.solaris-2.9-sun4u-2.4/dparser_wrap.o
build/temp.solaris-2.9-sun4u-2.4/pydparser.o
build/temp.solaris-2.9-sun4u-2.4/make_tables.o -L../ -lmkdparse -ldparse -o
build/lib.solaris-2.9-sun4u-2.4/dparser_swigc.so
Don't know if it's applicable in your case, or if you can use the same options (I'm on Solaris 8). You might also have to try different orders for the object files and the libraries on the command line, as it seems significant for 'ld'.
HTH anyway.