diff options
| author | Matt Mastracci <matthew@mastracci.com> | 2024-02-07 16:17:21 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-07 23:17:21 +0000 |
| commit | 13616d62e9f16641dfe9257d41f96d425a6a1480 (patch) | |
| tree | 4e3ccef25a412e8f99e68c1961644b78270b8960 /.github/workflows/ci.generate.ts | |
| parent | 8a8dffbafc1d5997cb485f5abcabd053eddfeaba (diff) | |
feat: use sysroot for ARM64 (#22329)
Follow-up from #22298: Use a sysroot to build ARM64 so we work all the
way back to Xenial.
We generate a sysroot ahead-of-time in the
https://github.com/denoland/deno_sysroot_build project and use that to
bootstrap a sysroot here.
Diffstat (limited to '.github/workflows/ci.generate.ts')
| -rwxr-xr-x | .github/workflows/ci.generate.ts | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts index f155e8d53..4f6f0c0f4 100755 --- a/.github/workflows/ci.generate.ts +++ b/.github/workflows/ci.generate.ts @@ -64,11 +64,14 @@ const installPkgsCommand = `sudo apt-get install --no-install-recommends debootstrap clang-${llvmVersion} lld-${llvmVersion} clang-tools-${llvmVersion} clang-format-${llvmVersion} clang-tidy-${llvmVersion}`; const sysRootStep = { name: "Set up incremental LTO and sysroot build", - run: `# Avoid running man-db triggers, which sometimes takes several minutes + run: `# Setting up sysroot +export DEBIAN_FRONTEND=noninteractive +# Avoid running man-db triggers, which sometimes takes several minutes # to complete. -sudo apt-get remove --purge -y man-db +sudo apt-get -qq remove --purge -y man-db > /dev/null 2> /dev/null # Remove older clang before we install -sudo apt-get remove 'clang-12*' 'clang-13*' 'clang-14*' 'clang-15*' 'llvm-12*' 'llvm-13*' 'llvm-14*' 'llvm-15*' 'lld-12*' 'lld-13*' 'lld-14*' 'lld-15*' +sudo apt-get -qq remove \ + 'clang-12*' 'clang-13*' 'clang-14*' 'clang-15*' 'llvm-12*' 'llvm-13*' 'llvm-14*' 'llvm-15*' 'lld-12*' 'lld-13*' 'lld-14*' 'lld-15*' > /dev/null 2> /dev/null # Install clang-XXX, lld-XXX, and debootstrap. echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${llvmVersion} main" | @@ -80,27 +83,30 @@ sudo apt-get update # this was unreliable sometimes, so try again if it fails ${installPkgsCommand} || echo 'Failed. Trying again.' && sudo apt-get clean && sudo apt-get update && ${installPkgsCommand} # Fix alternatives -(yes '' | sudo update-alternatives --force --all) || true +(yes '' | sudo update-alternatives --force --all) || true > /dev/null 2> /dev/null -# Create ubuntu-16.04 sysroot environment, which is used to avoid -# depending on a very recent version of glibc. -# \`libc6-dev\` is required for building any C source files. -# \`file\` and \`make\` are needed to build libffi-sys. -# \`curl\` is needed to build rusty_v8. -sudo debootstrap \\ - --include=ca-certificates,curl,file,libc6-dev,make \\ - --no-merged-usr --variant=minbase xenial /sysroot \\ - http://azure.archive.ubuntu.com/ubuntu +echo "Decompressing sysroot..." +wget -q https://github.com/denoland/deno_sysroot_build/releases/download/sysroot-20240207/sysroot-\`uname -m\`.tar.xz -O /tmp/sysroot.tar.xz +cd / +xzcat /tmp/sysroot.tar.xz | sudo tar -x sudo mount --rbind /dev /sysroot/dev sudo mount --rbind /sys /sysroot/sys sudo mount --rbind /home /sysroot/home sudo mount -t proc /proc /sysroot/proc +cd -wget https://github.com/denoland/deno_third_party/raw/master/prebuilt/linux64/libdl/libdl.a -wget https://github.com/denoland/deno_third_party/raw/master/prebuilt/linux64/libdl/libdl.so.2 +if [[ \`uname -m\` == "aarch64" ]]; then + echo "Copying libdl.a" + sudo cp /sysroot/usr/lib/aarch64-linux-gnu/libdl.a /sysroot/lib/aarch64-linux-gnu/libdl.a + echo "Copying libdl.so" + sudo cp /sysroot/lib/aarch64-linux-gnu/libdl.so.2 /sysroot/lib/aarch64-linux-gnu/libdl.so +else + wget https://github.com/denoland/deno_third_party/raw/master/prebuilt/linux64/libdl/libdl.a + wget https://github.com/denoland/deno_third_party/raw/master/prebuilt/linux64/libdl/libdl.so.2 -sudo ln -s libdl.so.2 /sysroot/lib/x86_64-linux-gnu/libdl.so -sudo ln -s libdl.a /sysroot/lib/x86_64-linux-gnu/libdl.a + sudo ln -s libdl.so.2 /sysroot/lib/x86_64-linux-gnu/libdl.so + sudo ln -s libdl.a /sysroot/lib/x86_64-linux-gnu/libdl.a +fi # Configure the build environment. Both Rust and Clang will produce # llvm bitcode only, so we can use lld's incremental LTO support. @@ -413,6 +419,7 @@ const ci = { ...Runners.linuxArm, job: "test", profile: "release", + use_sysroot: true, }, { ...Runners.macosX86, job: "lint", @@ -676,9 +683,10 @@ const ci = { "(github.ref == 'refs/heads/main' ||", "startsWith(github.ref, 'refs/tags/'))))", ].join("\n"), - uses: "actions/upload-artifact@v3", + uses: "actions/upload-artifact@v4", with: { - name: "deno-${{ github.event.number }}", + name: + "deno-${{ matrix.os }}-${{ matrix.arch }}-${{ github.event.number }}", path: "target/release/deno", }, }, @@ -808,8 +816,10 @@ const ci = { }, { // Verify that the binary actually works in the Ubuntu-16.04 sysroot. + // TODO(mmastrac): make this work for aarch64 as well name: "Check deno binary (in sysroot)", - if: "matrix.profile == 'release' && matrix.use_sysroot", + if: + "matrix.profile == 'release' && matrix.use_sysroot && matrix.arch != 'aarch64'", run: 'sudo chroot /sysroot "$(pwd)/target/release/deno" --version', }, { |
