Skip to content

Commit 1992ab4

Browse files
committed
ci(client-cpp): add glibc224 packages on manylinux_2_24 for native CXX11 ABI
Publish linux-*-glibc224 zips (cxx11 ABI, glibc >= 2.24) alongside existing glibc217 legacy ABI packages. Harden glibc217 script with explicit ABI=0 and link tests.
1 parent 3501aac commit 1992ab4

6 files changed

Lines changed: 303 additions & 21 deletions

File tree

‎.github/scripts/package-client-cpp-manylinux-glibc217.sh‎

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
#
17-
# Build client-cpp in manylinux2014 and verify max required GLIBC symbol <= 2.17.
17+
# Legacy libstdc++ ABI (_GLIBCXX_USE_CXX11_ABI=0) on manylinux2014; max glibc 2.17.
1818
set -euxo pipefail
1919

20+
MAX_GLIBC=2.17
21+
SYSTEM_GCC=/usr/bin/gcc
22+
SYSTEM_GXX=/usr/bin/g++
23+
2024
MACHINE=$(uname -m)
2125
case "${MACHINE}" in
2226
x86_64)
@@ -58,10 +62,16 @@ if [[ ! -x "${JAVA_HOME}/bin/java" ]]; then
5862
JAVA_HOME=/opt/jdk-17
5963
fi
6064

61-
export PATH="${CMAKE_DIR}/bin:${JAVA_HOME}/bin:${PATH}"
65+
export PATH="${CMAKE_DIR}/bin:${JAVA_HOME}/bin:/usr/bin:${PATH}"
6266
export JAVA_HOME
6367

64-
gcc --version
68+
export CC="${SYSTEM_GCC}"
69+
export CXX="${SYSTEM_GXX}"
70+
export CFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 ${CFLAGS:-}"
71+
export CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 ${CXXFLAGS:-}"
72+
73+
"${SYSTEM_GCC}" --version
74+
"${SYSTEM_GXX}" --version
6575
cmake --version
6676
java -version
6777

@@ -73,6 +83,13 @@ cd "${GITHUB_WORKSPACE:?GITHUB_WORKSPACE is not set}"
7383
SO="iotdb-client/client-cpp/target/install/lib/libiotdb_session.so"
7484
test -f "${SO}"
7585

86+
echo "=== libstdc++ ABI check (legacy: must not contain __cxx11) ==="
87+
if nm -C "${SO}" 2>/dev/null | grep -q '__cxx11'; then
88+
echo "ERROR: legacy ABI build must not contain __cxx11 symbols in ${SO}"
89+
exit 1
90+
fi
91+
echo "ABI check passed (no __cxx11 symbols)"
92+
7693
echo "=== Build host glibc ==="
7794
ldd --version 2>&1 | sed -n '1p'
7895

@@ -82,9 +99,24 @@ objdump -T "${SO}" | grep GLIBC_ | sed "s/.*GLIBC_/GLIBC_/" | sort -Vu | tail -1
8299
max_glibc=$(objdump -T "${SO}" | grep -oE "GLIBC_[0-9.]+" | sed "s/GLIBC_//" | sort -t. -k1,1n -k2,2n -k3,3n | tail -1)
83100
echo "max_glibc=${max_glibc}"
84101

85-
if awk -v max="${max_glibc}" "BEGIN { exit !(max > 2.17) }"; then
86-
echo "ERROR: libiotdb_session.so requires glibc > 2.17 (max=${max_glibc})"
102+
if awk -v max="${max_glibc}" -v limit="${MAX_GLIBC}" 'BEGIN { exit !(max > limit) }'; then
103+
echo "ERROR: libiotdb_session.so requires glibc > ${MAX_GLIBC} (max=${max_glibc})"
87104
exit 1
88105
fi
89106

