Skip to content

Commit 8419c98

Browse files
jackluo9234ertus2claude
committed
fix(build): Support CMake v4+ and GCC 15 toolchains, and upgrade C++ dependencies (fixes #795).
CMake v4 removed compatibility with `cmake_minimum_required` below v3.5, breaking yaml-cpp, libarchive, and the googletest that ANTLR's test build fetches. CLP previously capped this by pinning CMake below v4, which has since become actively harmful: the install script fails outright wherever CMake v4+ is the system package, since it only installs the pinned version when no `cmake` is already present. All three blockers are fixed here and the pin is retired, closing #795, which was reported in April 2025 against macOS with Homebrew. Separately, libstdc++ 15 stopped transitively including <cstdint>, so yaml-cpp 0.7.0 fails to compile under GCC 15. The yaml-cpp upgrade addresses both that and its CMake v4 incompatibility. With the ceiling gone, the three places that uninstalled a working CMake so the pin could reinstall an older one are removed, and centos-stream-9 now uses dnf's CMake. Only ubuntu-jammy still needs the pipx install, since its apt CMake (3.22.1) is below the v3.23 floor that ystdlib requires. `install-cmake.sh` is renamed to `ensure-cmake.sh` to match its now-primary role of validating the available CMake rather than installing one. Also upgrades libarchive (3.5.1/3.8.0 -> 3.8.9), SQLite3 (3.36.0 -> 3.53.4), Catch2, Microsoft.GSL, nlohmann_json, simdjson, utfcpp, zlib, and date, which had drifted well behind upstream. None of these required changes to CLP's own source. Supersedes and credits #2453, which surfaced these failures on Ubuntu 26.04 — the first environment to hit both toolchain shifts at once. Co-authored-by: Artem Zuikov <chertus@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 155fbda commit 8419c98

11 files changed

Lines changed: 86 additions & 50 deletions

File tree

components/core/src/glt/glt/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ if(CLP_BUILD_EXECUTABLES)
191191
nlohmann_json::nlohmann_json
192192
${STD_FS_LIBS}
193193
clp::string_utils
194-
yaml-cpp
194+
yaml-cpp::yaml-cpp
195195
ystdlib::error_handling
196196
zstd::libzstd_static
197197
)

components/core/tools/docker-images/clp-env-base-centos-stream-9/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ RUN if [ -n "${DNF_MIRROR_BASE_URL:-}" ]; then \
4040
ENV PIPX_BIN_DIR=/usr/local/bin
4141
ENV PIPX_HOME=/opt/pipx
4242

