tags:

views:

226

answers:

1

In a sequel question to this question, my corporate environment lacks the libpython2.6.so shared object but has the libpython2.6.a file. Is there a way that I can compile in libpython2.6.a while retaining the symbols in libpython2.6.a such that dynamic libraries can find these symbols at runtime?

My current compile with the static library looks like:

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
+2  A: 

You need to pass --export-dynamic to the linker. So from g++ it's...

g++ -Wl,--export-dynamic ...
alex tingle
thank you!
Ross Rogers