cross-rs / cross

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

Darwin+Podman: Unable to cross-compile #1583

Open skittishdev opened 1 day ago

skittishdev commented 1 day ago

Checklist

Describe your issue

cross doesn't work when I try to use it with podman (even if I set the CROSS_CONTAINER_ENGINE=podman env variable) on my Mac/M2. But the same project cross compiles successfully with docker.

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 (4090bec 2024-10-15)

Example

I have both docker and podman installed on my Mac. My Docker Desktop application is not running.

ps -ef | grep docker
  503 68715 69102   0  5:05PM ttys007    0:00.00 grep docker
podman machine init --cpus=8 --disk-size=64 --memory=24576 foo
podman machine start foo
CROSS_CONTAINER_ENGINE=podman cross build --target aarch64-unknown-linux-gnu --release

This results in an error like so:

Error: 
   0: /proc/self/mountinfo is unavailable when target_os != linux

Location:
   src/docker/shared.rs:1354

Additional information / notes

Cross works just fine with Docker. The command below results in a successful build when my Docker Desktop application is running in the background.

cross build --target aarch64-unknown-linux-gnu --release

I installed cross as specified in the docs: https://github.com/cross-rs/cross/blob/main/docs/getting-started.md#installing-cross-1

skittishdev commented 1 day ago

Podman info (if needed)

$ podman version
Client:       Podman Engine
Version:      5.2.5
API Version:  5.2.5
Go Version:   go1.23.2
Git Commit:   10c5aa720d59480bc7edad347c1f5d5b75d4424f
Built:        Fri Oct 18 07:51:48 2024
OS/Arch:      darwin/arm64

Server:       Podman Engine
Version:      5.2.5
API Version:  5.2.5
Go Version:   go1.22.7
Built:        Thu Oct 17 17:00:00 2024
OS/Arch:      linux/arm64
Emilgardis commented 1 day ago

This was changed in #1485 and there some assumption done there that is incorrect for podman in the rest of the application logic. Should be an easy fix once located why it happens