Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/docker/Dockerfile.glibc
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,8 +9,9 @@ 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 curl cmake gcc-toolset-14
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Durran added support for Node24 while working on #80. Node24 requires C++20. However, the gcc-c++ package I installed in FLE and Kerberos uses g++ 8.5, which does not support c++20 with the --g++20 flag, breaking compilation.

gcc-toolset-14 installs g++14, which supports officially c++20. We'll have to make this change in FLE and kerberos when we add support for Node24 after v7 too.

ENV PATH=/opt/rh/gcc-toolset-14/root/bin/:$PATH

RUN python3 --version

RUN npm run install-zstd
Expand Down
8 changes: 2 additions & 6 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,19 @@
],
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
'cflags_cc': ['-std=c++17'],
'cflags_cc': [],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer necessary - Node20 uses c++ 17+ too

(question for @addaleax - is there a place where this is officially documented? best I can find is c++ standard specifications in v20.x/common.gypi)

'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
}
},
}]
Expand Down
9 changes: 4 additions & 5 deletions etc/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/..
Expand All @@ -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 \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nice-to-have. Specifying a tag means you can load this locally without rebuilding the image if you need to debug locally:

> docker run -it glibc-zstd-base

$PROJECT_DIR
}


build_and_test_musl
build_and_test_glibc
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/*",
Expand Down
21 changes: 21 additions & 0 deletions test/glibc.test.js
Original file line number Diff line number Diff line change
@@ -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');
});
});
Loading