Cross Compiling a Rust project that uses crate inline-python

So, inside a rust project that I'm working on, we are using some python code(libraries) for functions that are not particularly compute heavy, but would require rather large amounts of code to implement. Unfortunately there are no crates that handle this particular work, and python had a library that was perfectly suited to these subtasks.

I believe I have narrowed down the problem to the need for a compiled python interpreter for the target architecture (based on: https://pyo3.rs/v0.9.2/building_and_distribution.html)
However, I am utterly unsure of how to get this .so file for each of the various targets or where to put it once it has been created. To add some context this is the --verbose part of the error when running

cargo build --target=aarch64-linux-android --verbose
note: clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
          ld: unknown option: --as-needed
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: could not compile 'project_name'
Caused by:
  process didn't exit successfully: `rustc --crate-name calc_w1_fin --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=cc55d6a1e9a83fee -C extra-filename=-cc55d6a1e9a83fee --out-dir /Users/me/Documents/GitHub/esoteric_nonsense/target/aarch64-linux-android/debug/deps --target aarch64-linux-android -C incremental=/Users/me/Documents/GitHub/esoteric_nonsense/target/aarch64-linux-android/debug/incremental -L dependency=/Users/me/Documents/GitHub/esoteric_nonsense/target/aarch64-linux-android/debug/deps -L dependency=/Users/me/Documents/GitHub/esoteric_nonsense/target/debug/deps --extern inline_python=/Users/me/Documents/GitHub/esoteric_nonsense/target/aarch64-linux-android/debug/deps/libinline_python-d43f23b87cd7df7e.rlib -L 'native=/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib'` (exit code: 1)
warning: build failed, waiting for other jobs to finish...
error: build failed

The full error is several hundred lines long, so I have abbreviated it.

Note, this project compiles and works completely on the host system, which obviously has python@3.9 installed

Hi @OldMold; a PyO3 maintainer here.

Our cross-compiling story is continually improving over time, though as you note, our guide still lacks detail in this area.

This seems like a great opportunity to improve the situation so that it works for you and others in the future. Can you please open an issue on the PyO3 issue tracker listing the exact targets you want to support? We can then continue the conversation there.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.