Skip to content
This repository was archived by the owner on Nov 9, 2025. It is now read-only.

Conversation

Copy link

Copilot AI commented Nov 7, 2025

Fix PyO3 cross-compilation issue for aarch64 binary builds

Problem:
The cross-compilation build for aarch64-unknown-linux-gnu target fails with "no Python 3.x interpreter found" error, even though PYO3_NO_PYTHON=1 is set. This happens because the project has both a Python extension module (cdylib) and a standalone binary, but PyO3 dependencies are always included even when building only the binary.

Solution Plan:

  • Analyze the issue and identify root cause
  • Make PyO3 dependencies optional using Cargo features
  • Create a python-extension feature flag
  • Configure lib.rs to require the feature
  • Update workflow to build binary without PyO3 feature
  • Test the build locally
  • Verify complete build process
Original prompt

一而再再而三的犯相同错误,请你Run cross build --bin rmm --release --target aarch64-unknown-linux-gnu
cross build --bin rmm --release --target aarch64-unknown-linux-gnu
shell: /usr/bin/bash -e {0}
env:
CARGO_HOME: /home/runner/.cargo
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
PYO3_NO_PYTHON: 1
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'

stable-x86_64-unknown-linux-gnu unchanged - rustc 1.91.0 (f8297e351 2025-10-28)

info: downloading component 'rust-src'
info: installing component 'rust-src'
Unable to find image 'ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main' locally
main: Pulling from cross-rs/aarch64-unknown-linux-gnu
13b7e930469f: Already exists
95c03b590ba5: Pulling fs layer
4032e298dfa7: Pulling fs layer
f95be9d81026: Pulling fs layer
5388263d2757: Pulling fs layer
5c55577d583a: Pulling fs layer
1df210121449: Pulling fs layer
65153096ae1e: Pulling fs layer
b1cdb46abc7b: Pulling fs layer
e7710502a16d: Pulling fs layer
9062befda244: Pulling fs layer
34c6b57bdcfe: Pulling fs layer
ba76f0fd8172: Pulling fs layer
e4fb9dc53e71: Pulling fs layer
61680dc25951: Pulling fs layer
087cfbda1bf9: Pulling fs layer
d55d9ada39b4: Pulling fs layer
4ac9fb53dff2: Pulling fs layer
11737bb648a7: Pulling fs layer
5c55577d583a: Waiting
1df210121449: Waiting
65153096ae1e: Waiting
b1cdb46abc7b: Waiting
5388263d2757: Waiting
e7710502a16d: Waiting
9062befda244: Waiting
087cfbda1bf9: Waiting
34c6b57bdcfe: Waiting
d55d9ada39b4: Waiting
ba76f0fd8172: Waiting
4ac9fb53dff2: Waiting
e4fb9dc53e71: Waiting
11737bb648a7: Waiting
f95be9d81026: Verifying Checksum
f95be9d81026: Download complete
95c03b590ba5: Verifying Checksum
95c03b590ba5: Download complete
95c03b590ba5: Pull complete
5c55577d583a: Verifying Checksum
5c55577d583a: Download complete
5388263d2757: Verifying Checksum
5388263d2757: Download complete
1df210121449: Verifying Checksum
1df210121449: Download complete
b1cdb46abc7b: Verifying Checksum
b1cdb46abc7b: Download complete
e7710502a16d: Verifying Checksum
e7710502a16d: Download complete
9062befda244: Verifying Checksum
9062befda244: Download complete
65153096ae1e: Verifying Checksum
65153096ae1e: Download complete
ba76f0fd8172: Verifying Checksum
ba76f0fd8172: Download complete
e4fb9dc53e71: Verifying Checksum
e4fb9dc53e71: Download complete
61680dc25951: Download complete
087cfbda1bf9: Verifying Checksum
087cfbda1bf9: Download complete
d55d9ada39b4: Verifying Checksum
d55d9ada39b4: Download complete
4ac9fb53dff2: Verifying Checksum
4ac9fb53dff2: Download complete
11737bb648a7: Download complete
4032e298dfa7: Verifying Checksum
4032e298dfa7: Download complete
34c6b57bdcfe: Verifying Checksum
34c6b57bdcfe: Download complete
4032e298dfa7: Pull complete
f95be9d81026: Pull complete
5388263d2757: Pull complete
5c55577d583a: Pull complete
1df210121449: Pull complete
65153096ae1e: Pull complete
b1cdb46abc7b: Pull complete
e7710502a16d: Pull complete
9062befda244: Pull complete
34c6b57bdcfe: Pull complete
ba76f0fd8172: Pull complete
e4fb9dc53e71: Pull complete
61680dc25951: Pull complete
087cfbda1bf9: Pull complete
d55d9ada39b4: Pull complete
4ac9fb53dff2: Pull complete
11737bb648a7: Pull complete
Digest: sha256:a97f6370889c59f9b3d2ef8be5eeadfede8e4b0b31da53bc421f235244d09038
Status: Downloaded newer image for ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main
Compiling libc v0.2.172
Compiling proc-macro2 v1.0.95
Compiling unicode-ident v1.0.18
Compiling shlex v1.3.0
Compiling pkg-config v0.3.32
Compiling cfg-if v1.0.1
Compiling stable_deref_trait v1.2.0
Compiling target-lexicon v0.13.2
Compiling quote v1.0.40
Compiling version_check v0.9.5
Compiling syn v2.0.102
Compiling jobserver v0.1.33
Compiling typenum v1.18.0
Compiling cc v1.2.26
Compiling generic-array v0.14.7
Compiling pyo3-build-config v0.26.0
error: failed to run custom build command for pyo3-build-config v0.26.0

Caused by:
process didn't exit successfully: /target/release/build/pyo3-build-config-64875cbe5ab60d38/build-script-build (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=PYO3_CONFIG_FILE
cargo:rerun-if-env-changed=PYO3_NO_PYTHON
cargo:rerun-if-env-changed=PYO3_ENVIRONMENT_SIGNATURE
cargo:rerun-if-env-changed=PYO3_PYTHON
cargo:rerun-if-env-changed=VIRTUAL_ENV
cargo:rerun-if-env-changed=CONDA_PREFIX
cargo:rerun-if-env-changed=PATH

--- stderr
error: no Python 3.x interpreter found
warning: build failed, waiting for other jobs to finish...
Error: Process completed with exit code 101.}

修正后,进行完备的验证!


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants