Using pybind11, I'm trying to interface with a modified r.viewshed source code (copied into my source directory for now). However, when I try to import the function in python I get
package.cpython-39-x86_64-linux-gnu.so: undefined symbol: _ZN16mm_register_initD1Ev
Inspecting the so file:
$ nm -D package.cpython-39-x86_64-linux-gnu.so| grep mm_register_init
U _ZN16mm_register_initC1Ev
U _ZN16mm_register_initD1Ev
With U meaning that the symbol is undefined (see man nm).
Checking if any libgrass files that are visibile by ldconfig contain the symbol draws a blank too, as well as checking every .so file on the filesystem.
ldconfig -p | grep -o "/opt/grass/.*" | xargs nm -D | grep mm_register_init
# and
fd "libgrass" / -e so | xargs nm -D | grep mm_register_init
Calling grass launches grass without an issue.
The only solution I can see is adding the source code as a submodule and statically linking every required function which is not what I'd like to do.