Note that there are some explanatory texts on larger screens.

plurals
  1. POCompiling with -fPIC and Swig error
    primarykey
    data
    text
    <p>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 <code>-fPIC</code> flag.</p> <p>If I compile the already existing code without <code>-fPIC</code> and then create my Swig module using:</p> <pre><code>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) </code></pre> <p>Then I get a</p> <pre><code>warning: creating a DT_TEXTREL in object </code></pre> <p>However the module does seem to load and work in Python.</p> <p>If I compile the already existing code with <code>-fPIC</code> and then do the same to create my module, when I try and import it into python:</p> <pre><code>import pyinterface </code></pre> <p>Then I get the error </p> <pre><code>ImportError: ./_pyinterface.so: undefined symbol: _Z7InitErfPA20_d </code></pre> <p>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 <code>-llapack</code>.</p> <p>Could it be that I need to recompile these base libraries, like lapack, with <code>-fPIC</code>. That seems insane.</p> <p>EDIT:</p> <p>Actually sorry, I didn't realise, but with the -fPIC flag on I'm getting an error during compile: </p> <pre><code>g++: Internal error: Killed (program cc1plus) </code></pre> <p>Please submit a full bug report. See <a href="http://bugs.gentoo.org/" rel="nofollow">http://bugs.gentoo.org/</a> for instructions.</p> <p>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. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload