Skip to content

Commit ef749c6

Browse files
committed
fix(ci): build glibc217 packages with devtoolset and new CXX11 ABI
1 parent 3501aac commit ef749c6

5 files changed

Lines changed: 51 additions & 3 deletions

File tree

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

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
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+
# Build client-cpp in manylinux2014 with devtoolset (new libstdc++ ABI) and verify
18+
# max required GLIBC symbol <= 2.17.
1819
set -euxo pipefail
1920

2021
MACHINE=$(uname -m)
@@ -61,7 +62,28 @@ fi
6162
export PATH="${CMAKE_DIR}/bin:${JAVA_HOME}/bin:${PATH}"
6263
export JAVA_HOME
6364

65+
# Default container gcc is 4.8 (old libstdc++ ABI). Use devtoolset for GCC 10 + CXX11 ABI.
66+
DEVTOOLSET_ENABLED=false
67+
for ds in 10 9 8; do
68+
if [[ -f "/opt/rh/devtoolset-${ds}/enable" ]]; then
69+
# shellcheck disable=SC1090
70+
source "/opt/rh/devtoolset-${ds}/enable"
71+
echo "Using devtoolset-${ds}"
72+
DEVTOOLSET_ENABLED=true
73+
break
74+
fi
75+
done
76+
if [[ "${DEVTOOLSET_ENABLED}" != true ]]; then
77+
echo "WARNING: no devtoolset found; build may use old libstdc++ ABI" >&2
78+
fi
79+
80+
export CC=gcc
81+
export CXX=g++
82+
export CXXFLAGS="${CXXFLAGS:-} -D_GLIBCXX_USE_CXX11_ABI=1"
83+
export CFLAGS="${CFLAGS:-} -D_GLIBCXX_USE_CXX11_ABI=1"
84+
6485
gcc --version
86+
g++ --version
6587
cmake --version
6688
java -version
6789

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

98+
echo "=== Verify libstdc++ CXX11 ABI in libiotdb_session.so ==="
99+
if ! nm -C "${SO}" | grep -q '__cxx11'; then
100+
echo "ERROR: libiotdb_session.so does not contain std::__cxx11 symbols (old ABI?)" >&2
101+
exit 1
102+
fi
103+
nm -C "${SO}" | grep 'Session::Session' | head -3 || true
104+
76105
echo "=== Build host glibc ==="
77106
ldd --version 2>&1 | sed -n '1p'
78107

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ jobs:
162162
needs: [should-package, resolve-matrix]
163163
if: needs.should-package.outputs.run == 'true' && needs.resolve-matrix.outputs.run_linux == 'true'
164164
# Checkout/cache on host (Node actions need modern glibc); build in manylinux2014 via docker run.
165+
# Script enables devtoolset-10 + new libstdc++ ABI (std::__cxx11); glibc symbols still <= 2.17.
165166
runs-on: ubuntu-latest
166167
steps:
167168
- uses: actions/checkout@v5
@@ -212,6 +213,7 @@ jobs:
212213
needs: [should-package, resolve-matrix]
213214
if: needs.should-package.outputs.run == 'true' && needs.resolve-matrix.outputs.run_linux == 'true'
214215
# Checkout/cache on host; build in manylinux2014 aarch64 via docker run (glibc 2.17 baseline).
216+
# Same devtoolset + new libstdc++ ABI as x86_64 glibc217 job.
215217
runs-on: ubuntu-22.04-arm
216218
steps:
217219
- uses: actions/checkout@v5

example/client-cpp-example/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ publishes one zip per platform/toolchain:
5353
| macOS arm64 | `mac-aarch64` |
5454
| Windows (match your Visual Studio version) | `windows-x86_64-vs2017``vs2026` |
5555

56+
**Linux `linux-*-glibc217` zips** use the **new libstdc++ ABI** (`std::__cxx11`).
57+
Build these examples with default `g++` on modern Linux; do not add
58+
`-D_GLIBCXX_USE_CXX11_ABI=0` unless you link against an older SDK artifact.
59+
5660
The current build compiles Thrift 0.21 from source at CMake configure time.
5761
Legacy `-Diotdb-tools-thrift.version=...` flags applied to the **old**
5862
pre-built Thrift workflow only; for glibc 2.17 on x86_64 use the

example/client-cpp-example/README_zh.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ CI 发版([client-cpp-package.yml](../../.github/workflows/client-cpp-package.
5252
| macOS arm64 | `mac-aarch64` |
5353
| Windows + 与工程相同的 VS 版本 | `windows-x86_64-vs2017``vs2026` |
5454

55+
**Linux `linux-*-glibc217`** 使用 **新版 libstdc++ ABI**`std::__cxx11`)。
56+
在现代 Linux 上用默认 `g++` 编译本示例即可,**不要**
57+
`-D_GLIBCXX_USE_CXX11_ABI=0`,除非你链接的是更早发布的旧 ABI SDK。
58+
5559
当前 CMake 构建在配置阶段从源码编译 Thrift 0.21,**不再**通过
5660
`-Diotdb-tools-thrift.version=0.14.1.1-gcc4-SNAPSHOT` 等旧参数控制 glibc;
5761
x86_64 上若要兼容 glibc 2.17,请使用 `linux-x86_64-glibc217` 包或在

iotdb-client/client-cpp/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ deployment environment:
9191
Example file name:
9292
`client-cpp-2.0.7-SNAPSHOT-linux-x86_64-glibc217.zip`.
9393

94+
**Linux `linux-*-glibc217` packages (libstdc++ ABI):** CI builds inside
95+
`manylinux2014` with **devtoolset-10** and the **new C++11 ABI**
96+
(`std::__cxx11::…`). Link your application with a normal GCC 5+ toolchain
97+
(Ubuntu 22.04, Kylin V10, etc.) — you do **not** need
98+
`-D_GLIBCXX_USE_CXX11_ABI=0`. If you see
99+
`undefined reference to … std::__cxx11::basic_string …`, you may be using an
100+
**older** zip built before this change; download a fresh artifact or match ABI
101+
when linking.
102+
94103
Thrift **0.21.0** is compiled from source during the CMake configure step (see
95104
`cmake/FetchThrift.cmake`). Older releases that used pre-built
96105
`iotdb-tools-thrift` Maven artifacts and `-Diotdb-tools-thrift.version=...`
@@ -100,8 +109,8 @@ and OS used to build** the SDK, not by that Maven property.
100109

101110
### Local build for a specific classifier
102111

103-
Linux x86_64 (glibc 2.17 baseline — use CentOS 7 + devtoolset-8, or any host
104-
whose glibc is ≤ your deployment target):
112+
Linux x86_64 (glibc 2.17 baseline — reproduce CI with manylinux2014 +
113+
devtoolset-10, or any host whose **glibc** is ≤ your deployment target):
105114

106115
```bash
107116
mvn -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests \

0 commit comments

Comments
 (0)