[CMake] FindPythonLibs
James Bigler
bigler at cs.utah.edu
Tue Feb 21 17:43:52 EST 2006
So FindPythonLibs seems to favor the static version of python that is
found in /usr/lib/python?.?/config .
This is find and dandy until you try to call some swigged code from an
embedded python interpreter.
Swig will compile an interface library (called _example.so). This will
be statically linked against /usr/lib/python2.4/config/libpython2.4.a as
per the FindPythonLibs's PYTHON_LIBRARIES variable.
Now I compile another shared library (called libscene_python.so) that
contains the embedded python code, so I need to link against
/usr/lib/python2.4/config/libpython2.4.a again.
My main program then dynamically loads libscene_python.so which starts
up the python interpretor. This interpreter eventually calls the swig
code inside _example.so. However, because each library was compiled
using the static version of the library, there are in actually *2*
interpreters floating around in memory space from each of the
instantiations of the statically linked library.
If you link against a shared version of libpython, life is good, because
there is only one "python core" in memory.
I was able to do this, by hard coding the library from the static one to
the shared one. Is there a way to control this better than this manual
tweak or to favor the shared versions of libraries?
Thanks,
James
More information about the CMake
mailing list