Skip to content

Commit dafbbf9

Browse files
committed
Use link test for glibc217 C++ ABI check
1 parent 3eb2624 commit dafbbf9

1 file changed

Lines changed: 31 additions & 4 deletions

File tree

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

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,39 @@ fi
116116
echo "glibc compatibility check passed (max=${max_glibc} <= 2.17)"
117117

118118
echo "=== CXX11 ABI symbols in libiotdb_session.so ==="
119-
abi_symbols=$(nm -D --demangle "${SO}" | grep -E 'Session::setStorageGroup\(std::__cxx11::basic_string|SessionDataSet::getColumnNames\[abi:cxx11\]|RowRecord::toString\[abi:cxx11\]' || true)
120-
if [[ -z "${abi_symbols}" ]]; then
121-
echo "ERROR: libiotdb_session.so was not built with _GLIBCXX_USE_CXX11_ABI=1"
119+
abi_symbol_sample=$(nm -D --demangle "${SO}" | awk '/std::__cxx11|\[abi:cxx11\]/ { print; if (++count >= 20) exit }' || true)
120+
if [[ -n "${abi_symbol_sample}" ]]; then
121+
printf '%s\n' "${abi_symbol_sample}"
122+
else
123+
echo "No std::__cxx11 symbols found in the dynamic symbol table; verifying by link test."
124+
fi
125+
126+
ABI_SMOKE="/tmp/client-cpp-abi-smoke-glibc217"
127+
rm -rf "${ABI_SMOKE}"
128+
mkdir -p "${ABI_SMOKE}"
129+
cat > "${ABI_SMOKE}/main.cpp" <<'EOF'
130+
#include "Session.h"
131+
132+
#include <string>
133+
134+
int main() {
135+
Session session(std::string("127.0.0.1"), 6667, std::string("root"), std::string("root"));
136+
session.setDatabase(std::string("root.test"));
137+
return 0;
138+
}
139+
EOF
140+
141+
if ! c++ -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=1 \
142+
-I"iotdb-client/client-cpp/target/install/include" \
143+
"${ABI_SMOKE}/main.cpp" \
144+
-L"iotdb-client/client-cpp/target/install/lib" \
145+
-Wl,-rpath,"${GITHUB_WORKSPACE}/iotdb-client/client-cpp/target/install/lib" \
146+
-liotdb_session -pthread \
147+
-o "${ABI_SMOKE}/abi-smoke"; then
148+
echo "ERROR: libiotdb_session.so is not link-compatible with _GLIBCXX_USE_CXX11_ABI=1"
122149
exit 1
123150
fi
124-
printf '%s\n' "${abi_symbols}" | head -20
151+
echo "CXX11 ABI link check passed"
125152

126153
echo "=== Example package build/link/run smoke test ==="
127154
PKG_ZIP=$(find "${GITHUB_WORKSPACE}/iotdb-client/client-cpp/target" -maxdepth 1 -type f -name "iotdb-session-cpp-*-${PACKAGE_CLASSIFIER}.zip" -print -quit)

0 commit comments

Comments
 (0)