-
Couldn't load subscription status.
- Fork 427
Description
Checklist
- I've looked through the issues and pull requests for similar reports
Describe your issue
When attempting to cross-compile for an aarch64 target on a native arm64 Apple Silicon Mac, cross ignores the custom aarch64 image specified in Cross.toml and defaults to using an x86_64 workflow, which then fails under emulation.
However, a manual cargo build run inside the custom container succeeds, potentially pointing to a bug in cross.
System Information:
- Host OS: macOS Apple Silicon (
aarch64) - Docker Environment: Colima or OrbStack (both tested)
- Docker Daemon Architecture:
aarch64 - Target:
aarch64-unknown-linux-gnu crossversion: 0.2.5
Example
Reproduction Steps
-
On an Apple Silicon Mac, start the
aarch64Docker environment (e.g.,colima start --arch aarch64). -
Create a new, minimal Rust library.
cargo new --lib minimal-test && cd minimal-test
-
In the
minimal-testdirectory, create theDockerfile.FROM arm64v8/ubuntu:24.04 ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y \ build-essential \ gcc-aarch64-linux-gnu \ libc6-dev-arm64-cross
-
Build the custom Docker image.
docker-buildx build -t minimal-test:latest . -
In the same directory, create the
Cross.tomlfile.[target.aarch64-unknown-linux-gnu] image = "minimal-test:latest"
-
Run the build using
cross, this command will fail.cross build --target aarch64-unknown-linux-gnu
Expected Behavior
cross should read the Cross.toml file, use the custom minimal-test:latest container, and successfully compile the project.
Actual Behavior
cross ignores the Cross.toml file and fails with an error indicating it's using an x86_64 workflow.
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
Additional Context: Manual cargo build Succeeds
A manual cargo build inside the custom container succeeds.
-
Get a Shell Inside the Custom Container:
docker run --rm -it -v "$(pwd)":/project -w /project minimal-test:latest /bin/bash -
Run
cargo buildManually: Inside the container's shell, install a Rust toolchain and run the build. This command succeeds.apt-get update && apt-get install -y curl curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y source "$HOME/.cargo/env" cargo build --target aarch64-unknown-linux-gnu
History and Previous Triage
This report is a follow-up to my original issue (#1714), to which a suggestion was made to provide a custom image. Nonetheless, even when a user provides their own custom aarch64 image (as is the recommended workaround), the cross build command still fails. The failure seems to be isolated to the cross executable, as illustrated by the successful manual cargo build inside the container.