Skip to content

Commit b1aee06

Browse files
committed
feat: switch ARM64 build from QEMU to cross-compilation
This significantly improves build speed: Changes: - Remove QEMU setup and emulation - Use gcc-aarch64-linux-gnu cross-compiler toolchain - Configure Node.js with --dest-cpu=arm64 --cross-compiling - Use full parallelism (make -j$(nproc)) instead of -j1 - Remove Docker/QEMU overhead Benefits: - Much faster than QEMU emulation (3-5x speedup expected) - Should complete within GitHub's 6h limit - Same glibc version (Ubuntu 22.04 container)
1 parent 6bbaaf7 commit b1aee06

File tree

1 file changed

+18
-40
lines changed

1 file changed

+18
-40
lines changed

.github/workflows/build_node_shared.yml

Lines changed: 18 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ jobs:
2929
container: ghcr.io/ten-framework/ten_building_ubuntu2204
3030
lib_name: libnode.so.127
3131
nproc_cmd: nproc
32-
# Linux ARM64 builds (using QEMU) - only GCC due to 6h timeout limit
32+
# Linux ARM64 builds (using cross-compilation) - only GCC due to toolchain availability
3333
- os: ubuntu-latest
3434
platform: linux
3535
arch: arm64
3636
compiler: gcc
37-
container: ""
37+
container: ghcr.io/ten-framework/ten_building_ubuntu2204
3838
lib_name: libnode.so.127
3939
nproc_cmd: nproc
4040
# macOS x64 builds
@@ -66,50 +66,33 @@ jobs:
6666
repository: nodejs/node
6767
ref: v22.12.0
6868

69-
- name: Create out directory (Linux ARM64)
69+
- name: Setup cross-compilation toolchain (Linux ARM64)
7070
if: matrix.platform == 'linux' && matrix.arch == 'arm64'
7171
run: |
72-
# Due to the use of QEMU, running as root inside the Docker container
73-
# is required. However, outside the container, the user is not root.
74-
# This causes issues when trying to handle the contents of the out/
75-
# folder from outside the container. To resolve this, the out/ folder
76-
# is first created by a regular non-root user to prevent it from being
77-
# created during the build stage, thus avoiding permission issues with
78-
# the out/ folder being created by the root user.
79-
mkdir -p out/Release
80-
81-
- name: Set up QEMU (Linux ARM64)
82-
if: matrix.platform == 'linux' && matrix.arch == 'arm64'
83-
uses: docker/setup-qemu-action@v3
84-
with:
85-
platforms: arm64
72+
apt-get update
73+
apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
8674
8775
- name: Setup Python (macOS)
8876
if: matrix.platform == 'mac'
8977
uses: actions/setup-python@v5
9078
with:
9179
python-version: '3.11'
9280

93-
- name: Configure and Build (Linux ARM64 with QEMU)
81+
- name: Configure and Build (Linux ARM64 with cross-compilation)
9482
if: matrix.platform == 'linux' && matrix.arch == 'arm64'
95-
timeout-minutes: 720 # 12 hours for QEMU emulation
9683
run: |
97-
docker run --rm --platform linux/arm64 \
98-
-v $(pwd):${{ github.workspace }} -w ${{ github.workspace }} \
99-
ghcr.io/ten-framework/ten_building_ubuntu2204 \
100-
bash -c "
101-
if [ '${{ matrix.compiler }}' = 'gcc' ]; then
102-
export CC=gcc
103-
export CXX=g++
104-
else
105-
export CC=clang
106-
export CXX=clang++
107-
fi && \
108-
./configure --shared \
109-
--without-npm \
110-
--without-corepack && \
111-
make -j1
112-
"
84+
export CC=aarch64-linux-gnu-gcc
85+
export CXX=aarch64-linux-gnu-g++
86+
export CC_host=gcc
87+
export CXX_host=g++
88+
89+
./configure --shared \
90+
--dest-cpu=arm64 \
91+
--cross-compiling \
92+
--without-npm \
93+
--without-corepack
94+
95+
make -j$(nproc)
11396
11497
- name: Configure and Build (Linux x64 and macOS)
11598
if: matrix.platform != 'linux' || matrix.arch != 'arm64'
@@ -126,11 +109,6 @@ jobs:
126109
127110
make -j$(${{ matrix.nproc_cmd }})
128111
129-
- name: Fix permissions for build outputs (Linux ARM64)
130-
if: matrix.platform == 'linux' && matrix.arch == 'arm64'
131-
run: |
132-
sudo chown -R "$(id -u)":"$(id -g)" out/Release
133-
134112
- name: Package assets
135113
if: startsWith(github.ref, 'refs/tags/')
136114
run: |

0 commit comments

Comments
 (0)