cross-rs / cross

“Zero setup” cross compilation and “cross testing” of Rust crates
Apache License 2.0
6.79k stars 379 forks source link

no image found in image index for architecture "arm64", variant "v8", OS "linux" #1555

Closed Coosis closed 2 months ago

Coosis commented 2 months ago

Checklist

Describe your issue

I have a simple rust project on aarch64-darwin, targeting arm64 raspberryPi 4B. I have installed cross using cargo, I have added aarch64-unknown-linux-gnu as target via rustup, I have podman installed. I did a cross build --target aarch64-unknown-linux-gnu, here's the output:

[15:06:23] $ cross build --target aarch64-unknown-linux-gnu
Trying to pull ghcr.io/cross-rs/aarch64-unknown-linux-gnu:0.2.5...
Error: choosing an image from manifest list docker://ghcr.io/cross-rs/aarch64-unknown-linux-gnu:0.2.5: no image found in image index for architecture "arm64", variant "v8", OS "linux"

What target(s) are you cross-compiling for?

aarch64-unknown-linux-gnu

Which operating system is the host (e.g computer cross is on) running?

What architecture is the host?

What container engine is cross using?

cross version

cross 0.2.5

Example

[15:06:23] $ cross build --target aarch64-unknown-linux-gnu
Trying to pull ghcr.io/cross-rs/aarch64-unknown-linux-gnu:0.2.5...
Error: choosing an image from manifest list docker://ghcr.io/cross-rs/aarch64-unknown-linux-gnu:0.2.5: no image found in image index for architecture "arm64", variant "v8", OS "linux"

Additional information / notes

No response

Coosis commented 2 months ago

Sorry, my bad. Figured it out: You have to pass in the podman flag --platform=linux/amd64 or --arch=amd64, tweak for your own requirements. Based on Configuring cross with environment variables, you can pass flags to the container engine. You can do: CROSS_CONTAINER_OPTS=--platform=linux/amd64 cross build --target aarch64-unknown-linux-gnu Basically, if you fail during a build and it's image not found, inspect the url(in my case it's docker://ghcr.io/cross-rs/aarch64-unknown-linux-gnu:0.2.5) for supported platform, and do the environment variable.

If you use nix, you can simply set up shell hook in flake.nix for this.

Emilgardis commented 2 months ago

See also https://github.com/cross-rs/cross/issues/1214 where this has been discussed before