90-
echo "glibc compatibility check passed (max=${max_glibc} <= 2.17)"
107+
echo "glibc compatibility check passed (max=${max_glibc} <= ${MAX_GLIBC})"
108+
109+
echo "=== Optional example link test (legacy ABI) ==="
110+
INSTALL_ROOT="${GITHUB_WORKSPACE}/iotdb-client/client-cpp/target/install"
111+
EXAMPLE_SRC="${GITHUB_WORKSPACE}/example/client-cpp-example/src"
112+
LINKTEST_BUILD="/tmp/client-cpp-example-linktest-glibc217"
113+
rm -rf "${LINKTEST_BUILD}"
114+
mkdir -p "${LINKTEST_BUILD}"
115+
unset CC CXX CFLAGS CXXFLAGS
116+
"${CMAKE_DIR}/bin/cmake" -S "${EXAMPLE_SRC}" -B "${LINKTEST_BUILD}" \
117+
-DCMAKE_BUILD_TYPE=Release \
118+
-DIOTDB_SDK_ROOT="${INSTALL_ROOT}" \
119+
-DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0
120+
"${CMAKE_DIR}/bin/cmake" --build "${LINKTEST_BUILD}" --target SessionExample -j"$(nproc)"
121+
test -x "${LINKTEST_BUILD}/SessionExample"
122+
echo "Example link test passed"
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
#!/usr/bin/env bash
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with this
4+
# work for additional information regarding copyright ownership. The ASF
5+
# licenses this file to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance with the
7+
# License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# Default libstdc++ cxx11 ABI on manylinux_2_24; max glibc 2.24.
18+
set -euxo pipefail
19+
20+
MAX_GLIBC=2.24
21+
SYSTEM_GCC=/usr/bin/gcc
22+
SYSTEM_GXX=/usr/bin/g++
23+
24+
MACHINE=$(uname -m)
25+
case "${MACHINE}" in
26+
x86_64)
27+
CMAKE_PKG_ARCH=linux-x86_64
28+
JDK_API_ARCH=linux/x64
29+
DEFAULT_CLASSIFIER=linux-x86_64-glibc224
30+
;;
31+
aarch64)
32+
CMAKE_PKG_ARCH=linux-aarch64
33+
JDK_API_ARCH=linux/aarch64
34+
DEFAULT_CLASSIFIER=linux-aarch64-glibc224
35+
;;
36+
*)
37+
echo "Unsupported architecture: ${MACHINE}" >&2
38+
exit 1
39+
;;
40+
esac
41+
42+
PACKAGE_CLASSIFIER="${PACKAGE_CLASSIFIER:-${DEFAULT_CLASSIFIER}}"
43+
44+
CMAKE_VERSION=3.28.4
45+
CMAKE_DIR="/opt/cmake-${CMAKE_VERSION}"
46+
if [[ ! -x "${CMAKE_DIR}/bin/cmake" ]]; then
47+
curl -fsSL -o /tmp/cmake.tar.gz "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-${CMAKE_PKG_ARCH}.tar.gz"
48+
rm -rf "${CMAKE_DIR}"
49+
mkdir -p /opt
50+
tar xf /tmp/cmake.tar.gz -C /opt
51+
mv "/opt/cmake-${CMAKE_VERSION}-${CMAKE_PKG_ARCH}" "${CMAKE_DIR}"
52+
fi
53+
54+
JAVA_HOME=/opt/jdk-17
55+
if [[ ! -x "${JAVA_HOME}/bin/java" ]]; then
56+
curl -fsSL -o /tmp/jdk17.tar.gz "https://api.adoptium.net/v3/binary/latest/17/ga/${JDK_API_ARCH}/jdk/hotspot/normal/eclipse?project=jdk"
57+
rm -rf /opt/jdk-17*
58+
mkdir -p /opt
59+
tar xf /tmp/jdk17.tar.gz -C /opt
60+
JAVA_HOME=$(find /opt -maxdepth 1 -type d -name 'jdk-17*' -print -quit)
61+
ln -sfn "${JAVA_HOME}" /opt/jdk-17
62+
JAVA_HOME=/opt/jdk-17
63+
fi
64+
65+
export PATH="${CMAKE_DIR}/bin:${JAVA_HOME}/bin:/usr/bin:${PATH}"
66+
export JAVA_HOME
67+
68+
export CC="${SYSTEM_GCC}"
69+
export CXX="${SYSTEM_GXX}"
70+
71+
"${SYSTEM_GCC}" --version
72+
"${SYSTEM_GXX}" --version
73+
cmake --version
74+
java -version
75+
76+
cd "${GITHUB_WORKSPACE:?GITHUB_WORKSPACE is not set}"
77+
./mvnw clean package -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests \
78+
-Dspotless.skip=true \
79+
-Dclient.cpp.package.classifier="${PACKAGE_CLASSIFIER}"
80+
81+
SO="iotdb-client/client-cpp/target/install/lib/libiotdb_session.so"
82+
test -f "${SO}"
83+
84+
echo "=== libstdc++ ABI check (cxx11: must contain __cxx11) ==="
85+
if ! nm -C "${SO}" 2>/dev/null | grep -q '__cxx11'; then
86+
echo "ERROR: cxx11 ABI build must contain __cxx11 symbols in ${SO}"
87+
exit 1
88+
fi
89+
echo "ABI check passed (__cxx11 symbols present)"
90+
91+
echo "=== Build host glibc ==="
92+
ldd --version 2>&1 | sed -n '1p'
93+
94+
echo "=== Highest GLIBC_* symbols in libiotdb_session.so ==="
95+
objdump -T "${SO}" | grep GLIBC_ | sed "s/.*GLIBC_/GLIBC_/" | sort -Vu | tail -10
96+
97+
max_glibc=$(objdump -T "${SO}" | grep -oE "GLIBC_[0-9.]+" | sed "s/GLIBC_//" | sort -t. -k1,1n -k2,2n -k3,3n | tail -1)
98+
echo "max_glibc=${max_glibc}"
99+
100+
if awk -v max="${max_glibc}" -v limit="${MAX_GLIBC}" 'BEGIN { exit !(max > limit) }'; then
101+
echo "ERROR: libiotdb_session.so requires glibc > ${MAX_GLIBC} (max=${max_glibc})"
102+
exit 1
103+
fi
104+
105+
echo "glibc compatibility check passed (max=${max_glibc} <= ${MAX_GLIBC})"
106+
107+
echo "=== Optional example link test (default cxx11 ABI) ==="
108+
INSTALL_ROOT="${GITHUB_WORKSPACE}/iotdb-client/client-cpp/target/install"
109+
EXAMPLE_SRC="${GITHUB_WORKSPACE}/example/client-cpp-example/src"
110+
LINKTEST_BUILD="/tmp/client-cpp-example-linktest-glibc224"
111+
rm -rf "${LINKTEST_BUILD}"
112+
mkdir -p "${LINKTEST_BUILD}"
113+
unset CC CXX CFLAGS CXXFLAGS
114+
"${CMAKE_DIR}/bin/cmake" -S "${EXAMPLE_SRC}" -B "${LINKTEST_BUILD}" \
115+
-DCMAKE_BUILD_TYPE=Release \
116+
-DIOTDB_SDK_ROOT="${INSTALL_ROOT}"
117+
"${CMAKE_DIR}/bin/cmake" --build "${LINKTEST_BUILD}" --target SessionExample -j"$(nproc)"
118+
test -x "${LINKTEST_BUILD}/SessionExample"
119+
echo "Example link test passed"

