You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[doc] Embedding into a shared library fails again #63352
No custom builds. Every package from ubuntu repository. Psycopg2 installed by pip
You may have to rebuild packages using the custom Python, not the system Python, since the linker options have to be different (especially the "shared" part: Ubuntu's Python is a static build, not a shared library build).
Or perhaps you can dlopen the CPython shared library with the RTLD_GLOBAL flag. I don't know.
I don't know if this is something that we can alleviate in Python itself.
rinatous commented on Oct 4, 2013
rinatousmannequin
MannequinAuthor
More actions
Or perhaps you can dlopen the CPython shared library with the RTLD_GLOBAL flag. I don't know.
Yes, it works. I made it is my shared library before boost block like this
Activity
rinatous commentedon Oct 3, 2013
I have same error as here described http://bugs.python.org/issue4434
I made everythings according this article http://docs.python.org/2/extending/embedding.html#compiling-and-linking-under-unix-like-systems and more but when i try to call interpriter from C++ it fails with errors
Environment
3.2.0-54-generic-pae #82-Ubuntu (12.04)
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Boost.Python 1.48
Python 2.7.3 (default, Sep 26 2013, 20:08:41)
[GCC 4.6.3] on linux2
No custom builds. Every package from ubuntu repository. Psycopg2 installed by pip
Project is big so i can't to provide code
pitrou commentedon Oct 4, 2013
You may have to rebuild packages using the custom Python, not the system Python, since the linker options have to be different (especially the "shared" part: Ubuntu's Python is a static build, not a shared library build).
Or perhaps you can dlopen the CPython shared library with the RTLD_GLOBAL flag. I don't know.
I don't know if this is something that we can alleviate in Python itself.
rinatous commentedon Oct 4, 2013
Yes, it works. I made it is my shared library before boost block like this
{ void* handle = dlopen("libpython2.7.so", RTLD_LAZY | RTLD_GLOBAL); // boost wrapper for python call dlclose(handle); }I think if nothing helps, i'll put this code into __attribute__((ctor|dtor)) functions
Thanks a lot
pitrou commentedon Oct 4, 2013
Ok, making it a documentation issue in case it deserves clarification in the docs.
[-]Embedding into a shared library fails again[/-][+][doc] Embedding into a shared library fails again[/+]