From 1867c9f4761294a5aa126c34781d36ceab78aceb Mon Sep 17 00:00:00 2001 From: LongYinan Date: Sun, 12 Mar 2023 17:25:53 +0800 Subject: [PATCH] build: add libc++ in aarch64-linux-gnu Docker (#1511) --- .github/workflows/docker.yaml | 60 +++++++++++------------------------ .gitignore | 1 + debian-aarch64.Dockerfile | 6 ++-- debian.Dockerfile | 2 +- 4 files changed, 24 insertions(+), 45 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index eff8f919..940dae83 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -3,6 +3,7 @@ name: Docker nightly build on: schedule: - cron: '0 0 1 * *' + workflow_dispatch: jobs: build_image: @@ -41,6 +42,21 @@ jobs: push: true tags: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian + - name: Install latest libc++-dev for cross build + uses: addnab/docker-run-action@v3 + with: + image: node:lts-slim + options: '--platform linux/arm64 --user 0:0 -e GITHUB_TOKEN -v ${{ github.workspace }}/lib/llvm-15:/usr/lib/llvm-15' + run: >- + apt-get update && + apt-get install -y wget gnupg2 && + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && + echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" >> /etc/apt/sources.list && + echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" >> /etc/apt/sources.list && + apt-get update && + apt-get install libc++-15-dev libc++abi-15-dev -y --fix-missing --no-install-recommends && + rm /usr/lib/llvm-15/lib/libc++abi.so + - name: Build and push debian aarch64 cross uses: docker/build-push-action@v2 with: @@ -49,6 +65,9 @@ jobs: push: true tags: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 + - name: Cleanup + run: rm -rf "${{ github.workspace }}/lib" + - name: Build and push debian with zig uses: docker/build-push-action@v2 with: @@ -64,44 +83,3 @@ jobs: platforms: linux/amd64 push: true tags: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine-zig - - build_image_arm: - name: Build Node.js arm images - strategy: - fail-fast: false - matrix: - version: ['14', '16', '18'] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Setup QEMU - uses: docker/setup-qemu-action@v1 - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ secrets.GH_CONTAINER_UNAME }} - password: ${{ secrets.GH_TOKEN }} - - - name: Build and push armhf - uses: docker/build-push-action@v2 - with: - file: armhf.Dockerfile - push: true - tags: ghcr.io/napi-rs/napi-rs/nodejs:armhf-${{ matrix.version }} - build-args: | - NODE_VERSION=${{ matrix.version }} - - - name: Build and push aarch64 - uses: docker/build-push-action@v2 - with: - file: aarch64.Dockerfile - push: true - tags: ghcr.io/napi-rs/napi-rs/nodejs:aarch64-${{ matrix.version }} - build-args: | - NODE_VERSION=${{ matrix.version }} diff --git a/.gitignore b/.gitignore index 748a7411..fa292c5a 100644 --- a/.gitignore +++ b/.gitignore @@ -153,6 +153,7 @@ Temporary Items # End of https://www.gitignore.io/api/macos scripts +lib sys/.node-headers bench.txt diff --git a/debian-aarch64.Dockerfile b/debian-aarch64.Dockerfile index aa1ce48f..befca9e1 100644 --- a/debian-aarch64.Dockerfile +++ b/debian-aarch64.Dockerfile @@ -9,19 +9,19 @@ ENV RUSTUP_HOME=/usr/local/rustup \ CXX_aarch64_unknown_linux_gnu="clang++ --sysroot=/usr/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot" \ C_INCLUDE_PATH=/usr/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot/usr/include +ADD ./lib/llvm-15 /usr/aarch64-unknown-linux-gnu/lib/llvm-15 + RUN apt-get update && \ apt-get install -y --fix-missing --no-install-recommends gpg-agent ca-certificates openssl && \ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" >> /etc/apt/sources.list && \ echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" >> /etc/apt/sources.list && \ - curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ + curl -sL https://deb.nodesource.com/setup_18.x | bash - && \ apt-get install -y --fix-missing --no-install-recommends \ curl \ llvm-15 \ clang-15 \ lld-15 \ - libc++-15-dev \ - libc++abi-15-dev \ nodejs \ xz-utils \ rcs \ diff --git a/debian.Dockerfile b/debian.Dockerfile index 9b7800ba..2c1922a8 100644 --- a/debian.Dockerfile +++ b/debian.Dockerfile @@ -17,7 +17,7 @@ RUN apt-get update && \ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" >> /etc/apt/sources.list && \ echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" >> /etc/apt/sources.list && \ - curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ + curl -sL https://deb.nodesource.com/setup_18.x | bash - && \ apt-get install -y --fix-missing --no-install-recommends \ curl \ llvm-15 \