‎.github/workflows/client-cpp-package.yml‎

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,106 @@ jobs:
257257
path: ${{ steps.pkg.outputs.path }}
258258
if-no-files-found: error
259259

260+
package-linux-glibc224:
261+
name: Package (linux-x86_64-glibc224)
262+
needs: [should-package, resolve-matrix]
263+
if: needs.should-package.outputs.run == 'true' && needs.resolve-matrix.outputs.run_linux == 'true'
264+
# Checkout/cache on host; build in manylinux_2_24 via docker run (glibc 2.24 baseline, cxx11 ABI).
265+
runs-on: ubuntu-latest
266+
steps:
267+
- uses: actions/checkout@v5
268+
- name: Cache Maven packages
269+
uses: actions/cache@v5
270+
with:
271+
path: ~/.m2
272+
key: linux-glibc224-m2-${{ hashFiles('**/pom.xml') }}
273+
restore-keys: |
274+
linux-glibc224-m2-
275+
- name: Package client-cpp (glibc 2.24 baseline, cxx11 ABI)
276+
shell: bash
277+
run: |
278+
set -euxo pipefail
279+
chmod +x .github/scripts/package-client-cpp-manylinux-glibc224.sh
280+
docker run --rm \
281+
-v "${{ github.workspace }}:/workspace" \
282+
-v "${HOME}/.m2:/root/.m2" \
283+
-w /workspace \
284+
-e GITHUB_WORKSPACE=/workspace \
285+
quay.io/pypa/manylinux_2_24_x86_64 \
286+
bash .github/scripts/package-client-cpp-manylinux-glibc224.sh
287+
- name: Restore workspace ownership after container build
288+
if: always()
289+
run: sudo chown -R "$(id -u):$(id -g)" "${{ github.workspace }}"
290+
- name: Resolve package zip
291+
id: pkg
292+
shell: bash
293+
run: |
294+
set -euo pipefail
295+
shopt -s nullglob
296+
zips=(iotdb-client/client-cpp/target/client-cpp-*-linux-x86_64-glibc224.zip)
297+
if [ "${#zips[@]}" -ne 1 ]; then
298+
echo "Expected exactly one package zip, got: ${zips[*]:-(none)}"
299+
exit 1
300+
fi
301+
echo "path=${zips[0]}" >> "$GITHUB_OUTPUT"
302+
echo "name=$(basename "${zips[0]}" .zip)" >> "$GITHUB_OUTPUT"
303+
- name: Upload zip artifact
304+
uses: actions/upload-artifact@v6
305+
with:
306+
name: ${{ steps.pkg.outputs.name }}
307+
path: ${{ steps.pkg.outputs.path }}
308+
if-no-files-found: error
309+
310+
package-linux-aarch64-glibc224:
311+
name: Package (linux-aarch64-glibc224)
312+
needs: [should-package, resolve-matrix]
313+
if: needs.should-package.outputs.run == 'true' && needs.resolve-matrix.outputs.run_linux == 'true'
314+
# Checkout/cache on host; build in manylinux_2_24 aarch64 via docker run.
315+
runs-on: ubuntu-22.04-arm
316+
steps:
317+
- uses: actions/checkout@v5
318+
- name: Cache Maven packages
319+
uses: actions/cache@v5
320+
with:
321+
path: ~/.m2
322+
key: linux-aarch64-glibc224-m2-${{ hashFiles('**/pom.xml') }}
323+
restore-keys: |
324+
linux-aarch64-glibc224-m2-
325+
- name: Package client-cpp (glibc 2.24 baseline, cxx11 ABI)
326+
shell: bash
327+
run: |
328+
set -euxo pipefail
329+
chmod +x .github/scripts/package-client-cpp-manylinux-glibc224.sh
330+
docker run --rm \
331+
-v "${{ github.workspace }}:/workspace" \
332+
-v "${HOME}/.m2:/root/.m2" \
333+
-w /workspace \
334+
-e GITHUB_WORKSPACE=/workspace \
335+
quay.io/pypa/manylinux_2_24_aarch64 \
336+
bash .github/scripts/package-client-cpp-manylinux-glibc224.sh
337+
- name: Restore workspace ownership after container build
338+
if: always()
339+
run: sudo chown -R "$(id -u):$(id -g)" "${{ github.workspace }}"
340+
- name: Resolve package zip
341+
id: pkg
342+
shell: bash
343+
run: |
344+
set -euo pipefail
345+
shopt -s nullglob
346+
zips=(iotdb-client/client-cpp/target/client-cpp-*-linux-aarch64-glibc224.zip)
347+
if [ "${#zips[@]}" -ne 1 ]; then
348+
echo "Expected exactly one package zip, got: ${zips[*]:-(none)}"
349+
exit 1
350+
fi
351+
echo "path=${zips[0]}" >> "$GITHUB_OUTPUT"
352+
echo "name=$(basename "${zips[0]}" .zip)" >> "$GITHUB_OUTPUT"
353+
- name: Upload zip artifact
354+
uses: actions/upload-artifact@v6
355+
with:
356+
name: ${{ steps.pkg.outputs.name }}
357+
path: ${{ steps.pkg.outputs.path }}
358+
if-no-files-found: error
359+
260360
package-macos:
261361
name: Package (${{ matrix.name }})
262362
needs: [should-package, resolve-matrix]

