File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 11FROM --platform=$BUILDPLATFORM rust:1.94.0-alpine3.23 AS builder
22
33ARG TARGETARCH
4+ ARG BUILDARCH
45
56RUN set -x \
6- && apk add --no-cache musl-dev
7+ && apk add --no-cache musl-dev gcc \
8+ && echo "Building for ${TARGETARCH} on ${BUILDARCH}"
79
810WORKDIR /root/shadowsocks-rust
911
@@ -33,8 +35,15 @@ RUN case "$TARGETARCH" in \
3335 && wget "https://github.com/AaronChen0/musl-cc-mirror/releases/download/2021-09-23/$MUSL-cross.tgz" \
3436 && ( echo "$SHA512" "$MUSL-cross.tgz" | sha512sum -c ) \
3537 && tar -xzf "$MUSL-cross.tgz" -C /root/ \
36- && PATH="/root/$MUSL-cross/bin:$PATH" \
37- && CC=/root/$MUSL-cross/bin/$MUSL-gcc \
38+ && CROSS="/root/$MUSL-cross/bin/$MUSL-gcc" \
39+ && if [ -x "$CROSS" ] && "$CROSS" --version >/dev/null 2>&1; then \
40+ CC="/root/$MUSL-cross/bin/$MUSL-gcc" ; \
41+ PATH="/root/$MUSL-cross/bin:$PATH" ; \
42+ echo "INFO: Using downloaded cross toolchain: $CC" ; \
43+ else \
44+ CC="gcc" ; \
45+ echo "WARN: downloaded cross toolchain is not executable on this builder, fallback to native gcc" ; \
46+ fi \
3847 && echo "CC=$CC" \
3948 && rustup target add "$RUST_TARGET" \
4049 && RUSTFLAGS="-C linker=$CC" CC=$CC cargo build --target "$RUST_TARGET" --release --features "full" \
You can’t perform that action at this time.
0 commit comments