Skip to content

Bug: cross on aarch64 macOS ignores custom image in Cross.toml, defaults to faulty x86_64 workflow #1716

@geofflittle

Description

@geofflittle

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
  • cross version: 0.2.5

Example

Reproduction Steps

  1. On an Apple Silicon Mac, start the aarch64 Docker environment (e.g., colima start --arch aarch64).

  2. Create a new, minimal Rust library.

    cargo new --lib minimal-test && cd minimal-test
  3. In the minimal-test directory, create the Dockerfile.

    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
  4. Build the custom Docker image.

    docker-buildx build -t minimal-test:latest .
  5. In the same directory, create the Cross.toml file.

    [target.aarch64-unknown-linux-gnu]
    image = "minimal-test:latest"
  6. 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.

  1. Get a Shell Inside the Custom Container:

    docker run --rm -it -v "$(pwd)":/project -w /project minimal-test:latest /bin/bash
  2. Run cargo build Manually: 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions