From 9a5449eaa21f83c37047d70d21a37ed658da667e Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Thu, 1 Jan 2026 18:06:57 -0500 Subject: [PATCH 1/4] Remove duplicate slash --- .github/workflows/ci.yml | 5 +++++ src/utils.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3839a3ad..20701160 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,11 @@ jobs: - name: Install dependencies and build run: npm ci + - name: Debug built files + shell: bash + run: | + ls -lR ./ + - name: Verify GLIBC requirements if: runner.os == 'Linux' run: | diff --git a/src/utils.ts b/src/utils.ts index 81a70c77..1d2d7c93 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -17,7 +17,7 @@ export function loadNativeModule(name: string): {dir: string, module: any} { let lastError: unknown; for (const d of dirs) { for (const r of relative) { - const dir = `${r}/${d}/`; + const dir = `${r}/${d}`; try { return { dir, module: require(`${dir}/${name}.node`) }; } catch (e) { From f2dc190f6a7a29cad6b35f2b3723db64abd11dec Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Thu, 1 Jan 2026 23:18:40 -0500 Subject: [PATCH 2/4] Run CI on cross-arch builds --- .github/workflows/ci.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20701160..0a5b6ded 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,12 +5,13 @@ on: jobs: build-test: - name: Build & Test (${{ matrix.os }}) + name: Build & Test (${{ matrix.os }}${{ matrix.cross && ' xarch' || '' }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-22.04, macos-14, windows-2022] + cross: [false, true] steps: - name: Checkout uses: actions/checkout@v4 @@ -22,12 +23,22 @@ jobs: with: node-version: '22.x' + - name: Set architecture + id: arch + shell: bash + run: | + if [ "${{ runner.os }}" = "macOS" ]; then + echo "arch=${{ matrix.cross && 'x64' || 'arm64' }}" >> $GITHUB_OUTPUT + else + echo "arch=${{ matrix.cross && 'arm64' || 'x64' }}" >> $GITHUB_OUTPUT + fi + - name: Install sysroot if: runner.os == 'Linux' run: | sudo apt-get update -qq sudo apt-get install -y gcc-10 g++-10 - SYSROOT_PATH=$(node scripts/linux/install-sysroot.js x64 | grep "SYSROOT_PATH=" | cut -d= -f2) + SYSROOT_PATH=$(node scripts/linux/install-sysroot.js ${{ steps.arch.outputs.arch }} | grep "SYSROOT_PATH=" | cut -d= -f2) echo "SYSROOT_PATH=$SYSROOT_PATH" >> $GITHUB_ENV echo "Sysroot path set to: $SYSROOT_PATH" echo "CC=gcc-10" >> $GITHUB_ENV @@ -35,6 +46,9 @@ jobs: - name: Install dependencies and build run: npm ci + env: + ARCH: ${{ steps.arch.outputs.arch }} + npm_config_arch: ${{ steps.arch.outputs.arch }} - name: Debug built files shell: bash @@ -50,7 +64,9 @@ jobs: ./scripts/linux/verify-glibc-requirements.sh - name: Test + if: ${{ !matrix.cross }} run: npm test - name: Lint + if: ${{ !matrix.cross }} run: npm run lint From 86debb56f25c028934c827f86ca6a62d4138a146 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Thu, 1 Jan 2026 22:36:04 -0500 Subject: [PATCH 3/4] Install cross-arch compiler --- .github/workflows/ci.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a5b6ded..5dd5656d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,12 +37,18 @@ jobs: if: runner.os == 'Linux' run: | sudo apt-get update -qq - sudo apt-get install -y gcc-10 g++-10 + if [ "${{ steps.arch.outputs.arch }}" = "arm64" ]; then + sudo apt-get install -y gcc-10-aarch64-linux-gnu g++-10-aarch64-linux-gnu + echo "CC=aarch64-linux-gnu-gcc-10" >> $GITHUB_ENV + echo "CXX=aarch64-linux-gnu-g++-10" >> $GITHUB_ENV + else + sudo apt-get install -y gcc-10 g++-10 + echo "CC=gcc-10" >> $GITHUB_ENV + echo "CXX=g++-10" >> $GITHUB_ENV + fi SYSROOT_PATH=$(node scripts/linux/install-sysroot.js ${{ steps.arch.outputs.arch }} | grep "SYSROOT_PATH=" | cut -d= -f2) echo "SYSROOT_PATH=$SYSROOT_PATH" >> $GITHUB_ENV echo "Sysroot path set to: $SYSROOT_PATH" - echo "CC=gcc-10" >> $GITHUB_ENV - echo "CXX=g++-10" >> $GITHUB_ENV - name: Install dependencies and build run: npm ci From ebb2f842b580b795d12609987754af036df2db09 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Thu, 1 Jan 2026 22:39:38 -0500 Subject: [PATCH 4/4] Install cross-arch compiler for azure pipeline --- pipelines/build.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pipelines/build.yml b/pipelines/build.yml index 781a091e..a9a44ea6 100644 --- a/pipelines/build.yml +++ b/pipelines/build.yml @@ -16,11 +16,17 @@ steps: - bash: | if [ "$(uname)" = "Linux" ]; then sudo apt-get update -qq - sudo apt-get install -y gcc-10 g++-10 + if [ "${{ parameters.arch }}" = "arm64" ]; then + sudo apt-get install -y gcc-10-aarch64-linux-gnu g++-10-aarch64-linux-gnu + echo "##vso[task.setvariable variable=CC]aarch64-linux-gnu-gcc-10" + echo "##vso[task.setvariable variable=CXX]aarch64-linux-gnu-g++-10" + else + sudo apt-get install -y gcc-10 g++-10 + echo "##vso[task.setvariable variable=CC]gcc-10" + echo "##vso[task.setvariable variable=CXX]g++-10" + fi SYSROOT_PATH=$(node scripts/linux/install-sysroot.js ${{ parameters.arch }} | grep "SYSROOT_PATH=" | cut -d= -f2) echo "##vso[task.setvariable variable=SYSROOT_PATH]$SYSROOT_PATH" - echo "##vso[task.setvariable variable=CC]gcc-10" - echo "##vso[task.setvariable variable=CXX]g++-10" echo "Sysroot path set to: $SYSROOT_PATH" fi displayName: 'Install sysroot (Linux only)'