I work with a python swig-wrapped C++ library. In it\'s __init__.py
file, it sets the dlopen flag RTLD_GLOBAL before importing the shared object file containing
You are hitting a bug in the f2py tool, which is used in building SciPy. See more details here: https://github.com/numpy/numpy/issues/2521
Unfortunately, you can only fix the problem by rebuilding SciPy, or by removing the RTLD_GLOBAL
flag.
What's going on is that both NumPy and SciPy are using a symbol PyArray_API
, and the RTLD_GLOBAL
flag forces SciPy to (attempt to) export its own copy. This leads to a conflict and a segfault.
(if anyone can explain this in more detail, i'd love to know)
RTLD_GLOBAL
causes symbols from shared libraries to be made public and available for relocation. This is needed when you import several separate libraries via dlopen(), that use each other's symbols. In Python, this would be the case when a single project (PyOpenMM) consists of several binary submodules that want to share common functionality provided by one of them. The fact that "everything seems to work fine" could simply mean that you aren't using anything that needs the shared features -- or that PyOpenMM actually doesn't require this anymore.