43+
# NOTE: libarchive is built from source into /usr/local, but this distro's pkg-config only
44+
# searches /usr/lib64/pkgconfig and /usr/share/pkgconfig, so its .pc file would be invisible
45+
# and `pkg_check_modules` would silently drop libarchive's static dependencies.
46+
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
4347
RUN ./tools/scripts/lib_install/centos-stream-9/install-all.sh || { \
4448
echo ""; \
4549
echo "==============================================================="; \
@@ -68,3 +72,4 @@ ENV CURL_CA_BUNDLE=/opt/corp-ca/ca-bundle.crt \
6872
SSL_CERT_FILE=/opt/corp-ca/ca-bundle.crt
6973
ENV PIPX_BIN_DIR=/usr/local/bin
7074
ENV PIPX_HOME=/opt/pipx
75+
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

components/core/tools/scripts/lib_install/centos-stream-9/install-packages-from-source.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ set -o pipefail
77
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
88
lib_install_scripts_dir="${script_dir}/.."
99

10+
# NOTE: libarchive may statically link with LZMA, LZ4, and Zstandard, so we install LZMA
11+
# beforehand; LZ4 and Zstandard come from the distro packages.
1012
"${lib_install_scripts_dir}/liblzma.sh" 5.8.1
13+
"${lib_install_scripts_dir}/libarchive.sh" 3.8.9

components/core/tools/scripts/lib_install/centos-stream-9/install-prebuilt-packages.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ set -o nounset
55
set -o pipefail
66

77
dnf install -y \
8+
cmake \
89
diffutils \
910
gcc-c++ \
1011
git \
1112
java-11-openjdk \
1213
jq \
13-
libarchive-devel \
1414
libcurl-devel \
1515
libzstd-devel \
1616
lz4-devel \

components/core/tools/scripts/lib_install/libarchive.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ cd ${extracted_dir}
6767
mkdir -p cmake-build-release
6868
cd cmake-build-release
6969
# NOTE: Disable Expat and OpenSSL so the static libarchive doesn't look for them at link time.
70-
cmake -DENABLE_EXPAT=OFF -DENABLE_OPENSSL=OFF ../
70+
# NOTE: Force the libdir to "lib" rather than letting `GNUInstallDirs` choose it. From v3.8.2
71+
# onwards, libarchive resolves it to "lib64" on 64-bit RHEL-family distros, but our images only put
72+
# "/usr/local/lib/pkgconfig" on `PKG_CONFIG_PATH`. A missed .pc file isn't an error, so
73+
# `pkg_check_modules` would silently yield no static dependencies and libarchive's `-lz` would drop
74+
# off the link line, failing much later with an undefined reference to `inflateEnd`.
75+
cmake -DCMAKE_INSTALL_LIBDIR=lib -DENABLE_EXPAT=OFF -DENABLE_OPENSSL=OFF ../
7176
make -j${num_cpus}
7277

7378
# Check if checkinstall is installed

components/core/tools/scripts/lib_install/manylinux_2_28/install-packages-from-source.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ lib_install_scripts_dir="${script_dir}/.."
1515
"${lib_install_scripts_dir}/liblzma.sh" 5.8.1
1616
"${lib_install_scripts_dir}/lz4.sh" 1.10.0
1717
"${lib_install_scripts_dir}/zstandard.sh" 1.5.7
18-
"${lib_install_scripts_dir}/libarchive.sh" 3.8.0
18+
"${lib_install_scripts_dir}/libarchive.sh" 3.8.9

components/core/tools/scripts/lib_install/musllinux_1_2/install-packages-from-source.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ lib_install_scripts_dir="${script_dir}/.."
1515
"${lib_install_scripts_dir}/liblzma.sh" 5.8.1
1616
"${lib_install_scripts_dir}/lz4.sh" 1.10.0
1717
"${lib_install_scripts_dir}/zstandard.sh" 1.5.7
18-
"${lib_install_scripts_dir}/libarchive.sh" 3.8.0
18+
"${lib_install_scripts_dir}/libarchive.sh" 3.8.9

components/core/tools/scripts/lib_install/pipx-packages/install-cmake.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,33 @@ if ! command -v pipx >/dev/null 2>&1; then
99
exit 1
1010
fi
1111

12+
# NOTE: ystdlib requires CMake v3.23.
1213
readonly required_version_major_min=3
1314
readonly required_version_minor_min=23
1415
readonly required_version_min="${required_version_major_min}.${required_version_minor_min}"
15-
readonly required_version_major_max=3
16-
readonly required_version_major_max_plus_1=$((required_version_major_max + 1))
16+
17+
# NOTE: CLP builds with CMake v4+, but we don't install it by default. An environment that already
18+
# provides v4+ is accepted by the version check below; when we have to install CMake ourselves, we
19+
# stay on v3 so that adopting v4 remains a deliberate choice rather than a side effect of whatever
20+
# version happens to be newest.
21+
readonly installed_version_major_max_plus_1=4
1722

1823
package_preinstalled=0
1924
if ! command -v cmake >/dev/null 2>&1; then
2025
package_preinstalled=1
21-
# ystdlib requires CMake v3.23; ANTLR and yaml-cpp do not yet support CMake v4+
22-
# (see https://github.com/y-scope/clp/issues/795).
23-
pipx install --force "cmake>=${required_version_min},<${required_version_major_max_plus_1}"
26+
pipx install --force "cmake>=${required_version_min},<${installed_version_major_max_plus_1}"
2427
pipx ensurepath
2528
fi
2629

2730
installed_version=$(cmake -E capabilities | jq --raw-output ".version.string")
2831
installed_version_major=$(cmake -E capabilities | jq --raw-output ".version.major")
2932
installed_version_minor=$(cmake -E capabilities | jq --raw-output ".version.minor")
3033

31-
# ystdlib requires CMake v3.23; ANTLR and yaml-cpp do not yet support CMake v4+
32-
# (see https://github.com/y-scope/clp/issues/795).
3334
if (("${installed_version_major}" < "${required_version_major_min}")) \
3435
|| (("${installed_version_major}" == "${required_version_major_min}" && \
35-
"${installed_version_minor}" < "${required_version_minor_min}")) \
36-
|| (("${installed_version_major}" >= "${required_version_major_max_plus_1}")); then
37-
echo "Error: CMake version ${installed_version} is unsupported (require" \
38-
"${required_version_min} ≤ version < ${required_version_major_max_plus_1})."
36+
"${installed_version_minor}" < "${required_version_minor_min}")); then
37+
echo "Error: CMake version ${installed_version} is unsupported (require version" \
38+
"${required_version_min})."
3939

4040
if ((0 == "${package_preinstalled}")); then
4141
echo "Please uninstall CMake and then re-run the install script."

components/core/tools/scripts/lib_install/ubuntu-jammy/install-packages-from-source.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ set -o pipefail
77
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
88
lib_install_scripts_dir=$script_dir/..
99

10-
"$lib_install_scripts_dir"/libarchive.sh 3.5.1
10+
# NOTE: libarchive may statically link with LZMA, LZ4, and Zstandard, so we install them
11+
# beforehand.
1112
"$lib_install_scripts_dir"/liblzma.sh 5.8.1
1213
"$lib_install_scripts_dir"/lz4.sh 1.10.0
1314
"$lib_install_scripts_dir"/zstandard.sh 1.5.7
15+
"$lib_install_scripts_dir"/libarchive.sh 3.8.9

docs/src/dev-docs/components-core/index.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,26 @@ The task will download, build, and install (within the build directory) the foll
4040
| [abseil-cpp](https://github.com/abseil/abseil-cpp) | 20250512.0 |
4141
| [ANTLR](https://www.antlr.org) | v4.13.2 |
4242
| [Boost](https://github.com/boostorg/boost) | v1.87.0 |
43-
| [Catch2](https://github.com/catchorg/Catch2) | v3.8.0 |
44-
| [date](https://github.com/HowardHinnant/date) | v3.0.1 |
43+
| [Catch2](https://github.com/catchorg/Catch2) | v3.15.3 |
44+
| [date](https://github.com/HowardHinnant/date) | v3.0.5 |
4545
| [fmt](https://github.com/fmtlib/fmt) | v11.2.0 |
4646
| [liblzma](https://github.com/tukaani-project/xz) | v5.8.1 |
4747
| [log-surgeon](https://github.com/y-scope/log-surgeon) | 840f262 |
4848
| [lz4](https://github.com/lz4/lz4) | v1.10.0 |
49-
| [microsoft.gsl](https://github.com/microsoft/GSL) | v4.0.0 |
50-
| [mongo-cxx-driver](https://github.com/mongodb/mongo-cxx-driver) | r4.1.1 |
49+
| [microsoft.gsl](https://github.com/microsoft/GSL) | v4.2.2 |
50+
| [mongo-cxx-driver](https://github.com/mongodb/mongo-cxx-driver) | r4.4.1 |
5151
| [msgpack-cxx](https://github.com/msgpack/msgpack-c/tree/cpp_master) | v7.0.0 |
52-
| [nlohmann_json](https://github.com/nlohmann/json) | v3.11.3 |
52+
| [nlohmann_json](https://github.com/nlohmann/json) | v3.12.0 |
5353
| [opentelemetry-cpp](https://github.com/open-telemetry/opentelemetry-cpp) | v1.27.0 |
5454
| [Protobuf](https://github.com/protocolbuffers/protobuf) | v31.1 |
55-
| [simdjson](https://github.com/simdjson/simdjson) | v4.6.4 |
55+
| [simdjson](https://github.com/simdjson/simdjson) | v4.6.6 |
5656
| [spdlog](https://github.com/gabime/spdlog) | v1.15.3 |
57-
| [SQLite3](https://www.sqlite.org/download.html) | v3.36.0 |
58-
| [utfcpp](https://github.com/nemtrif/utfcpp) | v4.0.6 |
57+
| [SQLite3](https://www.sqlite.org/download.html) | v3.53.4 |
58+
| [utfcpp](https://github.com/nemtrif/utfcpp) | v4.1.1 |
5959
| [xxHash](https://github.com/Cyan4973/xxHash) | v0.8.3 |
60-
| [yaml-cpp](https://github.com/jbeder/yaml-cpp) | v0.7.0 |
60+
| [yaml-cpp](https://github.com/jbeder/yaml-cpp) | v0.9.0 |
6161
| [ystdlib-cpp](https://github.com/y-scope/ystdlib-cpp) | 9ed78cd |
62-
| [zlib](https://github.com/madler/zlib) | v1.3.1 |
62+
| [zlib](https://github.com/madler/zlib) | v1.3.2 |
6363
| [zstd](https://github.com/facebook/zstd) | v1.5.7 |
6464

6565
### Environment

0 commit comments

Comments
 (0)