3 RUN apt-get update && apt-get install -y --no-install-recommends \
22 COPY scripts/musl-toolchain.sh /build/
23 # We need to mitigate rust-lang/rust#34978 when compiling musl itself as well
24 RUN CFLAGS="-Wa,-mrelax-relocations=no -Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=none" \
25 CXXFLAGS="-Wa,-mrelax-relocations=no -Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=none" \
26 REPLACE_CC=1 bash musl-toolchain.sh x86_64 && rm -rf build
28 COPY scripts/sccache.sh /scripts/
29 RUN sh /scripts/sccache.sh
31 ENV HOSTS=x86_64-unknown-linux-musl
33 ENV RUST_CONFIGURE_ARGS \
34 --musl-root-x86_64=/usr/local/x86_64-linux-musl \
38 --set target.x86_64-unknown-linux-musl.crt-static=false \
41 # Newer binutils broke things on some vms/distros (i.e., linking against
42 # unknown relocs disabled by the following flag), so we need to go out of our
43 # way to produce "super compatible" binaries.
45 # See: https://github.com/rust-lang/rust/issues/34978
46 # And: https://github.com/rust-lang/rust/issues/59411
47 ENV CFLAGS_x86_64_unknown_linux_musl="-Wa,-mrelax-relocations=no -Wa,--compress-debug-sections=none \
48 -Wl,--compress-debug-sections=none"
50 # To run native tests replace `dist` below with `test`
51 ENV SCRIPT python3 ../x.py dist --build $HOSTS