I am having difficulty importing a python extension module that depends on a separate shared library that I am building via a separate build system. When I attempt to import the module, I get an undefined symbol error:
import ext_mod
ImportError: /ext_mod_path/ext_mod.so: undefined symbol: __mangled_func_name
This makes a certain amount of sense, since it's missing from the extension module shared library, as it's contained in the separate shared library.
$ nm /ext_mod_path/ext_mod.so | grep __mangled_func_name
U __mangled_func_name
But the extension module library can successfully find the shared common library:
$ ldd /ext_mod_path/ext_mod.so
libmodcommon.so => /user_lib_path/libmodcommon.so (0x...)
And the symbol is defined there
$ nm /user_lib_path/libmodcommon.so | grep __mangled_func_name
000000000002e750 T __mangled_func_name
Why can't the symbol be seen in ext_mod.so
?
For reference, the linker command for the extension module is:
g++ -o ext_mod.so -shared -Wl,-rpath=/user_lib_path ext_mod.os -L/user_lib_path -lmodcommon