pyo3: Cross compile linking issue: cannot locate symbol "_Py_NoneStruct"
🐛 Bug Description
I need to cross compile a pyo3 library for android using kivy/buildozer. I’ve set the LD_LIBRARY_PATH, PYO3_CROSS_INCLUDE_DIR and PYO3_CROSS_LIB_DIR environment variables and am using cargo ndk for the build process and copying the .so to the site_packages directory.
Everything compiles correctly, unfortunately at runtime I get the message cannot locate symbol "_Py_NoneStruct".
🌍 Environment
- Your operating system and version: Ubuntu 20.04 (docker)
- Your python version: 3.8
- How did you install python (e.g. apt or pyenv)? Did you use a virtualenv?: compiled from source
- Your Rust version (
rustc --version): 1.45.0 - Your PyO3 version: 0.11.1
- Have you tried using latest PyO3 master (replace
version = "0.x.y"withgit = "https://github.com/PyO3/pyo3")?: yes
💥 Reproducing
I have a repo for the minimal working example. The necessary commands are shown in the README.md
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (19 by maintainers)
Commits related to this issue
- Load compilation options from _sysconfigdata_*.py file Following the discussion in #1077 this change allows the compilation script to load the configurations from a _sysconfigdata_ file in the librar... — committed to Progdrasil/pyo3 by deleted user 6 years ago
- Load compilation options from _sysconfigdata_*.py file Following the discussion in #1077 this change allows the compilation script to load the configurations from a _sysconfigdata_ file in the librar... — committed to Progdrasil/pyo3 by deleted user 6 years ago
Closed by #1095. (Thanks very much again for your hard work!)
Great! I’ll try to either get notes or a rough implementation written up tomorrow or soon after.
Yeah I would be glad to help out! I can also help contribute to it as well
Also I succeeded in compiling for 3.7 and running the
sysconfig.get_config_var(LDVERSION)on the target for 3.7 it returned3.7mand when running with 3.8 it returned3.8. However I think your merge request helps because the issue on the target was the fact that I was linking againstlibpython3.8.sowhile the only object that was copied to the target waslibpython3.8m.so.Thats really interesting because i am compiling against 3.8. and both the ‘m’ version and normal versions are available. Ive tried linking against both and only the ‘m’ version works at runtime. If i link against the normal version i get the
symbol not founderror at runtimeI am curious to try compiling against 3.7 now. I’ll update you when I have