‎example/client-cpp-example/README.md‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,21 @@ publishes one zip per platform/toolchain:
4747

4848
| Deployment target | Classifier suffix |
4949
|-------------------|-------------------|
50-
| Linux x86_64, glibc ≥ 2.17 | `linux-x86_64-glibc217` |
51-
| Linux aarch64, glibc ≥ 2.17 | `linux-aarch64-glibc217` |
50+
| Linux x86_64, glibc ≥ 2.24 (default g++, cxx11 ABI) | `linux-x86_64-glibc224` |
51+
| Linux aarch64, glibc ≥ 2.24 (default g++, cxx11 ABI) | `linux-aarch64-glibc224` |
52+
| Linux x86_64, glibc ≥ 2.17 (legacy ABI, app needs `-D_GLIBCXX_USE_CXX11_ABI=0`) | `linux-x86_64-glibc217` |
53+
| Linux aarch64, glibc ≥ 2.17 (legacy ABI) | `linux-aarch64-glibc217` |
5254
| macOS x86_64 | `mac-x86_64` |
5355
| macOS arm64 | `mac-aarch64` |
5456
| Windows (match your Visual Studio version) | `windows-x86_64-vs2017` … `vs2026` |
5557

5658
The current build compiles Thrift 0.21 from source at CMake configure time.
5759
Legacy `-Diotdb-tools-thrift.version=...` flags applied to the **old**
58-
pre-built Thrift workflow only; for glibc 2.17 on x86_64 use the
59-
`linux-x86_64-glibc217` artifact or build on an old enough host (see
60-
[client-cpp README](../../iotdb-client/client-cpp/README.md)).
60+
pre-built Thrift workflow only. On Linux, prefer **`glibc224`** when your
61+
distro has glibc ≥ 2.24 and you build with the default compiler ABI. Use
62+
**`glibc217`** only when the target host cannot run glibc 2.24+ binaries or
63+
when you must match the legacy libstdc++ ABI (`-D_GLIBCXX_USE_CXX11_ABI=0`).
64+
See [client-cpp README](../../iotdb-client/client-cpp/README.md).
6165

