Skip to content

Commit ac4e1fa

Browse files
committed
ci(client-cpp): add glibc224 packages with explicit CXX11 ABI on manylinux_2_24
Add linux-*-glibc224 zips built on manylinux_2_24 with -D_GLIBCXX_USE_CXX11_ABI=1 wired through Session and Thrift. Document glibc224 as recommended over glibc217 for modern distros.
1 parent 3501aac commit ac4e1fa

9 files changed

Lines changed: 312 additions & 27 deletions

File tree

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+
# manylinux_2_24 baseline; explicit CXX11 libstdc++ ABI; max glibc 2.24.
18+
set -euxo pipefail
19+
20+
MAX_GLIBC=2.24
21+
IOTDB_EXTRA_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=1
22+
23+
MACHINE=$(uname -m)
24+
case "${MACHINE}" in
25+
x86_64)
26+
CMAKE_PKG_ARCH=linux-x86_64
27+
JDK_API_ARCH=linux/x64
28+
DEFAULT_CLASSIFIER=linux-x86_64-glibc224
29+
;;
30+
aarch64)
31+
CMAKE_PKG_ARCH=linux-aarch64
32+
JDK_API_ARCH=linux/aarch64
33+
DEFAULT_CLASSIFIER=linux-aarch64-glibc224
34+
;;
35+
*)
36+
echo "Unsupported architecture: ${MACHINE}" >&2
37+
exit 1
38+
;;
39+
esac
40+
41+
PACKAGE_CLASSIFIER="${PACKAGE_CLASSIFIER:-${DEFAULT_CLASSIFIER}}"
42+
43+
CMAKE_VERSION=3.28.4
44+
CMAKE_DIR="/opt/cmake-${CMAKE_VERSION}"
45+
if [[ ! -x "${CMAKE_DIR}/bin/cmake" ]]; then
46+
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"
47+
rm -rf "${CMAKE_DIR}"
48+
mkdir -p /opt
49+
tar xf /tmp/cmake.tar.gz -C /opt
50+
mv "/opt/cmake-${CMAKE_VERSION}-${CMAKE_PKG_ARCH}" "${CMAKE_DIR}"
51+
fi
52+
53+
JAVA_HOME=/opt/jdk-17
54+
if [[ ! -x "${JAVA_HOME}/bin/java" ]]; then
55+
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"
56+
rm -rf /opt/jdk-17*
57+
mkdir -p /opt
58+
tar xf /tmp/jdk17.tar.gz -C /opt
59+
JAVA_HOME=$(find /opt -maxdepth 1 -type d -name 'jdk-17*' -print -quit)
60+
ln -sfn "${JAVA_HOME}" /opt/jdk-17
61+
JAVA_HOME=/opt/jdk-17
62+
fi
63+
64+
export PATH="${CMAKE_DIR}/bin:${JAVA_HOME}/bin:${PATH}"
65+
export JAVA_HOME
66+
67+
echo "=== Toolchain ==="
68+
command -v gcc g++ || true
69+
gcc --version | head -1
70+
g++ --version | head -1
71+
g++ -dM -E -x c++ /dev/null | grep GLIBCXX_USE_CXX11_ABI || true
72+
cmake --version
73+
java -version
74+
75+
cd "${GITHUB_WORKSPACE:?GITHUB_WORKSPACE is not set}"
76+
./mvnw clean package -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests \
77+
-Dspotless.skip=true \
78+
-Dclient.cpp.package.classifier="${PACKAGE_CLASSIFIER}" \
79+
"-Diotdb.extra.cxx.flags=${IOTDB_EXTRA_CXX_FLAGS}"
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 "=== Example link test (default g++) ==="
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, 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, 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, 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: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,20 @@ 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, CXX11 ABI (**recommended**) | `linux-x86_64-glibc224` |
51+
| Linux aarch64, glibc ≥ 2.24, CXX11 ABI (**recommended**) | `linux-aarch64-glibc224` |
52+
| Linux x86_64, glibc ≥ 2.17, legacy ABI | `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 host has
61+
glibc ≥ 2.24 and you use the default `g++`. Use **`glibc217`** only for glibc 2.17
62+
systems or legacy ABI; on Ubuntu 22/24 you may need `-D_GLIBCXX_USE_CXX11_ABI=0`
63+
when linking against `glibc217`. See [client-cpp README](../../iotdb-client/client-cpp/README.md).
6164

6265
## SDK layout (after unpack)
6366

example/client-cpp-example/README_zh.md

Lines changed: 8 additions & 4 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,CXX11 ABI(**推荐**| `linux-x86_64-glibc224` |
50+
| Linux aarch64,glibc ≥ 2.24,CXX11 ABI(**推荐**| `linux-aarch64-glibc224` |
51+
| Linux x86_64,glibc ≥ 2.17,旧 libstdc++ ABI | `linux-x86_64-glibc217` |
52+
| Linux aarch64,glibc ≥ 2.17,旧 libstdc++ 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,**不再**通过
5658
`-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))。
59+
Linux 上若部署机 glibc ≥ 2.24 且使用系统默认 `g++`,请优先选用 **`glibc224`**
60+
包。仅当目标机停留在 glibc 2.17(如 CentOS 7)或必须与旧 libstdc++ ABI 一致时,
61+
选用 **`glibc217`** 包;在 Ubuntu 22/24 上链 `glibc217` 时常需
62+
`-D_GLIBCXX_USE_CXX11_ABI=0`。详见 [client-cpp README](../../iotdb-client/client-cpp/README.md)
5963

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

