clux/muslrust

must-ar not executing successfully while building ring

szinn opened this issue · 6 comments

szinn commented

Running on Mac M1

Commandline:
docker run -v $PWD:/volume --rm -t clux/muslrust:stable cargo build --release

error: failed to run custom build command for ring v0.16.20

Caused by:
process didn't exit successfully: /volume/target/release/build/ring-c0a105218b2127e9/build-script-build (exit status: 1)

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

It did run on x86 linux box, so could just be an M1 issue with Docker.

clux commented

Possibly, have not tested much on arm yet.

You could try passing -v to the cargo build in the container and see if something more useful pops out.

Getting the same issue, only happens on M1

bmo-at commented

Did anyone find a workaround for this? I have to make builds possible on M1/M2 hardware...

workaround

This should be an issue of Docker on Apple Silicon, not this docker image.

I solved the issue by using lima. The lima base image should be x86_64 beucase I had the same issue when using arch: "aarch64" in lima. I installed docker by How To Install and Use Docker on Ubuntu 22.04 | DigitalOcean.

arch: "x86_64"

images:
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20240126/ubuntu-22.04-server-cloudimg-amd64.img"
  arch: "x86_64"
  digest: "sha256:9f8a0d84b81a1d481aafca2337cb9f0c1fdf697239ac488177cf29c97d706c25"

mounts:
- location: "~"
- location: "/tmp/lima"
  writable: true

https://lima-vm.io/docs/config/multi-arch/

My workaround was to swap out and upgrade dependencies so as not to rely on ring. Latest releases of rustls use aws-lc-rc instead of ring by default