6266
## SDK layout (after unpack)
6367

‎example/client-cpp-example/README_zh.md‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,20 @@ CI 发版([client-cpp-package.yml](../../.github/workflows/client-cpp-package.
4646

4747
| 目标环境 | classifier 后缀 |
4848
|----------|-----------------|
49-
| Linux x86_64,glibc ≥ 2.17 | `linux-x86_64-glibc217` |
50-
| Linux aarch64,glibc ≥ 2.17 | `linux-aarch64-glibc217` |
49+
| Linux x86_64,glibc ≥ 2.24(默认 g++,cxx11 ABI) | `linux-x86_64-glibc224` |
50+
| Linux aarch64,glibc ≥ 2.24(默认 g++,cxx11 ABI) | `linux-aarch64-glibc224` |
51+
| Linux x86_64,glibc ≥ 2.17(旧 ABI,应用需 `-D_GLIBCXX_USE_CXX11_ABI=0`) | `linux-x86_64-glibc217` |
52+
| Linux aarch64,glibc ≥ 2.17(旧 ABI) | `linux-aarch64-glibc217` |
5153
| macOS x86_64 | `mac-x86_64` |
5254
| macOS arm64 | `mac-aarch64` |
5355
| Windows + 与工程相同的 VS 版本 | `windows-x86_64-vs2017` … `vs2026` |
5456

5557
当前 CMake 构建在配置阶段从源码编译 Thrift 0.21,**不再**通过
56-
`-Diotdb-tools-thrift.version=0.14.1.1-gcc4-SNAPSHOT` 等旧参数控制 glibc;
57-
x86_64 上若要兼容 glibc 2.17,请使用 `linux-x86_64-glibc217` 包或在
58-
glibc ≤ 2.17 的系统上本地编译(见 [client-cpp README](../../iotdb-client/client-cpp/README.md))。
58+
`-Diotdb-tools-thrift.version=0.14.1.1-gcc4-SNAPSHOT` 等旧参数控制 glibc。
59+
Linux 上若目标机 glibc ≥ 2.24 且使用默认编译器 ABI,请优先选用
60+
**`glibc224`** 包;仅当目标机无法使用 glibc 2.24+ 二进制,或必须与旧
61+
libstdc++ ABI(`-D_GLIBCXX_USE_CXX11_ABI=0`)一致时,才选用 **`glibc217`** 包。
62+
详见 [client-cpp README](../../iotdb-client/client-cpp/README.md)。
5963

6064
## SDK 目录结构(解压后)
6165

0 commit comments

Comments
 (0)