iotdb-client/client-cpp/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ endif()
3434

3535
if(NOT MSVC)
3636
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -O2")
37+
if(IOTDB_EXTRA_CXX_FLAGS)
38+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IOTDB_EXTRA_CXX_FLAGS}")
39+
endif()
3740
endif()
3841

3942
if(MSVC)
@@ -44,6 +47,8 @@ endif()
4447
option(WITH_SSL "Build with OpenSSL support" OFF)
4548
option(BUILD_TESTING "Build IT test executables" OFF)
4649
option(IOTDB_OFFLINE "Disable all network access during configure" OFF)
50+
set(IOTDB_EXTRA_CXX_FLAGS ""
51+
CACHE STRING "Extra flags appended to CMAKE_CXX_FLAGS (e.g. libstdc++ ABI for release zips)")
4752

4853
set(IOTDB_DEPS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third-party"
4954
CACHE PATH "Local tarball cache for third-party dependencies (lives under client-cpp/)")

iotdb-client/client-cpp/README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ deployment environment:
7979

8080
| Target environment | Zip classifier (suffix) |
8181
|--------------------|-------------------------|
82-
| Linux x86_64, glibc ≥ 2.17 | `linux-x86_64-glibc217` |
83-
| Linux aarch64, glibc ≥ 2.17 | `linux-aarch64-glibc217` |
82+
| Linux x86_64, glibc ≥ 2.24, CXX11 ABI (**recommended**) | `linux-x86_64-glibc224` |
83+
| Linux aarch64, glibc ≥ 2.24, CXX11 ABI (**recommended**) | `linux-aarch64-glibc224` |
84+
| Linux x86_64, glibc ≥ 2.17, legacy libstdc++ ABI | `linux-x86_64-glibc217` |
85+
| Linux aarch64, glibc ≥ 2.17, legacy libstdc++ ABI | `linux-aarch64-glibc217` |
8486
| macOS x86_64 | `mac-x86_64` |
8587
| macOS arm64 | `mac-aarch64` |
8688
| Windows + Visual Studio 2017 | `windows-x86_64-vs2017` |
@@ -89,7 +91,17 @@ deployment environment:
8991
| Windows + Visual Studio 2026 | `windows-x86_64-vs2026` |
9092

9193
Example file name:
92-
`client-cpp-2.0.7-SNAPSHOT-linux-x86_64-glibc217.zip`.
94+
`client-cpp-2.0.7-SNAPSHOT-linux-x86_64-glibc224.zip`.
95+
96+
**Linux package choice:** Prefer **`glibc224`** when the deployment host has
97+
**glibc ≥ 2.24** and you build your application with the system default `g++`
98+
(Ubuntu 18.04+, recent Kylin, etc.)—no extra ABI macros needed. Use **`glibc217`**
99+
only when the host is stuck on **glibc 2.17** (e.g. CentOS 7) or you must match
100+
the **legacy** libstdc++ ABI; on a modern dev machine linking against `glibc217`
101+
often requires `-D_GLIBCXX_USE_CXX11_ABI=0`. The `glibc224` zip is built in CI
102+
with `-D_GLIBCXX_USE_CXX11_ABI=1` (Session + Thrift); `glibc217` uses the
103+
manylinux2014 default toolchain (legacy ABI). The `manylinux_2_24` image series
104+
is EOL but remains a common PEP 600 baseline for glibc 2.24.
93105

94106
Thrift **0.21.0** is compiled from source during the CMake configure step (see
95107
`cmake/FetchThrift.cmake`). Older releases that used pre-built
@@ -100,8 +112,15 @@ and OS used to build** the SDK, not by that Maven property.
100112

101113
### Local build for a specific classifier
102114

103-
Linux x86_64 (glibc 2.17 baseline — use CentOS 7 + devtoolset-8, or any host
104-
whose glibc is ≤ your deployment target):
115+
Linux x86_64 (glibc 2.24 + CXX11 ABI — match `manylinux_2_24` release builds):
116+
117+
```bash
118+
mvn -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests \
119+
-Dclient.cpp.package.classifier=linux-x86_64-glibc224 \
120+
-Diotdb.extra.cxx.flags=-D_GLIBCXX_USE_CXX11_ABI=1 package
121+
```
122+
123+
Linux x86_64 (glibc 2.17 + legacy ABI — CentOS 7 / manylinux2014):
105124

106125
```bash
107126
mvn -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests \

0 commit comments

Comments
 (0)