ci(ubuntu22): drop the apt.kitware.com CMake upgrade step#5963
Conversation
The ubuntu22 production image upgraded CMake from Ubuntu 22.04's
apt-supplied 3.22 to Kitware's latest release via apt.kitware.com.
Nothing in MeshLib's build actually requires a CMake newer than 3.22:
* MeshLib's own CMakeLists.txt, thirdparty/CMakeLists.txt, and
source/EditableProject/CMakeLists.txt all declare
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
* The highest cmake_minimum_required in any thirdparty submodule
we pull is 3.18 (cpr). Everything else is <= 3.16.
* fmt's `cmake_minimum_required(VERSION 3.8...3.28)` and
mrbind-pybind11's `3.15...3.30` are range syntax -- the upper
bound is a policy-compatibility cap, not a minimum requirement.
So the Kitware upgrade wasn't earning anything functional, it was
just a latent point of failure. apt.kitware.com has been unreliable
in ways our CI keeps hitting:
* ubuntu22-arm64 image build on feat/zlib-compress-stream-zlib-ng
(run 24800811051) failed at this exact step with
Could not connect to apt.kitware.com:443 (66.194.253.25)
- connect (111: Connection refused)
E: Unable to locate package kitware-archive-keyring
while the x64 leg in the same run succeeded.
* Dec 2024: full-day outage documented on CMake Discourse
https://discourse.cmake.org/t/kitware-apt-repo-down/13184
(mis-issued SSL certificate for vtk.org instead of
apt.kitware.com).
Matches what docker/ubuntu24Dockerfile already does: that image has
no CMake-upgrade step either and uses Ubuntu 24.04 noble's apt-
supplied cmake 3.28 directly (via `cmake` in requirements/ubuntu.txt).
Net diff: -13 lines. Shorter image build (no apt-remove, no three
apt updates, no apt-key keyserver lookup, no wget+gpg dance), same
reliability as any other apt package pulled from Canonical's archive
and mirrors.
|
Closing: my "3.22 is enough" analysis missed a silent CMake-version requirement.
(Seen on run 24821677923.) So the upgrade to a newer CMake was functionally required after all — just not captured in any |
Pair to the Dockerfile change that drops the apt.kitware.com upgrade
on ubuntu22: once we stop pulling a newer CMake, MRCuda fails to
configure on Ubuntu 22.04 jammy's apt-supplied CMake 3.22 with
Target "cmTC_*" requires the language dialect "CUDA20" (with
compiler extensions), but CMake does not know the compile flags
to use to enable it.
CMake's NVCC flag-table entry for -std=c++20 was added in CMake 3.26
(gated on NVCC >= 12.0). 3.22 only knows up to CUDA17 for NVCC.
Gate the CUDA_STANDARD choice on CMAKE_VERSION:
IF(CMAKE_VERSION VERSION_LESS 3.26)
set(CMAKE_CUDA_STANDARD 17)
ELSE()
set(CMAKE_CUDA_STANDARD 20)
ENDIF()
Platforms running CMake 3.26+ (Ubuntu 24.04 noble's 3.28, macOS
Homebrew, anyone with a recent tarball install, the Emscripten
Docker builder, vcpkg toolchains) keep using CUDA20 as before.
Ubuntu 22.04 falls back to CUDA17, which 3.22's NVCC flag table
does know. MeshLib's CUDA sources compile under either standard,
so this costs us nothing in-tree.
Windows path is untouched -- it was already pinned to CUDA17 on
line 6 for a different reason ("C++20 on Windows appears to be
ignored").
|
Reopened after pairing the Dockerfile change with the CUDA-standard fallback it needs. Added commit IF(CMAKE_VERSION VERSION_LESS 3.26)
set(CMAKE_CUDA_STANDARD 17)
ELSE()
set(CMAKE_CUDA_STANDARD 20)
ENDIF()Why 3.26: that's where CMake's NVCC flag table first learned Platform fallout:
Expected next run: Ubuntu 22.04 image builds and the Ubuntu 22.04 arm64/x64 build-test legs configure successfully with neither the Kitware apt block nor a CMake upgrade in the image. |
Correction to the earlier a47a6a1. I concluded CMake 3.26 was the threshold after reading NVIDIA-CUDA.cmake at v3.25.0 vs v3.26.0 and seeing the CMAKE_CUDA20_STANDARD_COMPILE_OPTION appear in the latter. I missed that CMake 3.25.2 (a patch release within the 3.25 series) backported the NVCC+C++20 flag-table entry. Verified at the source by reading NVIDIA-CUDA.cmake at v3.25.2: if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 12.0) set(CMAKE_CUDA20_STANDARD_COMPILE_OPTION "-std=c++20") set(CMAKE_CUDA20_EXTENSION_COMPILE_OPTION "-std=c++20") endif() And cross-checked with the 3.25 release notes: https://cmake.org/cmake/help/latest/release/3.25.html#id2 "CUDA language level 20 (corresponding to C++20) is now supported with NVCC 12.0 and above." Tightening the guard from `VERSION_LESS 3.26` to `VERSION_LESS 3.25.2` matches reality and also avoids forcing CUDA17 on a system running CMake 3.25.2..3.25.x which supports CUDA20 fine. Doesn't change behaviour for our CI matrix (Ubuntu 22.04 ships 3.22.x, well below the threshold either way).
Summary
Two-file change that replaces the apt.kitware.com CMake-upgrade step on Ubuntu 22.04 with a CMake-version-aware fallback in
ConfigureCuda.cmake:docker/ubuntu22Dockerfile— delete theapt remove cmake → apt-add-repository apt.kitware.com → apt install cmakeblock entirely. Image now uses Ubuntu 22.04 jammy's apt-supplied CMake 3.22 directly, matchingdocker/ubuntu24Dockerfile's existing pattern (which ships 3.28 and never needed an upgrade).cmake/Modules/ConfigureCuda.cmake— gateCMAKE_CUDA_STANDARDon the running CMake version so CUDA20 is only requested when CMake actually supports the-std=c++20flag for NVCC:Why 3.25.2
CMake's NVCC flag table entry for
-std=c++20was backported into the CMake 3.25.2 patch release (gated onCUDA_COMPILER_VERSION >= 12.0). Earlier 3.25.x / 3.24 / 3.22 / … refuse withVerified at the source by reading
Modules/Compiler/NVIDIA-CUDA.cmake @ v3.25.2:Cross-checked with the 3.25 release notes:
Ubuntu 22.04 jammy ships CMake 3.22 via apt, well below this threshold; hence the historical Dockerfile upgrade. Falling back to CUDA17 on that specific environment — and only that one — is the minimum change that restores a clean install.
Per-platform effect
Only Ubuntu 22.04 flips CUDA standard. Every other leg keeps CUDA20 as before.
Why not just keep the upgrade
Two separate exploration PRs close in favour of this one:
cmake-4.3.2-linux-<arch>.tar.gz). Works, but installs CMake 4.3.2 we don't functionally need (MeshLib's real floor is 3.22, not 3.28 or 4.x — only the NVCC+C++20 combination needed ≥ 3.25.2).Dropping the upgrade entirely and falling back to C++17 on the one environment that needs it is the smallest durable change.
Verified on CI — run 24828203407
All four Ubuntu 22.04 matrix legs:
prepare-image / linux-image-build-upload (ubuntu22, x64)prepare-image / linux-image-build-upload (ubuntu22, arm64)ubuntu-arm64-build-test (ubuntu22, Release)ubuntu-x64-build-test (ubuntu22, Release, GCC-12)Specifically verified on that run:
apt.kitware.comorkitware-archive-keyringin the ubuntu22 image-build log — the step is fully gone.does not know the compile flagserror — the CUDA17 fallback fired silently and MRCuda configured cleanly against Ubuntu's CMake 3.22.CompressSphereToZipandCompressManySmallFilesToZip— nothing downstream regressed from dropping CUDA20 to CUDA17 in MRCuda.The other matrix legs (Ubuntu 24.04, macOS, Windows, linux-vcpkg, Emscripten) are all on CMake ≥ 3.25.2 and continue to use CUDA20 unchanged.
🤖 Generated with Claude Code