fix musl download fail in ci action (#902)
https://github.com/orgs/community/discussions/27906 musl.cc banned microsoft ips this patch replace musl.cc with https://github.com/cross-tools/musl-cross
This commit is contained in:
+23
-15
@@ -6,21 +6,23 @@ rustflags = ["-C", "linker-flavor=ld.lld"]
|
|||||||
linker = "aarch64-linux-gnu-gcc"
|
linker = "aarch64-linux-gnu-gcc"
|
||||||
|
|
||||||
[target.aarch64-unknown-linux-musl]
|
[target.aarch64-unknown-linux-musl]
|
||||||
linker = "aarch64-linux-musl-gcc"
|
linker = "aarch64-unknown-linux-musl-gcc"
|
||||||
rustflags = ["-C", "target-feature=+crt-static"]
|
rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
|
|
||||||
[target.'cfg(all(windows, target_env = "msvc"))']
|
[target.'cfg(all(windows, target_env = "msvc"))']
|
||||||
rustflags = ["-C", "target-feature=+crt-static"]
|
rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
|
|
||||||
[target.mipsel-unknown-linux-musl]
|
[target.mipsel-unknown-linux-musl]
|
||||||
linker = "mipsel-linux-muslsf-gcc"
|
linker = "mipsel-unknown-linux-muslsf-gcc"
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"-C",
|
"-C",
|
||||||
"target-feature=+crt-static",
|
"target-feature=+crt-static",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/mipsel-linux-muslsf-cross/mipsel-linux-muslsf/lib",
|
"./musl_gcc/mipsel-unknown-linux-muslsf/mipsel-unknown-linux-muslsf/lib",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/mipsel-linux-muslsf-cross/lib/gcc/mipsel-linux-muslsf/11.2.1",
|
"./musl_gcc/mipsel-unknown-linux-muslsf/mipsel-unknown-linux-muslsf/sysroot/usr/lib",
|
||||||
|
"-L",
|
||||||
|
"./musl_gcc/mipsel-unknown-linux-muslsf/lib/gcc/mipsel-unknown-linux-muslsf/15.1.0",
|
||||||
"-l",
|
"-l",
|
||||||
"atomic",
|
"atomic",
|
||||||
"-l",
|
"-l",
|
||||||
@@ -28,14 +30,16 @@ rustflags = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[target.mips-unknown-linux-musl]
|
[target.mips-unknown-linux-musl]
|
||||||
linker = "mips-linux-muslsf-gcc"
|
linker = "mips-unknown-linux-muslsf-gcc"
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"-C",
|
"-C",
|
||||||
"target-feature=+crt-static",
|
"target-feature=+crt-static",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/mips-linux-muslsf-cross/mips-linux-muslsf/lib",
|
"./musl_gcc/mips-unknown-linux-muslsf/mips-unknown-linux-muslsf/lib",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/mips-linux-muslsf-cross/lib/gcc/mips-linux-muslsf/11.2.1",
|
"./musl_gcc/mips-unknown-linux-muslsf/mips-unknown-linux-muslsf/sysroot/usr/lib",
|
||||||
|
"-L",
|
||||||
|
"./musl_gcc/mips-unknown-linux-muslsf/lib/gcc/mips-unknown-linux-muslsf/15.1.0",
|
||||||
"-l",
|
"-l",
|
||||||
"atomic",
|
"atomic",
|
||||||
"-l",
|
"-l",
|
||||||
@@ -43,35 +47,39 @@ rustflags = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[target.armv7-unknown-linux-musleabihf]
|
[target.armv7-unknown-linux-musleabihf]
|
||||||
linker = "armv7l-linux-musleabihf-gcc"
|
linker = "armv7-unknown-linux-musleabihf-gcc"
|
||||||
rustflags = ["-C", "target-feature=+crt-static"]
|
rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
|
|
||||||
[target.armv7-unknown-linux-musleabi]
|
[target.armv7-unknown-linux-musleabi]
|
||||||
linker = "armv7m-linux-musleabi-gcc"
|
linker = "armv7-unknown-linux-musleabi-gcc"
|
||||||
rustflags = ["-C", "target-feature=+crt-static"]
|
rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
|
|
||||||
[target.arm-unknown-linux-musleabihf]
|
[target.arm-unknown-linux-musleabihf]
|
||||||
linker = "arm-linux-musleabihf-gcc"
|
linker = "arm-unknown-linux-musleabihf-gcc"
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"-C",
|
"-C",
|
||||||
"target-feature=+crt-static",
|
"target-feature=+crt-static",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/arm-linux-musleabihf-cross/arm-linux-musleabihf/lib",
|
"./musl_gcc/arm-unknown-linux-musleabihf/arm-unknown-linux-musleabihf/lib",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/arm-linux-musleabihf-cross/lib/gcc/arm-linux-musleabihf/11.2.1",
|
"./musl_gcc/arm-unknown-linux-musleabihf/lib/gcc/arm-unknown-linux-musleabihf/15.1.0",
|
||||||
"-l",
|
"-l",
|
||||||
"atomic",
|
"atomic",
|
||||||
|
"-l",
|
||||||
|
"gcc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[target.arm-unknown-linux-musleabi]
|
[target.arm-unknown-linux-musleabi]
|
||||||
linker = "arm-linux-musleabi-gcc"
|
linker = "arm-unknown-linux-musleabi-gcc"
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"-C",
|
"-C",
|
||||||
"target-feature=+crt-static",
|
"target-feature=+crt-static",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/arm-linux-musleabi-cross/arm-linux-musleabi/lib",
|
"./musl_gcc/arm-unknown-linux-musleabi/arm-unknown-linux-musleabi/lib",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/arm-linux-musleabi-cross/lib/gcc/arm-linux-musleabi/11.2.1",
|
"./musl_gcc/arm-unknown-linux-musleabi/lib/gcc/arm-unknown-linux-musleabi/15.1.0",
|
||||||
"-l",
|
"-l",
|
||||||
"atomic",
|
"atomic",
|
||||||
|
"-l",
|
||||||
|
"gcc",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -166,9 +166,14 @@ jobs:
|
|||||||
if: ${{ ! endsWith(matrix.TARGET, 'freebsd') }}
|
if: ${{ ! endsWith(matrix.TARGET, 'freebsd') }}
|
||||||
run: |
|
run: |
|
||||||
bash ./.github/workflows/install_rust.sh
|
bash ./.github/workflows/install_rust.sh
|
||||||
|
|
||||||
|
# we set the sysroot when sysroot is a dir
|
||||||
# this dir is a soft link generated by install_rust.sh
|
# this dir is a soft link generated by install_rust.sh
|
||||||
# kcp-sys need this to gen ffi bindings. without this clang may fail to find some libc headers such as bits/libc-header-start.h
|
# kcp-sys need this to gen ffi bindings. without this clang may fail to find some libc headers such as bits/libc-header-start.h
|
||||||
export KCP_SYS_EXTRA_HEADER_PATH=/usr/include/musl-cross
|
if [[ -d "./musl_gcc/sysroot" ]]; then
|
||||||
|
export BINDGEN_EXTRA_CLANG_ARGS=--sysroot=$(readlink -f ./musl_gcc/sysroot)
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $OS =~ ^ubuntu.*$ && $TARGET =~ ^mips.*$ ]]; then
|
if [[ $OS =~ ^ubuntu.*$ && $TARGET =~ ^mips.*$ ]]; then
|
||||||
cargo +nightly build -r --verbose --target $TARGET -Z build-std=std,panic_abort --no-default-features --features mips --package=easytier
|
cargo +nightly build -r --verbose --target $TARGET -Z build-std=std,panic_abort --no-default-features --features mips --package=easytier
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -8,38 +8,22 @@
|
|||||||
# dependencies are only needed on ubuntu as that's the only place where
|
# dependencies are only needed on ubuntu as that's the only place where
|
||||||
# we make cross-compilation
|
# we make cross-compilation
|
||||||
if [[ $OS =~ ^ubuntu.*$ ]]; then
|
if [[ $OS =~ ^ubuntu.*$ ]]; then
|
||||||
sudo apt-get update && sudo apt-get install -qq crossbuild-essential-arm64 crossbuild-essential-armhf musl-tools libappindicator3-dev llvm clang
|
sudo apt-get update && sudo apt-get install -qq musl-tools libappindicator3-dev llvm clang
|
||||||
# curl -s musl.cc | grep mipsel
|
# https://github.com/cross-tools/musl-cross/releases
|
||||||
case $TARGET in
|
# if "musl" is a substring of TARGET, we assume that we are using musl
|
||||||
mipsel-unknown-linux-musl)
|
MUSL_TARGET=$TARGET
|
||||||
MUSL_URI=mipsel-linux-muslsf
|
# if target is mips or mipsel, we should use soft-float version of musl
|
||||||
;;
|
if [[ $TARGET =~ ^mips.*$ || $TARGET =~ ^mipsel.*$ ]]; then
|
||||||
mips-unknown-linux-musl)
|
MUSL_TARGET=${TARGET}sf
|
||||||
MUSL_URI=mips-linux-muslsf
|
fi
|
||||||
;;
|
if [[ $MUSL_TARGET =~ musl ]]; then
|
||||||
aarch64-unknown-linux-musl)
|
|
||||||
MUSL_URI=aarch64-linux-musl
|
|
||||||
;;
|
|
||||||
armv7-unknown-linux-musleabihf)
|
|
||||||
MUSL_URI=armv7l-linux-musleabihf
|
|
||||||
;;
|
|
||||||
armv7-unknown-linux-musleabi)
|
|
||||||
MUSL_URI=armv7m-linux-musleabi
|
|
||||||
;;
|
|
||||||
arm-unknown-linux-musleabihf)
|
|
||||||
MUSL_URI=arm-linux-musleabihf
|
|
||||||
;;
|
|
||||||
arm-unknown-linux-musleabi)
|
|
||||||
MUSL_URI=arm-linux-musleabi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -n "$MUSL_URI" ]; then
|
|
||||||
mkdir -p ./musl_gcc
|
mkdir -p ./musl_gcc
|
||||||
wget --inet4-only -c https://musl.cc/${MUSL_URI}-cross.tgz -P ./musl_gcc/
|
wget --inet4-only -c https://github.com/cross-tools/musl-cross/releases/download/20250520/${MUSL_TARGET}.tar.xz -P ./musl_gcc/
|
||||||
tar zxf ./musl_gcc/${MUSL_URI}-cross.tgz -C ./musl_gcc/
|
tar xf ./musl_gcc/${MUSL_TARGET}.tar.xz -C ./musl_gcc/
|
||||||
sudo ln -s $(pwd)/musl_gcc/${MUSL_URI}-cross/bin/*gcc /usr/bin/
|
sudo ln -sf $(pwd)/musl_gcc/${MUSL_TARGET}/bin/*gcc /usr/bin/
|
||||||
sudo ln -s $(pwd)/musl_gcc/${MUSL_URI}-cross/${MUSL_URI}/include/ /usr/include/musl-cross
|
sudo ln -sf $(pwd)/musl_gcc/${MUSL_TARGET}/include/ /usr/include/musl-cross
|
||||||
|
sudo ln -sf $(pwd)/musl_gcc/${MUSL_TARGET}/${MUSL_TARGET}/sysroot/ ./musl_gcc/sysroot
|
||||||
|
sudo chmod -R a+rwx ./musl_gcc
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -50,7 +34,7 @@ rustup default 1.86
|
|||||||
|
|
||||||
# mips/mipsel cannot add target from rustup, need compile by ourselves
|
# mips/mipsel cannot add target from rustup, need compile by ourselves
|
||||||
if [[ $OS =~ ^ubuntu.*$ && $TARGET =~ ^mips.*$ ]]; then
|
if [[ $OS =~ ^ubuntu.*$ && $TARGET =~ ^mips.*$ ]]; then
|
||||||
cd "$PWD/musl_gcc/${MUSL_URI}-cross/lib/gcc/${MUSL_URI}/11.2.1" || exit 255
|
cd "$PWD/musl_gcc/${MUSL_TARGET}/lib/gcc/${MUSL_TARGET}/15.1.0" || exit 255
|
||||||
# for panic-abort
|
# for panic-abort
|
||||||
cp libgcc_eh.a libunwind.a
|
cp libgcc_eh.a libunwind.a
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user