8585cmake --version
8686java -version
8787
88+ check_cxx11_abi_link () {
89+ local sdk_root=" $1 "
90+ local smoke_dir=" $2 "
91+ rm -rf " ${smoke_dir} "
92+ mkdir -p " ${smoke_dir} "
93+ cat > " ${smoke_dir} /main.cpp" << 'EOF '
94+ #include "Session.h"
95+
96+ #include <string>
97+
98+ int main() {
99+ Session session(std::string("127.0.0.1"), 6667, std::string("root"), std::string("root"));
100+ session.setDatabase(std::string("root.test"));
101+ return 0;
102+ }
103+ EOF
104+
105+ c++ -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=1 \
106+ -I" ${sdk_root} /include" \
107+ " ${smoke_dir} /main.cpp" \
108+ -L" ${sdk_root} /lib" \
109+ -Wl,-rpath," ${sdk_root} /lib" \
110+ -liotdb_session -pthread \
111+ -o " ${smoke_dir} /abi-smoke"
112+ }
113+
88114cd " ${GITHUB_WORKSPACE:? GITHUB_WORKSPACE is not set} "
89115./mvnw clean package -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests \
90116 -Dspotless.skip=true \
@@ -123,32 +149,11 @@ else
123149 echo " No std::__cxx11 symbols found in the dynamic symbol table; verifying by link test."
124150fi
125151
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
152+ if ! check_cxx11_abi_link " iotdb-client/client-cpp/target/install" " /tmp/client-cpp-abi-smoke-glibc217-install" ; then
148153 echo " ERROR: libiotdb_session.so is not link-compatible with _GLIBCXX_USE_CXX11_ABI=1"
149154 exit 1
150155fi
151- echo " CXX11 ABI link check passed"
156+ echo " CXX11 ABI link check passed for target/install "
152157
153158echo " === Example package build/link/run smoke test ==="
154159PKG_ZIP=$( find " ${GITHUB_WORKSPACE} /iotdb-client/client-cpp/target" -maxdepth 1 -type f -name " iotdb-session-cpp-*-${PACKAGE_CLASSIFIER} .zip" -print -quit)
@@ -165,6 +170,11 @@ if [[ -z "${PKG_ROOT}" ]]; then
165170 echo " ERROR: could not find unpacked package directory for ${PACKAGE_CLASSIFIER} "
166171 exit 1
167172fi
173+ if ! check_cxx11_abi_link " ${PKG_ROOT} " " /tmp/client-cpp-abi-smoke-glibc217-package" ; then
174+ echo " ERROR: packaged libiotdb_session.so is not link-compatible with _GLIBCXX_USE_CXX11_ABI=1"
175+ exit 1
176+ fi
177+ echo " CXX11 ABI link check passed for packaged SDK"
168178EXAMPLE_BUILD=" /tmp/client-cpp-example-smoke-glibc217"
169179rm -rf " ${EXAMPLE_BUILD} "
170180mkdir -p " ${EXAMPLE_BUILD} "
0 commit comments