How can I link with libpython.a such a runtime linker can find all symbols in libpython.a?

In the next question this question, my corporate environment does not have a libpython2.6.so

shared object, but has a file libpython2.6.a

. Is there a way I can compile in libpython2.6.a

, storing symbols in libpython2.6.a

so that dynamic libraries can find those symbols at runtime?

My current compilation with a static library looks like this:

g++ -I/usr/CORP/pkgs/python/2.6.2/include/python2.6 \
    ~/tmp.cpp -pthread -lm -ldl -lutil \
    /usr/CORP/pkgs/python/2.6.2/lib/python2.6/config/libpython2.6.a \
    -o tmp.exe

      

However, if I load a module like "math" it dies with:

undefined symbol: PyInt_FromLong

      

0


source to share


1 answer


You need to pass --export-dynamic

to the linker. So from g++

this ...



g++ -Wl,--export-dynamic ...

      

+2


source







All Articles