From 12dc36afc6e06d3789a686512d0db77112353f8a Mon Sep 17 00:00:00 2001 From: bailey Date: Mon, 6 Oct 2025 09:52:30 -0600 Subject: [PATCH 1/2] build linux on rhel80 --- .github/docker/Dockerfile.glibc | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/docker/Dockerfile.glibc b/.github/docker/Dockerfile.glibc index 2ca7163..d8ee64a 100644 --- a/.github/docker/Dockerfile.glibc +++ b/.github/docker/Dockerfile.glibc @@ -1,4 +1,4 @@ -FROM ubuntu:noble AS build +FROM redhat/ubi8 AS build ARG NODE_VERSION=20.19.3 # Possible values: s390x, arm64, x64 ARG NODE_ARCH @@ -9,8 +9,8 @@ ENV PATH=$PATH:/nodejs/bin WORKDIR /zstd COPY . . -RUN apt-get -qq update -RUN apt-get -qq install -y python3 build-essential curl cmake +RUN yum install -y python39 git make gcc-c++ curl cmake + RUN python3 --version RUN npm run install-zstd diff --git a/package.json b/package.json index 158da40..a0f2fbe 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "install": "prebuild-install --runtime napi || npm run clean-install", "clean-install": "npm run install-zstd && npm run compile", "compile": "node-gyp rebuild", - "test": "mocha test/index.test.js", + "test": "mocha test/*.js", "install-zstd": "bash etc/install-zstd.sh", "check:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint *ts lib/*.js test/*.js .*.json", "clang-format": "clang-format --style=file:.clang-format --Werror -i addon/*", From 2552139b94ec20d6ab1fe6a0ac736177c94ac2b4 Mon Sep 17 00:00:00 2001 From: bailey Date: Mon, 6 Oct 2025 12:47:19 -0600 Subject: [PATCH 2/2] use gcc 14+ --- .github/docker/Dockerfile.glibc | 3 ++- binding.gyp | 8 ++------ etc/docker.sh | 9 ++++----- test/glibc.test.js | 21 +++++++++++++++++++++ 4 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 test/glibc.test.js diff --git a/.github/docker/Dockerfile.glibc b/.github/docker/Dockerfile.glibc index d8ee64a..f5d9500 100644 --- a/.github/docker/Dockerfile.glibc +++ b/.github/docker/Dockerfile.glibc @@ -9,7 +9,8 @@ ENV PATH=$PATH:/nodejs/bin WORKDIR /zstd COPY . . -RUN yum install -y python39 git make gcc-c++ curl cmake +RUN yum install -y python39 git make curl cmake gcc-toolset-14 +ENV PATH=/opt/rh/gcc-toolset-14/root/bin/:$PATH RUN python3 --version diff --git a/binding.gyp b/binding.gyp index 4aa6259..4bebac1 100644 --- a/binding.gyp +++ b/binding.gyp @@ -51,23 +51,19 @@ ], 'cflags!': [ '-fno-exceptions' ], 'cflags_cc!': [ '-fno-exceptions' ], - 'cflags_cc': ['-std=c++17'], + 'cflags_cc': [], 'xcode_settings': { 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', 'CLANG_CXX_LIBRARY': 'libc++', 'MACOSX_DEPLOYMENT_TARGET': '11', 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden 'OTHER_CFLAGS': [ - '-std=c++17', '-stdlib=libc++' ], }, 'msvs_settings': { 'VCCLCompilerTool': { - 'ExceptionHandling': 1, - 'AdditionalOptions': [ - '-std:c++17' - ] + 'ExceptionHandling': 1 } }, }] diff --git a/etc/docker.sh b/etc/docker.sh index 3b80558..d624b14 100644 --- a/etc/docker.sh +++ b/etc/docker.sh @@ -5,9 +5,9 @@ # s390x, arm64, amd64 for ubuntu # amd64 or arm64v8 for alpine -LINUX_ARCH=arm64 +LINUX_ARCH=amd64 -NODE_VERSION=20.19.0 +NODE_VERSION=24.9.0 SCRIPT_DIR=$(dirname ${BASH_SOURCE:-$0}) PROJECT_DIR=$SCRIPT_DIR/.. @@ -33,10 +33,9 @@ build_and_test_glibc() { --build-arg="NODE_ARCH=$NODE_ARCH" \ --build-arg="NODE_VERSION=$NODE_VERSION" \ --build-arg="RUN_TEST=true" \ - --output type=local,dest=./prebuilds,platform-split=false \ - -f ./.github/docker/Dockerfile.glibc \ + -f ./.github/docker/Dockerfile.glibc -t glibc-zstd-base \ $PROJECT_DIR } -build_and_test_musl \ No newline at end of file +build_and_test_glibc \ No newline at end of file diff --git a/test/glibc.test.js b/test/glibc.test.js new file mode 100644 index 0000000..ae04231 --- /dev/null +++ b/test/glibc.test.js @@ -0,0 +1,21 @@ +import { expect } from 'chai'; +import { execSync } from 'child_process'; + +describe('glibc requirements', function () { + let lddOutput; + beforeEach(function () { + if (process.platform !== 'linux') return this.skip(); + + try { + lddOutput = execSync('ldd --version', { encoding: 'utf8' }); + } catch { + this.skip(); + } + + return; + }); + + it('glibc is 2.28', function () { + expect(lddOutput).to.contain('2.28'); + }); +});