Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross uses wrong ar when cross compiling ring on M1 Mac #1269

Closed
4 of 11 tasks
jwalton opened this issue May 29, 2023 · 4 comments
Closed
4 of 11 tasks

Cross uses wrong ar when cross compiling ring on M1 Mac #1269

jwalton opened this issue May 29, 2023 · 4 comments

Comments

@jwalton
Copy link

jwalton commented May 29, 2023

Checklist

Describe your issue

When cross-compiling to musl on M1 mac, cross tries to run musl-ar instead of just ar, but musl-ar isn't in the PATH for the build image.

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

i586-unknown-linux-musl

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

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

cross 0.2.5

Example

$ cargo new bug
$ cd bug
$ cargo add ring
$ CROSS_CONTAINER_OPTS="--platform linux/amd64" cross build --release --target x86_64-unknown-linux-musl

--snip--

  error occurred: Command ZERO_AR_DATE="1" "musl-ar" "cq" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/libring-core.a" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/aesni-x86_64-elf.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/vpaes-x86_64-elf.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/x86_64-mont-elf.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/x86_64-mont5-elf.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/chacha-x86_64-elf.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/p256-x86_64-asm-elf.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/aesni-gcm-x86_64-elf.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/ghash-x86_64-elf.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/sha512-x86_64-elf.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/chacha20_poly1305_x86_64-elf.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/sha256-x86_64-elf.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/aes_nohw.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/montgomery.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/montgomery_inv.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/limbs.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/mem.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/poly1305.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/crypto.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/curve25519.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/ecp_nistz.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/ecp_nistz256.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/gfp_p256.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/gfp_p384.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/cpu-intel.o" "/target/x86_64-unknown-linux-musl/release/build/ring-ecebd54999486096/out/poly1305_vec.o" with args "musl-ar" did not execute successfully (status code exit status: 127).

Additional information / notes

No response

@jwalton
Copy link
Author

jwalton commented May 29, 2023

Possibly related to #1100?

@Emilgardis
Copy link
Member

Emilgardis commented May 29, 2023

ring is using the wrong ar, try setting these env vars

TARGET_AR=i586-linux-musl-ar
TARGET_CC=i586-linux-musl-gcc

so

# Cross.toml
[target.i586-unknown-linux-musl]
env.passthrough = ["TARGET_CC=i586-linux-musl-gcc", "TARGET_AR=i586-linux-musl-ar"]

@jwalton
Copy link
Author

jwalton commented May 29, 2023

This fixed it for me! Thanks!

@jwalton jwalton closed this as completed May 29, 2023
@Emilgardis
Copy link
Member

Awesome! In the newer images we've added these envvars so it should be solved if you use cross from main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants