Skip to content

Commit ef58305

Browse files
committed
Merge origin/master into JDK 17 Jakarta migration
2 parents 07d75c2 + 07b9cb0 commit ef58305

390 files changed

Lines changed: 34957 additions & 21360 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
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+
# Build client-cpp in manylinux_2_28 and verify max required GLIBC symbol <= 2.28.
18+
set -euxo pipefail
19+
20+
MACHINE=$(uname -m)
21+
case "${MACHINE}" in
22+
x86_64)
23+
CMAKE_PKG_ARCH=linux-x86_64
24+
JDK_API_ARCH=linux/x64
25+
DEFAULT_CLASSIFIER=linux-x86_64-glibc2.28
26+
;;
27+
aarch64)
28+
CMAKE_PKG_ARCH=linux-aarch64
29+
JDK_API_ARCH=linux/aarch64
30+
DEFAULT_CLASSIFIER=linux-aarch64-glibc2.28
31+
;;
32+
*)
33+
echo "Unsupported architecture: ${MACHINE}" >&2
34+
exit 1
35+
;;
36+
esac
37+
38+
PACKAGE_CLASSIFIER="${PACKAGE_CLASSIFIER:-${DEFAULT_CLASSIFIER}}"
39+
40+
CMAKE_VERSION=3.28.4
41+
CMAKE_DIR="/opt/cmake-${CMAKE_VERSION}"
42+
if [[ ! -x "${CMAKE_DIR}/bin/cmake" ]]; then
43+
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"
44+
rm -rf "${CMAKE_DIR}"
45+
mkdir -p /opt
46+
tar xf /tmp/cmake.tar.gz -C /opt
47+
mv "/opt/cmake-${CMAKE_VERSION}-${CMAKE_PKG_ARCH}" "${CMAKE_DIR}"
48+
fi
49+
50+
JAVA_HOME=/opt/jdk-17
51+
if [[ ! -x "${JAVA_HOME}/bin/java" ]]; then
52+
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"
53+
rm -rf /opt/jdk-17*
54+
mkdir -p /opt
55+
tar xf /tmp/jdk17.tar.gz -C /opt
56+
JAVA_HOME=$(find /opt -maxdepth 1 -type d -name 'jdk-17*' -print -quit)
57+
ln -sfn "${JAVA_HOME}" /opt/jdk-17
58+
JAVA_HOME=/opt/jdk-17
59+
fi
60+
61+
export PATH="${CMAKE_DIR}/bin:${JAVA_HOME}/bin:${PATH}"
62+
export JAVA_HOME
63+
64+
gcc --version
65+
c++ --version
66+
gcc_major=$(gcc -dumpversion | cut -d. -f1)
67+
if (( gcc_major < 14 )); then
68+
echo "ERROR: GCC >= 14 is required; got $(gcc -dumpversion)"
69+
exit 1
70+
fi
71+
cmake --version
72+
java -version
73+
74+
cd "${GITHUB_WORKSPACE:?GITHUB_WORKSPACE is not set}"
75+
./mvnw clean package -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests \
76+
-Dspotless.skip=true \
77+
-Dclient.cpp.package.classifier="${PACKAGE_CLASSIFIER}"
78+
79+
SO="iotdb-client/client-cpp/target/install/lib/libiotdb_session.so"
80+
test -f "${SO}"
81+
82+
echo "=== Build host glibc ==="
83+
ldd --version 2>&1 | sed -n '1p'
84+
85+
echo "=== Highest GLIBC_* symbols in libiotdb_session.so ==="
86+
objdump -T "${SO}" | grep GLIBC_ | sed "s/.*GLIBC_/GLIBC_/" | sort -Vu | tail -10
87+
88+
max_glibc=$(objdump -T "${SO}" | grep -oE "GLIBC_[0-9.]+" | sed "s/GLIBC_//" | sort -t. -k1,1n -k2,2n -k3,3n | tail -1)
89+
echo "max_glibc=${max_glibc}"
90+
91+
if [[ -z "${max_glibc}" ]]; then
92+
echo "ERROR: could not determine max GLIBC version from ${SO}"
93+
exit 1
94+
fi
95+
96+
if awk -v max="${max_glibc}" "BEGIN { exit !(max > 2.28) }"; then
97+
echo "ERROR: libiotdb_session.so requires glibc > 2.28 (max=${max_glibc})"
98+
exit 1
99+
fi
100+
101+
echo "glibc compatibility check passed (max=${max_glibc} <= 2.28)"
102+
103+
echo "=== Example package build/link/run smoke test ==="
104+
PKG_ZIP=$(find "${GITHUB_WORKSPACE}/iotdb-client/client-cpp/target" -maxdepth 1 -type f -name "iotdb-session-cpp-*-${PACKAGE_CLASSIFIER}.zip" -print -quit)
105+
if [[ -z "${PKG_ZIP}" ]]; then
106+
echo "ERROR: could not find package zip for ${PACKAGE_CLASSIFIER}"
107+
exit 1
108+
fi
109+
PKG_UNPACK="/tmp/client-cpp-package-smoke-glibc228"
110+
rm -rf "${PKG_UNPACK}"
111+
mkdir -p "${PKG_UNPACK}"
112+
unzip -q -o "${PKG_ZIP}" -d "${PKG_UNPACK}"
113+
PKG_ROOT=$(find "${PKG_UNPACK}" -mindepth 1 -maxdepth 1 -type d -name "iotdb-session-cpp-*-${PACKAGE_CLASSIFIER}" -print -quit)
114+
if [[ -z "${PKG_ROOT}" ]]; then
115+
echo "ERROR: could not find unpacked package directory for ${PACKAGE_CLASSIFIER}"
116+
exit 1
117+
fi
118+
EXAMPLE_BUILD="/tmp/client-cpp-example-smoke-glibc228"
119+
rm -rf "${EXAMPLE_BUILD}"
120+
mkdir -p "${EXAMPLE_BUILD}"
121+
unset CC CXX CFLAGS CXXFLAGS
122+
"${CMAKE_DIR}/bin/cmake" -S "${PKG_ROOT}/examples" -B "${EXAMPLE_BUILD}" \
123+
-DCMAKE_BUILD_TYPE=Release \
124+
-DIOTDB_SDK_ROOT="${PKG_ROOT}"
125+
"${CMAKE_DIR}/bin/cmake" --build "${EXAMPLE_BUILD}" -j"$(nproc)"
126+
127+
./mvnw -pl distribution -am -DskipTests -Dspotless.skip=true package
128+
SERVER_ROOT=$(find "${GITHUB_WORKSPACE}/distribution/target" -path '*/apache-iotdb-*-all-bin/sbin/start-standalone.sh' -print -quit | sed 's#/sbin/start-standalone.sh##')
129+
if [[ -z "${SERVER_ROOT}" ]]; then
130+
echo "ERROR: could not find IoTDB distribution under distribution/target"
131+
exit 1
132+
fi
133+
"${SERVER_ROOT}/sbin/start-standalone.sh"
134+
trap '"${SERVER_ROOT}/sbin/stop-standalone.sh" || true' EXIT
135+
sleep 30
136+
for example in SessionExample AlignedTimeseriesSessionExample TableModelSessionExample tree_example table_example; do
137+
test -x "${EXAMPLE_BUILD}/${example}"
138+
"${EXAMPLE_BUILD}/${example}"
139+
done
140+
echo "Example package smoke test passed"

0 commit comments

Comments
 (0)