rust-cross / rust-musl-cross Goto Github PK
View Code? Open in Web Editor NEWDocker images for compiling static Rust binaries using musl-cross
License: MIT License
Docker images for compiling static Rust binaries using musl-cross
License: MIT License
Thanks for your work on this. A very usefull docker image to build musl target.
But recently, I find that messense/rust-musl-cross:x86_64-musl
is not x86_64-unknown-linux-musl
target. It shows x86_64-unknown-linux-gun
in my wsl2 kali roling linux.
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).
Thank you for your great toolchain, which helps me a lot.
I'm trying to build a static library for aarch64-unknown-linux-musl
on a M1 Max MBP (aarch64).
I wrote a Dockerfile to add alsa as a static library to your image:
# musl-alsa.Dockerfile
FROM messense/rust-musl-cross:aarch64-musl-arm64
RUN VERS=1.2.8 \
&& cd /home/rust/libs \
&& curl -LO https://www.alsa-project.org/files/pub/lib/alsa-lib-${VERS}.tar.bz2 \
&& tar xf alsa-lib-${VERS}.tar.bz2 && cd alsa-lib-${VERS} \
&& CC=${TARGET_CC} \
./configure --enable-shared=no --enable-static=yes \
--prefix=${TARGET_HOME} \
--host=${RUST_MUSL_CROSS_TARGET} \
&& make && make install \
&& cd .. && rm -rf alsa-lib-${VERS}.tar.bz2 alsa-lib-${VERS} \
&& apt-get update && apt-get install -y pkg-config
and tried to build an example in cpal, which is an audio library and requires alsa:
# build an image
docker build -t musl-alsa - < musl-alsa.Dockerfile
# try to build cpal
git clone [email protected]:RustAudio/cpal.git && cd cpal
docker run --rm -it -v "$(pwd)":/home/rust/src musl-alsa cargo build --example beep
and failed:
error: linking with `aarch64-unknown-linux-musl-gcc` failed: exit status: 1
|
= note: "aarch64-unknown-linux-musl-gcc" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crt1.o" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crti.o" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtbegin.o" "/tmp/rustcB1I7n5/symbols.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.108vka1lx9z939zw.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.11hy0qxyieu6sf6x.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.14gsuimjq40cqfy7.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.14hd1whr1lexkem3.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.18q3q130k14z6d7a.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.1d7u6a4rehdzxi5a.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.1eslah81kcnp5ygp.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.1gi44auxcslgo407.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.1i2r1xe639yr107m.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.1j8v81kzqt3dnhjt.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.1ldodtyf98wyvzz2.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.1m3fji6lineswyt8.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.1nl8d5mqq2hjlip4.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.1qcecuow3k26n7vz.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.1rrtoz4gghcyiqwe.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.1sozhwarfc8gap4b.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.1tbte3xbpmo7o97m.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.1uyrhf26n9lo4uvq.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.1xqmx1skdy09z0ud.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.20joj5dyz2166zt5.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.20rq8t0uhpjwt4lg.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.21bj8xal9rkf0w48.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.22ti6rk3psfzwt05.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.2a0xjkm038d44uhc.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.2b4gbbkdizr01wy8.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.2dtw9sba8xmc6o1q.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.2e9fyl9pcj9i53y8.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.2fsnq78zvidu8qve.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.2g20wicttmo2pbjt.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.2h8crp2akdqnsmwo.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.2h93difhuamoa4s6.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.2hcrfqwuogf7wt7g.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.2hmdb5j0q83jlo7c.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.2nco61kagrn609xv.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.2nkm0srxcidqyhdw.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.2r7fgt9s7p777we8.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.2zhrhgl330u6mtzr.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3452r73mt4wkqx5l.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.34830lfv7f3na5ek.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.35fobi47cds8mjey.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.38rdut6pli0pncq.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3bfugphoxzfi7yiu.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3cp84615finy20zh.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3f85vudkerb6rvb9.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3frbzb8qhureywyj.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3gltyhsselt8s4oj.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3ho225qbaq4v94rn.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3jgy17nkjd2h372j.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3kw6403hxrmglrtn.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3lzcysqxq8z3kxx6.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3ncy2tcg787wjf9g.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3ng3pp8ra35rqg4k.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3o161qjclryoc0ul.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3q32bc8yn5w2bqua.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3ur5misjvtq875gc.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.3zeb3o5btocep9of.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4230aeb3bz6pz01h.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.44j5f401o08qn4ry.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.46c6h60zy2al37q4.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.46rfspofdbe4q1hf.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.47l3mtosh73fwjr9.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4ber539yb2xuiaey.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4bfnn26cxy5wxk08.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4dcjts2dmqpzna1y.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4ddmezs6t2goorhc.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4fpm5wpqfwxbg8t8.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4gsnfbtum2wia7ot.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4hi8lvtkcb6osrh7.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4iz0g5co1yezbftd.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4osf5nekbo03y9pa.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4pckyrnv723mu2px.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4pd76ve8ij1ht6ex.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4qd5igszqm91qjo9.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4tm0b6jq7mqsd3fs.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4ubn4g3fm02knlpu.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4uceplwxbff7qnfc.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4w3khxovfdf9lmfh.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4xnrey424hgs14z0.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4zprl41vaiss4j7y.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.4zra01lj1zlps0ho.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.50kz4llmvbgz9162.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.518v2moad5b0b76r.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.52s9zo5ppqwwt2hz.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.53n9xgfqx3f2jquq.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.545l8nsglcpew0y.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.58sh95y6ydix35zo.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.5dmoiqkpi0bo9wa5.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.6tbdercwy76qfax.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.870uz6fdud0pbpe.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.bvgxlnuyu3uig0f.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.cs4ideqy7hlzqnl.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.ei59hot1o2emql0.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.far4tnjrvwb1jdl.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.gbhfnd89ep6zes5.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.o8p6vnagadlobxb.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.o9k0usxdvefau73.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.pc8nmop3ncgtlml.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.qrtfko0mchbdbvu.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.sokp3ea4ip27om9.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.v4lxv6rqds5w5tl.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.vfcoc02kkrut1pb.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.w4emfa9x43i0fe8.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.wbru9bu1gs5g72k.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.ya86o7q5oc4fp8i.rcgu.o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3.43n7fqotntfvgsxr.rcgu.o" "-Wl,--as-needed" "-L" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps" "-L" "/home/rust/src/target/debug/deps" "-L" "/usr/local/musl/aarch64-unknown-linux-musl/usr/local/musl/aarch64-unknown-linux-musl/lib" "-L" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libcpal-7cbbcd6b7a4eead0.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libdasp_sample-e81868081767a32c.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libparking_lot-45292223d31a8683.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libparking_lot_core-fb2de2510fcb534f.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libsmallvec-bd66671ab1d2a2f1.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/liblock_api-dd53ba72c6f47ee9.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libscopeguard-85a8fbf82dd1dc62.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libalsa-3225b0ed1383dfee.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libnix-a6a6637dd7f1d051.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libcfg_if-25271fe0908a4854.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libalsa_sys-48f039910235507d.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libclap-5432ef0d6c3ee7e0.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libstrsim-82004923065d5417.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libis_terminal-2646d8fe700a54dc.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/librustix-ae635a5384a0f1d2.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/liblinux_raw_sys-8aa1b6a7ae5c681b.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libio_lifetimes-de6c3917e548a209.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/liblibc-cc69a03504911d85.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libclap_lex-64f7a6618da31468.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libos_str_bytes-d8f17c4ab8e1753d.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libtermcolor-bf42a4a6473fe304.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libbitflags-91833317a9890754.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libonce_cell-2120e4427f5e651b.rlib" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/deps/libanyhow-67ee4143d891e230.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libstd-ba05123e4e4ced22.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libpanic_unwind-b6a6af180fad3c33.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libobject-a12966f4c21157e3.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libmemchr-7cee88ae89edb258.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libaddr2line-0950c2f2547c6d2f.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libgimli-034a711b30de602d.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/librustc_demangle-1712a56b96360282.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libstd_detect-108e3aeeb669714c.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libhashbrown-36d90ada07fcb915.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libminiz_oxide-bc5ce7faad390a96.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libadler-3ca09e4be01fcd26.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/librustc_std_workspace_alloc-de78900f22438d3b.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libunwind-cf1c4a0090ffea18.rlib" "-lunwind" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libcfg_if-d55267804830a56d.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/liblibc-758ae7cefe1ddec6.rlib" "-lc" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/liballoc-97a40686aafc00b1.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/librustc_std_workspace_core-bf52e105815d22ab.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libcore-28fd2826f395d402.rlib" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libcompiler_builtins-e3b27fe090a69036.rlib" "-Wl,-Bdynamic" "-lasound" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-nostartfiles" "-L" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib" "-L" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained" "-o" "/home/rust/src/target/aarch64-unknown-linux-musl/debug/examples/beep-44a41a301007bbb3" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtend.o" "/root/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtn.o"
= note: /usr/local/musl/bin/../lib/gcc/aarch64-unknown-linux-musl/9.2.0/../../../../aarch64-unknown-linux-musl/bin/ld: /usr/local/musl/bin/../lib/gcc/aarch64-unknown-linux-musl/9.2.0/../../../../aarch64-unknown-linux-musl/lib/libasound.a(shmarea.o): in function `snd_shm_area_destroy':
/home/rust/libs/alsa-lib-1.2.8/src/shmarea.c:100: undefined reference to `shmdt'
/usr/local/musl/bin/../lib/gcc/aarch64-unknown-linux-musl/9.2.0/../../../../aarch64-unknown-linux-musl/bin/ld: /usr/local/musl/bin/../lib/gcc/aarch64-unknown-linux-musl/9.2.0/../../../../aarch64-unknown-linux-musl/lib/libasound.a(shmarea.o): in function `snd_shm_area_destructor':
/home/rust/libs/alsa-lib-1.2.8/src/shmarea.c:114: undefined reference to `shmdt'
/usr/local/musl/bin/../lib/gcc/aarch64-unknown-linux-musl/9.2.0/../../../../aarch64-unknown-linux-musl/bin/ld: /usr/local/musl/bin/../lib/gcc/aarch64-unknown-linux-musl/9.2.0/../../../../aarch64-unknown-linux-musl/lib/libasound.a(control_hw.o): in function `snd_ctl_hw_open':
/home/rust/libs/alsa-lib-1.2.8/src/control/control_hw.c:413: undefined reference to `sprintf'
# too long
/usr/local/musl/bin/../lib/gcc/aarch64-unknown-linux-musl/9.2.0/../../../../aarch64-unknown-linux-musl/bin/ld: /usr/local/musl/bin/../lib/gcc/aarch64-unknown-linux-musl/9.2.0/../../../../aarch64-unknown-linux-musl/lib/libasound.a(pcm_direct.o): in function `snd_pcm_direct_semaphore_down':
/home/rust/libs/alsa-lib-1.2.8/src/pcm/pcm_direct.h:289: undefined reference to `semop'
/usr/local/musl/bin/../lib/gcc/aarch64-unknown-linux-musl/9.2.0/../../../../aarch64-unknown-linux-musl/bin/ld: /usr/local/musl/bin/../lib/gcc/aarch64-unknown-linux-musl/9.2.0/../../../../aarch64-unknown-linux-musl/lib/libasound.a(pcm_direct.o): in function `snd_pcm_direct_semaphore_discard':
/home/rust/libs/alsa-lib-1.2.8/src/pcm/pcm_direct.h:279: undefined reference to `semctl'
/usr/local/musl/bin/../lib/gcc/aarch64-unknown-linux-musl/9.2.0/../../../../aarch64-unknown-linux-musl/bin/ld: /usr/local/musl/bin/../lib/gcc/aarch64-unknown-linux-musl/9.2.0/../../../../aarch64-unknown-linux-musl/lib/libasound.a(pcm_direct.o): in function `snd_pcm_direct_semaphore_up':
/home/rust/libs/alsa-lib-1.2.8/src/pcm/pcm_direct.h:300: undefined reference to `semop'
collect2: error: ld returned 1 exit status
= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)
error: could not compile `cpal` due to previous error
It looks the linker failed to work with shmdt
, sprintf
, etc.
Is it because I gave wrong linker configs, or because these are not available in the musl C library? I'd be glad if you could help me.
@messense is there any plan to add prebuild image of arm32v7 rust-musl-cross in the future?
I came across your docker image while trying to cross compile a rust source to target armv6, it got all the binaries I need. However due to my project requirements and some constraint on my work PC, I can only run my build on a Raspberry Pi 4 with 32bit OS. The prebuilt images available are only for arm64 and amd64 according to the repo on docker hub.
Currently I'm working around this limitation by using official rust arm32v7 image and run make install
for musl-cross-make on the image. It would be great if you can add arm32v7 prebuilt image as it will result in lesser complexity of my Dockerfile for my project.
Thank you in advance.
Hello, thanks for a great work making sure these images so easy to use.
Is it possible to redeploy them to docker hub to allow to pickup latest Rust (1.70.0 as of this writing)?
It would be awesome to also link postgres, sqlite and mysql and other libraries statically so I can build a docker image that only contains the app itself. You can inspire yourself here https://github.com/BlackDex/rust-musl
Hi, here is a solution how to enable caching if sb is interested:
You need to just mount a registry:
-v "$(pwd)"/target/armv7-unknown-linux-musleabihf/musl-builder/cargo-cache:/root/.cargo/registry`
Full example from ~/.zshrc
if you use bash you should put it to ~/.bashrc
rust-musl-builder-armv7() { docker run --rm -it -v "$(pwd)"/target/armv7-unknown-linux-musleabihf/musl-builder/cargo-cache:/root/.cargo/registry -v "$(pwd)":/home/rust/src messense/rust-musl-cross:armv7-musleabihf "$@" }
It would be nice to add info about cache to README
I am wondering why this images are so big:
For example I think we don't need this:
rm -rf /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/
root@8340dacc30e8:~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu# du -skh *
48M bin
16K etc
570M lib
237M share
Next question is here, maybe there are libs we don't need (and never need for musl target)?:
root@8340dacc30e8:~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib# du -skh *
4.0K components
48K etc
4.0K manifest-cargo-x86_64-unknown-linux-gnu
4.0K manifest-rust-docs-x86_64-unknown-linux-gnu
8.0K manifest-rust-std-x86_64-unknown-linux-gnu
4.0K manifest-rust-std-x86_64-unknown-linux-musl
4.0K manifest-rustc-x86_64-unknown-linux-gnu
260K multirust-channel-manifest.toml
4.0K multirust-config.toml
4.0K rust-installer-version
405M x86_64-unknown-linux-gnu
85M x86_64-unknown-linux-musl
Hi, I'm sorry if this is not the right place to ask, but my application depends on libpulse-sys and causes the following error when I try to build it in the container. I understand that getting host system's libraries to link is not trivial, but I wonder if you can just compile and provide a cross-compiling pkg-config?
The following warnings were emitted during compilation:
warning: pkg-config has not been configured to support cross-compilation.
error: failed to run custom build command for `libpulse-sys v1.18.0`
Caused by:
process didn't exit successfully: `/home/rust/src/target/release/build/libpulse-sys-0b539a63b06ecfcd/build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-env-changed=LIBPULSE_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=LIBPULSE_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:warning=pkg-config has not been configured to support cross-compilation.
Install a sysroot for the target platform and configure it via
PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
cross-compiling wrapper for pkg-config and set it via
PKG_CONFIG environment variable.
warning: build failed, waiting for other jobs to finish...
error: build failed
Rust 1.64.0 was released a couple of weeks ago. Do you mind publishing new images to support that version? ๐
I would be awesome if cargo-deb is available into the image https://github.com/kornelski/cargo-deb
= note: /usr/local/musl/bin/../lib/gcc/s390x-unknown-linux-musl/9.2.0/../../../../s390x-unknown-linux-musl/bin/ld: /home/rust/src/target/s390x-unknown-linux-musl/debug/deps/libopenssl_sys-70172c64409e3e90.rlib(curve448.o): in function `recode_wnaf':
/home/rust/src/target/s390x-unknown-linux-musl/debug/build/openssl-sys-1de3ca3326f5bf22/out/openssl-build/build/src/crypto/ec/curve448/curve448.c:575: undefined reference to `__ctzdi2'
/usr/local/musl/bin/../lib/gcc/s390x-unknown-linux-musl/9.2.0/../../../../s390x-unknown-linux-musl/bin/ld: read-only segment has dynamic relocations
collect2: error: ld returned 1 exit status
Hmm, not sure what's going on.
Originally posted by @messense in #62 (comment)
I want to build the plotters example in x86_64-musl.
I did these commands.
git clone https://github.com/plotters-rs/plotters.git --recursive
cd plotters
docker run --rm -it -v `pwd`:/home/rust/src messense/rust-musl-cross:x86_64-musl
# in the container.
cd plotters
RUST_BACKTRACE=1 cargo run --example histogram
And I got errors.
error: failed to run custom build command for `yeslogic-fontconfig-sys v3.2.0`
Caused by:
process didn't exit successfully: `/home/rust/src/target/debug/build/yeslogic-fontconfig-sys-cac8f25c1297fba5/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=RUST_FONTCONFIG_DLOPEN
cargo:rerun-if-env-changed=FONTCONFIG_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "pkg-config has not been configured to support cross-compilation.\n\nInstall a sysroot for the target platform and configure it via\nPKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\ncross-compiling wrapper for pkg-config and set it via\nPKG_CONFIG environment variable."', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/yeslogic-fontconfig-sys-3.2.0/build.rs:8:48
stack backtrace:
0: rust_begin_unwind
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
2: core::result::unwrap_failed
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1785:5
3: core::result::Result<T,E>::unwrap
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1078:23
4: build_script_build::main
at ./build.rs:8:9
5: core::ops::function::FnOnce::call_once
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
warning: build failed, waiting for other jobs to finish...
It seems to be a problem with the configuration around pkg-config.
Sorry if this is not appropriate as an issue.
Is this a problem with messense/rust-musl-cross:x86_64-musl ?
Or should I create a properly configured Docker container based on messense/rust-musl-cross:x86_64-musl ?
Hi,
I'm compiling an app with your docker image. I suddenly get this:
= note: /usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: can not size stub section: No such file or directory
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: BFD (GNU Binutils) 2.33.1 assertion fail ../../src_binutils/bfd/elf32-arm.c:5169
/usr/local/musl/bin/../lib/gcc/armv7-unknown-linux-musleabihf/11.2.0/../../../../armv7-unknown-linux-musleabihf/bin/ld: final link failed: No such file or directory
collect2: error: ld returned 1 exit status
docker run --rm -it -v "$(pwd)":/home/rust/src messense/rust-musl-cross:x86_64-musl cargo build --release
process didn't exit successfully:
/home/rust/src/target/release/build/librocksdb-sys-801fddabdbc09a61/build-script-build(exit status: 101) --- stderr /usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found thread 'main' panicked at 'unable to generate rocksdb bindings: ClangDiagnostic("/usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found\n")', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/librocksdb-sys-0.11.0+8.1.1/build.rs:40:10 note: run with
RUST_BACKTRACE=1environment variable to display a backtrace warning: build failed, waiting for other jobs to finish...
but it success in
docker run --rm -it -v "$(pwd)":/home/rust/src messense/rust-musl-cross:aarch64-musl cargo build --release
The following error appears when I start the compilation:
error linking with `armv7-unknown-l.txt
The project builds without a problem in a native environment. Only the docker images suddenly don't work.
Hello, great job. Question, this crate aims to be "inspired by rust-musl-builder" but I didn't see an option to build Diesel/postgress-based apps which is quite the point of emk/rust-musl-builder. Am I missing something?
I have tried to build a Diesel app using it and doesn't work.
I just updated the master
branch on my repo, and now I have failed Action Notifications in my mail box
How can I stop that without making a commit to delete it (which will be questioned next time I update the branch) (EDIT: and makes making PR's a bit problematic).
NOTE: I was not getting any Actions or Notifications before that (then 53 commits behind I think )
Would you please upgrade rust to the latest?
arm-musleabihf is using 1.40.0
Hi, first of all thanks for this repo, it's really useful :-)
As a small disclaimer I'm completely out of my depth when it comes to compiling Rust applications -- usually cargo build --release
is the extent of my needs.
I've used the Dockerfile from this repo as the basis for a few apps I've built to run on ARMv7, but every time I have a dependency that uses pkg-config
I end up having an issue. I'm currently trying to compile an app that plays an audio file a couple of times, using rodio for audio playback. rodio depends on alsa-sys, which in turns depends on the pkg-config crate as a build depenency.
When building the application I get the following error:
#6 64.36 error: failed to run custom build command for `alsa-sys v0.3.1`
#6 64.36
#6 64.36 Caused by:
#6 64.36 process didn't exit successfully: `/home/rust/src/target/release/build/alsa-sys-b3fdfece193bda1f/build-script-build` (exit status: 101)
#6 64.36 --- stdout
#6 64.36 cargo:rerun-if-env-changed=ALSA_NO_PKG_CONFIG
#6 64.36 cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7-unknown-linux-musleabihf
#6 64.36 cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7_unknown_linux_musleabihf
// ...
#6 64.36 --- stderr
#6 64.36 thread 'main' panicked at 'Could not run `"pkg-config" "--libs" "--cflags" "alsa"`
#6 64.36 The pkg-config command could not be found.
#6 64.36
#6 64.36 Most likely, you need to install a pkg-config package for your OS.
#6 64.36 Try `apt install pkg-config`, or `yum install pkg-config`,
#6 64.36 or `pkg install pkg-config` depending on your distribution.
#6 64.36
#6 64.36 If you've already installed it, ensure the pkg-config command is one of the
#6 64.36 directories in the PATH environment variable.
I can get around it by creating a Dockerfile and installing pkg-config
, like so
FROM messense/rust-musl-cross:armv7-musleabihf
RUN apt update -y
RUN apt install -y pkg-config
COPY . .
RUN cargo build --release
Then I still get an error with
#9 67.19 --- stderr
#9 67.19 thread 'main' panicked at '`"pkg-config" "--libs" "--cflags" "alsa"` did not exit successfully: exit status: 1
#9 67.19 error: could not find system library 'alsa' required by the 'alsa-sys' crate
#9 67.19
#9 67.19 --- stderr
#9 67.19 Package alsa was not found in the pkg-config search path.
#9 67.19 Perhaps you should add the directory containing `alsa.pc'
#9 67.19 to the PKG_CONFIG_PATH environment variable
Well duh, I need to install Alsa, so I add librust-alsa-sys-dev
to the apt install
command on the Dockerfile.
But then I still have an issue because alsa.pc
ends up being put at /usr/lib/x86_64-linux-gnu/pkgconfig
, as opposed to any of the directories defined in the original Dockerfile ENVs (/usr/local/musl/lib/pkgconfig
and /usr/local/musl/armv7-unknown-linux-musleabihf/lib/pkgconfig
).
From here on I'm not sure how to proceed -- I've tried adding the directory as one of the pkg-config
paths and I've also tried copying alsa.pc
to the musleabihf
pkgconfig folder, but this not only feels like the wrong thing, I still get errors with it. I would appreciate any pointers here as I'm sure my lack of knowledge on this is creating a lot more trouble than it should ๐
Below is the application I'm trying to compile:
# Cargo.toml
[package]
name = "audio"
version = "0.1.0"
edition = "2021"
[dependencies]
rodio = "0.16.0"
// main.rs
use rodio::{Decoder, OutputStream, Sink, Source};
use std::{error::Error, fs::File, io::BufReader};
pub fn main() -> Result<(), Box<dyn Error>> {
let (_stream, stream_handle) = OutputStream::try_default()?;
let file = BufReader::new(File::open("coin.wav")?);
let source = Decoder::new(file)?;
let sink = Sink::try_new(&stream_handle).unwrap();
let x = source.buffered();
let y = x.clone();
sink.append(x);
sink.append(y);
sink.play();
Ok(())
}
The build log says error: Undefined temporary symbol $BB16_15
and I think this is the upstream issue at rust-lang/rust#108835
I cross-compiled the openssl library using messense/rust-musl-cross: aaarch64-musl
and had to manually modify the following environment variables:
export TARGET=x86_64-unknown-linux-musl
export CC=$TARGET_CC
export C_INCLUDE_PATH=$TARGET_C_INCLUDE_PATH
export LD=$TARGET-ld
Why not add them to the environment variables of the docker image?
Downloaded 134 crates (15.9 MB) in 4.37s (largest was `librocksdb-sys` at 6.1 MB)
Compiling librocksdb-sys v0.6.1+6.28.2
error: failed to run custom build command for `librocksdb-sys v0.6.1+6.28.2`
Caused by:
process didn't exit successfully: `/home/rust/src/target/release/build/librocksdb-sys-575f1be645469399/build-script-build` (exit status: 101)
--- stderr
/usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found
/usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found, err: true
thread 'main' panicked at 'unable to generate rocksdb bindings: ()', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/librocksdb-sys-0.6.1+6.28.2/build.rs:43:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I tried to cross-compile a project with openssl
dependency. I searched for the solutions and many of them mentioned this project.
But I tried to use rust-musl-cross:x86_64-musl
and get the error.
run pkg_config fail: "pkg-config has not been configured to support cross-compilation.\n\nInstall a sysroot for the target platform and configure it via\nPKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\ncross-compiling wrapper for pkg-config and set it via\nPKG_CONFIG environment variable."
I saw the Remove OpenSSL issue, which states
It's better to just use the
openssl-src
crate.
And the openssl-src
crate states
intended to be consumed by the
openssl-sys
But this is the crate I have a problem with. So I'm confused and have no idea of how to fix it.
if somebody need, it is my ci's script that can enable to cache.
.
โโโ Cargo.toml
โโโ src
โย ย โโโ main.rs
โโโ target
โย ย โโโ registry
build-job:
stage: build
only:
refs:
- master
tags:
- maven
image: messense/rust-musl-cross:x86_64-musl
script:
- ln -s $(pwd)/target/registry /root/.cargo/registry
- export CARGO_BUILD_DEP_INFO_BASEDIR=.
- cargo build --package endpoint --bin endpoint --release --target=x86_64-unknown-linux-musl
cache:
key: moss-endpoint-cache
paths:
# cache for cargo registry
- target/registry/
# cache for build
- target/x86_64-unknown-linux-musl/
- target/release/
Hi,
I was wondering about difference between cross and messense/rust-musl-cross
images.
For sure there is big one - cross doesn't support openssl. Are there any other?
I am asking because maybe it would be good idea to make messense/rust-musl-cross
images work with cross. See custom docker images in cross.
Hey guys, it would be awesome to have RISCV support.
I have already seen that there is a feature branch for it, but no PR or ticket yet. So I just wanted to ask here about the status.
Setting CC and C_INCLUDE_PATH unconditionally breaks compiling ring as dependency of rocket_codegen while cross compiling to another architecture (e.g. from x86_64 to arm).
The ring build script will fail with error messages complaining that the -m64
switch is unknown on the arm-unknown-linux-musleabi crosscompiler.
The underlying issue is that ring is build twice, once for usage in the codegen compilerplugin and once for usage in the final binary. This means ring must be build for the target and host. Ring tries to use the compiler provided by the environment, so setting unconditionally CC will cause ring to use that compiler everywhere. Building for the host-platform may not work while crosscompiling.
The solution is to set TARGET_CC
to the compiler of the target platform and let CC unspecified.
Would it be possible to add the rust target armv5te-unknown-linux-musleabi to the arm-unknown-linux-musleabi image? It works fine if I add it manually. Would be nice if you could add it by default.
Hi there,
in https://www.reddit.com/r/rust/comments/75u8qu/docker_images_for_compiling_static_rust_binaries/do97z5u you indicated that aarch64-unknown-linux-musl
support may become available. Are there any news for this to share?
Thanks,
Thilo
docker command:
docker run -it --rm -v "$(pwd)":/home/rust/src \
-v "/Users/lei/.cargo/config:/root/.cargo/config" \
-v "/Users/lei/.cargo/registry:/root/.cargo/registry" \
messense/rust-musl-cross:x86_64-musl
Cargo.toml:
[target.x86_64-unknown-linux-musl]
linker = "x86_64-unknown-linux-musl-gcc"
build command: cargo build --target x86_64-unknown-linux-musl
, then i got err:
warning: unused manifest key: target.x86_64-unknown-linux-musl.linker // why ?
...omit a lot
error: linking with `cc` failed: exit status: 1
...omit a lot
= note: cc: error: unrecognized command-line option '-m64'
Prebuilt images missing debugging tools. Definitely it needs host gdb and/or lldb for target arch and target arch gdbserver.
Hi,
I was wondering how I could cross strip my final application just using this docker image? Anybody know about existing cross striping? or maybe some [profile.release]
configuration (can rustc strip by itself?)
I think this issue where exa does not show the month August correctly may be because of it being compiled using messense/rust-musl-cross.
in the following line what does -d16
refer to, or enable:
ENV CFLAGS_armv7_unknown_linux_musleabihf='-mfpu=vfpv3-d16'
As far as I understand this is device specific, that is -mfpu=vfpv3
will apply to more (Broadcom?) armv7
devices that have a vfpv3
Hi,
Thanks for the image. For my project, I required to also use rust-bindgen for generating bindings. According to the documentation, bindgen requires llvm-dev libclang-dev clang
In addition, I was also requiring development headers so I ended up adding packages linux-headers-generic libc6-dev-i386
.
Here is my Dockerfile used for building on Alpine RPi2 armv7:
FROM messense/rust-musl-cross:armv7-musleabihf
RUN apt-get update && \
apt-get install -y software-properties-common apt-transport-https ca-certificates
RUN add-apt-repository 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main'
RUN apt-get update && \
apt-get install -y llvm-dev libclang-dev clang linux-headers-generic libc6-dev-i386
Hi! I'm trying to use your Docker image to produce a statically-linked mipsel binary (for use on an Ubiquiti EdgeRouter). The output binary seems to wind up dynamically linking against libc and libgcc_s though:
luser@eye7:/build/snippet$ docker run --rm -it -v "$(pwd)":/home/rust/src messense/rust-musl-cross:mipsel-musl cargo build --release
Updating crates.io index
Downloaded itoa v0.3.4
Compiling itoa v0.3.4
Compiling snippet v0.1.4-alpha.0 (/home/rust/src)
Finished release [optimized] target(s) in 38.61s
luser@eye7:/build/snippet$ file target/mipsel-unknown-linux-musl/release/snippettarget/mipsel-unknown-linux-musl/release/snippet: ELF 32-bit LSB shared object, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-mipsel.so.1, with debug_info, not stripped
luser@eye7:/build/snippet$ readelf -d target/mipsel-unknown-linux-musl/release/snippet | rg NEEDED
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED) Shared library: [libc.so]
The output above is from compiling this simple test project I have laying around for such purposes. Is this intended behavior or did I miss a step in the directions?
Thanks!
Hi,
I would like to use this when and have no idea how to manage it.
[dependencies]
package = { git = "https://@git.private.com/repo/repo.git" }
Hi,
I try to build a rust app with musl, by rust-mul-cross images and GHA.
x86_64 works fine, but aarch64 crash.
I get:
#14 5.127 Updating crates.io index
#14 85.51 Killed
ERROR: failed to solve: process "/bin/sh -c cargo build --release" did not complete successfully: exit code: 137
Error: buildx failed with: ERROR: failed to solve: process "/bin/sh -c cargo build --release" did not complete successfully: exit code: 137
GHA Workflow: https://github.com/Ludea/speedupdate-rs/blob/master/.github/workflows/docker.yml
Dockerfile: https://github.com/Ludea/speedupdate-rs/blob/master/Dockerfile
Full log: https://github.com/Ludea/speedupdate-rs/actions/runs/3409830963/jobs/5672075085
I don't understand what is wrong
run pkg_config fail: "Could not run \"pkg-config\" \"--libs\" \"--cflags\" \"openssl\"
\nThe pkg-config command could not be found.\n\nMost likely, you need to install a pkg-config package for your OS.\nTry apt install pkg-config
, or yum install pkg-config
,\nor pkg install pkg-config
, or apk add pkgconfig
depending on your distribution.\n\nIf you've already installed it, ensure the pkg-config command is one of the\ndirectories in the PATH environment variable.\n\nIf you did not expect this build to link to a pre-installed system library,\nthen check documentation of the openssl-sys crate for an option to\nbuild the library from source, or disable features or dependencies\nthat require pkg-config."
Hi,
I have a problem with cross-compile example tokio-serial. I described the problem on tokio-serial issue - but I think here should be more people that can manage this problem.
Linux 65fe86937035 5.4.0-73-generic #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux`
I'm trying to cross-compile a Rust application that depends on ethers-rs with the help of rust-musl-cross
. However, compilation fails and after some debugging, I found ethers-rs to be the one causing the error.
I'm not opening this issue on ethers-rs as that library can be compiled outside rust-musl-cross
without issues.
Create a Dockerfile
anywhere with the following content:
FROM messense/rust-musl-cross:x86_64-musl
RUN git clone https://github.com/gakonst/ethers-rs && \
cd ethers-rs && \
cargo build
Run:
$ docker build .
Compilation succeeds.
Compilation fails with:
Compiling ethers-contract-abigen v0.2.2 (/home/rust/src/ethers-rs/ethers-contract/ethers-contract-abigen)
Compiling ethers-providers v0.2.2 (/home/rust/src/ethers-rs/ethers-providers)
Compiling ethers-contract-derive v0.2.2 (/home/rust/src/ethers-rs/ethers-contract/ethers-contract-derive)
Compiling ethers-contract v0.2.2 (/home/rust/src/ethers-rs/ethers-contract)
thread 'rustc' panicked at 'Failed to get crate data for crate179', compiler/rustc_metadata/src/creader.rs:136:32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.52.1 (9bc8c42bb 2021-05-09) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C linker=x86_64-unknown-linux-musl-gcc -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: could not compile `ethers-contract`
To learn more, run the command again with --verbose.
It's better to just use the openssl-src
crate.
I wanted to use this container with azure pipelines but it looks like it create new user for container and that user doesn't have access to /root/.cargo/bin
where binaries are.
From this line:
https://github.com/xoac/rust-azure-pipelines/blob/26fbb57ad44af2ac263297d5cdec8086ca9d8578/ci/azure-cross-docker.yml#L16
Here are the permisions for /root/
ls -la /root/
total 24
drwx------ 6 root root 4096 Mar 1 06:17 .
drwxr-xr-x 52 root root 4096 Mar 7 22:52 ..
-rw-r--r-- 1 root root 3106 Oct 22 2015 .bashrc
drwxr-xr-x 3 root root 4096 Mar 1 06:18 .cargo
lrwxrwxrwx 1 root root 13 Mar 1 06:17 .multirust -> /root/.rustup
-rw-r--r-- 1 root root 186 Mar 1 06:17 .profile
drwxr-xr-x 7 root root 4096 Mar 1 06:18 .rustup
I think changing root to 755 should resolve this problem.
Hello, I am trying to cross compile a dylib
to aarch64 in a multi-staged docker image (the dylib gets used in a node app) but am encountering an error:
#0 28.01 error: could not find system library 'glib-2.0' required by the 'glib-sys' crate
#0 28.01
#0 28.01 --- stderr
#0 28.01 Package glib-2.0 was not found in the pkg-config search path.
#0 28.01 Perhaps you should add the directory containing `glib-2.0.pc'
#0 28.01 to the PKG_CONFIG_PATH environment variable
#0 28.01 No package 'glib-2.0' found
#0 28.01 Package glib-2.0 was not found in the pkg-config search path.
#0 28.01 Perhaps you should add the directory containing `glib-2.0.pc'
#0 28.01 to the PKG_CONFIG_PATH environment variable
#0 28.01 No package 'glib-2.0' found
#0 28.01
#0 28.01 warning: build failed, waiting for other jobs to finish...
I am attempting to install the packages pkg-config libgtk2.0-dev
, but still the error occurs so have been stuck on this for a bit. Any help is appreciated, I'll paste some (hopefully) helpful snippets below:
FROM messense/rust-musl-cross:aarch64-musl AS arm64-arch
RUN apt-get update && apt-get install -y pkg-config libgtk2.0-dev
WORKDIR /app
COPY .cargo .cargo
COPY . .
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
RUN rustup target add aarch64-unknown-linux-musl && \
cargo build --workspace --release --target aarch64-unknown-linux-musl && \
mkdir libraries && find ./target/release -maxdepth 1 -type f -name "*.dylib" -exec cp {} libraries/ \;
[package]
name = "fs-utils"
version = "0.1.0"
edition = "2021"
[lib]
name = "fs_utils"
crate-type = ["dylib"]
[dependencies]
data-encoding = "2.3.2"
ring = "0.16.20"
safer-ffi = { version = "0.0.10", features = ["proc_macros"]}
# in my .cargo/config.toml
[target.aarch64-unknown-linux-musl]
rustflags = [
"-C", "target-feature=-crt-static",
]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.