diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ed4a233..cd6789b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -204,6 +204,10 @@ jobs: need="" command -v cmake >/dev/null || need="$need cmake" command -v clang >/dev/null || need="$need clang" + # aarch64 的 libc 头(1.7MB,仅头文件,**不含编译器**)。 + # 用它 + 已预装的 clang 交叉前端,替代 10MB+ 的完整交叉 GCC + # (实测那个会卡在下载 cpp-13-aarch64,180s 超时)。 + [ -d /usr/aarch64-linux-gnu/include ] || need="$need libc6-dev-arm64-cross" if [ -z "$need" ]; then echo "✅ 依赖已存在,跳过 apt-get:$(command -v cmake clang | tr '\n' ' ')" diff --git a/Makefile b/Makefile index 6b00f6b3..63970525 100644 --- a/Makefile +++ b/Makefile @@ -295,10 +295,15 @@ csrc-cross: echo " [SKIP] 无 clang、无 aarch64-linux-gnu-gcc(未装任何交叉前端)"; exit 0; \ fi; \ \ + ARM64_SYSINC=""; \ + for d in /usr/aarch64-linux-gnu/include /usr/include/aarch64-linux-gnu; do \ + [ -d "$$d" ] && ARM64_SYSINC="$$ARM64_SYSINC -isystem $$d"; \ + done; \ + \ if [ "$$MODE" = "clang-target" ]; then \ - printf 'int main(void){return 0;}\n' > /tmp/_archchk.c; \ - if ! clang --target=aarch64-linux-gnu -fsyntax-only /tmp/_archchk.c 2>/dev/null; then \ - echo " [SKIP] clang 不支持 --target=aarch64-linux-gnu(版本过旧)"; exit 0; \ + printf '#include \nint main(void){return 0;}\n' > /tmp/_archchk.c; \ + if ! clang --target=aarch64-linux-gnu $$ARM64_SYSINC -fsyntax-only /tmp/_archchk.c >/dev/null 2>&1; then \ + echo " [SKIP] clang 交叉前端不可用(缺 aarch64 libc 头,装 libc6-dev-arm64-cross 即可)"; exit 0; \ fi; \ fi; \ \