I'm trying to add a Swig interface on top of some already existing c++ code and I'm coming up with some errors with the
If I compile the already existing code without
-fPIC and then create my Swig module using:
swig -python -c++ pyinterface.i gcc -fPIC $(CFLAGS)-I $(PYTHON_INCLUDE_DIR) -c pyinterface_wrap.cxx g++ -shared -o _pyinterface.so pyinterface_wrap.o -I $(PYTHON_INCLUDE_DIR) -L $(PYTHON_LIB_DIR) $(LPATH) $(LFLAGS) $(IPATH) $(LIBS)
Entonces obtengo un
warning: creating a DT_TEXTREL in object
However the module does seem to load and work in Python.
If I compile the already existing code with
-fPIC and then do the same to create my module, when I try and import it into python:
Entonces me sale el error
ImportError: ./_pyinterface.so: undefined symbol: _Z7InitErfPA20_d
I can't tell why this would be. However, in the compliation of the base c++ files that I am trying to wrap, they do link to some standard libraries such as
Could it be that I need to recompile these base libraries, like lapack, with
-fPIC. That seems insane.
Actually sorry, I didn't realise, but with the -fPIC flag on I'm getting an error during compile:
g++: Internal error: Killed (program cc1plus)
Please submit a full bug report. See http://bugs.gentoo.org/ para obtener instrucciones.
I'll update this question if I figure out whats going on, but it seems like it might be unrelated to anything that the question actually raises.
preguntado el 04 de julio de 12 a las 09:07
I might be wrong regarding this reply.
Regarding the warning: creating a DT_TEXTREL in object
Even I was getting the same warning.
In my Makefile; I had done something like this
SRC= ../../some_folder/file.c 1.c 2.c
and while making the shared object, i was using this $(OBJS); whereas the "file.o" would be available at that location.
Make sure the object files that you are trying to access are available at that location.
My warning message vanished when i made the following changes
OBJS=file.o 1.o 2.o