I cross compiled python for android x86_64, and the interpreter works fine, no problems. But when I compiled some other extension and try to import it. I get an import error as such the imported shared library fails to locate the symbol "PyBool_Type". ImportError: dlopen failed: cannot locate symbol "PyBool_Type" referenced by .... The extension was compiled with -I && -L flags pointing to the Python installation include and lib folders.
if you have compiled python with --enable-shared you will get a lib/libpython3.Xdm.so file and you can use nm -D lib/libpython3.Xdm.so | grep PyBool_Type nm --debug-syms lib/libpython3.8dm.so
grep PyBool 0000000000077696 T PyBool_FromLong 0000000000328d20 D PyBool_Type I think it's a problem with your compilation. Could you explain how do you cross-compile for android? Thank you
Thank you, but I think there is missing info with your script. Do you have a shell script to share? What are the values of: ANDROID_TARGET ANDROID_API CC++ BIN_UTILS_PREFIX etc... For example, if I want to use a docker image on my Fedora, how can I compile Python for Android from my Fedora or Debian x86? Thank you
It is not yet possible to cross-compile python extensions. The reason is that _init_posix() in Lib/sysconfig.py still reads the sysconfigdata module of the native compiler instead of the sysconfigdata of the cross-built one. See the patch in issue #28833.