From 75fa377702c2870ff43c16762d764fb2599b5521 Mon Sep 17 00:00:00 2001 From: sunxilin Date: Tue, 4 Nov 2025 10:28:41 +0800 Subject: [PATCH 1/4] Add macOS x64 GCC compiler support --- .github/workflows/build_node_shared.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_node_shared.yml b/.github/workflows/build_node_shared.yml index 4853992..7e8aaeb 100644 --- a/.github/workflows/build_node_shared.yml +++ b/.github/workflows/build_node_shared.yml @@ -29,6 +29,13 @@ jobs: lib_name: libnode.so.127 nproc_cmd: nproc # macOS x64 builds + - os: macos-13 + platform: mac + arch: x64 + compiler: gcc + container: "" + lib_name: libnode.127.dylib + nproc_cmd: sysctl -n hw.ncpu - os: macos-13 platform: mac arch: x64 @@ -53,11 +60,21 @@ jobs: with: python-version: '3.11' + - name: Install GCC (macOS) + if: matrix.platform == 'mac' && matrix.compiler == 'gcc' + run: | + brew install gcc@13 + echo "CC=$(brew --prefix gcc@13)/bin/gcc-13" >> $GITHUB_ENV + echo "CXX=$(brew --prefix gcc@13)/bin/g++-13" >> $GITHUB_ENV + - name: Configure and Build run: | if [ "${{ matrix.compiler }}" = "gcc" ]; then - export CC=gcc - export CXX=g++ + # CC and CXX already set for macOS GCC via GITHUB_ENV + if [ "${{ matrix.platform }}" != "mac" ]; then + export CC=gcc + export CXX=g++ + fi else export CC=clang export CXX=clang++ From 831c4d88a45db54c5bb79cf9653e6cd14cf35d30 Mon Sep 17 00:00:00 2001 From: sunxilin Date: Tue, 4 Nov 2025 10:30:36 +0800 Subject: [PATCH 2/4] Add ARM64 support for Linux and macOS --- .github/workflows/build_node_shared.yml | 41 ++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_node_shared.yml b/.github/workflows/build_node_shared.yml index 7e8aaeb..500f19a 100644 --- a/.github/workflows/build_node_shared.yml +++ b/.github/workflows/build_node_shared.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: include: - # Linux builds + # Linux x64 builds - os: ubuntu-latest platform: linux arch: x64 @@ -28,6 +28,21 @@ jobs: container: ghcr.io/ten-framework/ten_building_ubuntu2204 lib_name: libnode.so.127 nproc_cmd: nproc + # Linux ARM64 builds + - os: ubuntu-24.04-arm + platform: linux + arch: arm64 + compiler: gcc + container: "" + lib_name: libnode.so.127 + nproc_cmd: nproc + - os: ubuntu-24.04-arm + platform: linux + arch: arm64 + compiler: clang + container: "" + lib_name: libnode.so.127 + nproc_cmd: nproc # macOS x64 builds - os: macos-13 platform: mac @@ -43,6 +58,21 @@ jobs: container: "" lib_name: libnode.127.dylib nproc_cmd: sysctl -n hw.ncpu + # macOS ARM64 builds + - os: macos-14 + platform: mac + arch: arm64 + compiler: gcc + container: "" + lib_name: libnode.127.dylib + nproc_cmd: sysctl -n hw.ncpu + - os: macos-14 + platform: mac + arch: arm64 + compiler: clang + container: "" + lib_name: libnode.127.dylib + nproc_cmd: sysctl -n hw.ncpu runs-on: ${{ matrix.os }} container: ${{ matrix.container != '' && matrix.container || null }} @@ -54,6 +84,15 @@ jobs: repository: nodejs/node ref: v22.12.0 + - name: Setup dependencies (Linux ARM64) + if: matrix.platform == 'linux' && matrix.arch == 'arm64' + run: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip build-essential + if [ "${{ matrix.compiler }}" = "clang" ]; then + sudo apt-get install -y clang + fi + - name: Setup Python (macOS) if: matrix.platform == 'mac' uses: actions/setup-python@v5 From 31855d8768fdfea3f6889ac6e72bef3ec9b50177 Mon Sep 17 00:00:00 2001 From: sunxilin Date: Tue, 4 Nov 2025 10:33:49 +0800 Subject: [PATCH 3/4] Remove macOS ARM64 GCC support - not compatible with Apple Silicon --- .github/workflows/build_node_shared.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/build_node_shared.yml b/.github/workflows/build_node_shared.yml index 500f19a..ad2ce4f 100644 --- a/.github/workflows/build_node_shared.yml +++ b/.github/workflows/build_node_shared.yml @@ -59,13 +59,7 @@ jobs: lib_name: libnode.127.dylib nproc_cmd: sysctl -n hw.ncpu # macOS ARM64 builds - - os: macos-14 - platform: mac - arch: arm64 - compiler: gcc - container: "" - lib_name: libnode.127.dylib - nproc_cmd: sysctl -n hw.ncpu + # Note: GCC is not supported on Apple Silicon, only Clang is available - os: macos-14 platform: mac arch: arm64 From 37557457bbb37cf0bfc7de0b7268e1940f5c4474 Mon Sep 17 00:00:00 2001 From: sunxilin Date: Tue, 4 Nov 2025 10:37:29 +0800 Subject: [PATCH 4/4] Remove all macOS GCC support - use Clang only on macOS --- .github/workflows/build_node_shared.yml | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build_node_shared.yml b/.github/workflows/build_node_shared.yml index ad2ce4f..079893f 100644 --- a/.github/workflows/build_node_shared.yml +++ b/.github/workflows/build_node_shared.yml @@ -44,13 +44,7 @@ jobs: lib_name: libnode.so.127 nproc_cmd: nproc # macOS x64 builds - - os: macos-13 - platform: mac - arch: x64 - compiler: gcc - container: "" - lib_name: libnode.127.dylib - nproc_cmd: sysctl -n hw.ncpu + # Note: macOS should use Clang (Apple's official toolchain), GCC has compatibility issues - os: macos-13 platform: mac arch: x64 @@ -59,7 +53,7 @@ jobs: lib_name: libnode.127.dylib nproc_cmd: sysctl -n hw.ncpu # macOS ARM64 builds - # Note: GCC is not supported on Apple Silicon, only Clang is available + # Note: Apple Silicon only supports Clang - os: macos-14 platform: mac arch: arm64 @@ -93,21 +87,11 @@ jobs: with: python-version: '3.11' - - name: Install GCC (macOS) - if: matrix.platform == 'mac' && matrix.compiler == 'gcc' - run: | - brew install gcc@13 - echo "CC=$(brew --prefix gcc@13)/bin/gcc-13" >> $GITHUB_ENV - echo "CXX=$(brew --prefix gcc@13)/bin/g++-13" >> $GITHUB_ENV - - name: Configure and Build run: | if [ "${{ matrix.compiler }}" = "gcc" ]; then - # CC and CXX already set for macOS GCC via GITHUB_ENV - if [ "${{ matrix.platform }}" != "mac" ]; then - export CC=gcc - export CXX=g++ - fi + export CC=gcc + export CXX=g++ else export CC=clang export CXX=clang++