Skip to content

Commit 36e96ca

Browse files
fix(NODE-7227): build glibc prebuilds on platforms with libc 2.28 (#93)
1 parent 3e29762 commit 36e96ca

File tree

5 files changed

+32
-15
lines changed

5 files changed

+32
-15
lines changed

.github/docker/Dockerfile.glibc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:noble AS build
1+
FROM redhat/ubi8 AS build
22
ARG NODE_VERSION=20.19.3
33
# Possible values: s390x, arm64, x64
44
ARG NODE_ARCH
@@ -9,8 +9,9 @@ ENV PATH=$PATH:/nodejs/bin
99
WORKDIR /zstd
1010
COPY . .
1111

12-
RUN apt-get -qq update
13-
RUN apt-get -qq install -y python3 build-essential curl cmake
12+
RUN yum install -y python39 git make curl cmake gcc-toolset-14
13+
ENV PATH=/opt/rh/gcc-toolset-14/root/bin/:$PATH
14+
1415
RUN python3 --version
1516

1617
RUN npm run install-zstd

binding.gyp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,19 @@
5151
],
5252
'cflags!': [ '-fno-exceptions' ],
5353
'cflags_cc!': [ '-fno-exceptions' ],
54-
'cflags_cc': ['-std=c++17'],
54+
'cflags_cc': [],
5555
'xcode_settings': {
5656
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
5757
'CLANG_CXX_LIBRARY': 'libc++',
5858
'MACOSX_DEPLOYMENT_TARGET': '11',
5959
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
6060
'OTHER_CFLAGS': [
61-
'-std=c++17',
6261
'-stdlib=libc++'
6362
],
6463
},
6564
'msvs_settings': {
6665
'VCCLCompilerTool': {
67-
'ExceptionHandling': 1,
68-
'AdditionalOptions': [
69-
'-std:c++17'
70-
]
66+
'ExceptionHandling': 1
7167
}
7268
},
7369
}]

etc/docker.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
# s390x, arm64, amd64 for ubuntu
77
# amd64 or arm64v8 for alpine
8-
LINUX_ARCH=arm64
8+
LINUX_ARCH=amd64
99

10-
NODE_VERSION=20.19.0
10+
NODE_VERSION=24.9.0
1111

1212
SCRIPT_DIR=$(dirname ${BASH_SOURCE:-$0})
1313
PROJECT_DIR=$SCRIPT_DIR/..
@@ -33,10 +33,9 @@ build_and_test_glibc() {
3333
--build-arg="NODE_ARCH=$NODE_ARCH" \
3434
--build-arg="NODE_VERSION=$NODE_VERSION" \
3535
--build-arg="RUN_TEST=true" \
36-
--output type=local,dest=./prebuilds,platform-split=false \
37-
-f ./.github/docker/Dockerfile.glibc \
36+
-f ./.github/docker/Dockerfile.glibc -t glibc-zstd-base \
3837
$PROJECT_DIR
3938
}
4039

4140

42-
build_and_test_musl
41+
build_and_test_glibc

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"install": "prebuild-install --runtime napi || npm run clean-install",
3636
"clean-install": "npm run install-zstd && npm run compile",
3737
"compile": "node-gyp rebuild",
38-
"test": "mocha test/index.test.js",
38+
"test": "mocha test/*.js",
3939
"install-zstd": "bash etc/install-zstd.sh",
4040
"check:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint *ts lib/*.js test/*.js .*.json",
4141
"clang-format": "clang-format --style=file:.clang-format --Werror -i addon/*",

test/glibc.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { expect } from 'chai';
2+
import { execSync } from 'child_process';
3+
4+
describe('glibc requirements', function () {
5+
let lddOutput;
6+
beforeEach(function () {
7+
if (process.platform !== 'linux') return this.skip();
8+
9+
try {
10+
lddOutput = execSync('ldd --version', { encoding: 'utf8' });
11+
} catch {
12+
this.skip();
13+
}
14+
15+
return;
16+
});
17+
18+
it('glibc is 2.28', function () {
19+
expect(lddOutput).to.contain('2.28');
20+
});
21+
});

0 commit comments

Comments
 (0)