All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/cmake: bump host-cmake minimum version to 3.26
@ 2026-08-18 12:11 Alexis Lothoré via buildroot
  2026-08-18 13:22 ` Alexis Lothoré via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Alexis Lothoré via buildroot @ 2026-08-18 12:11 UTC (permalink / raw)
  To: buildroot
  Cc: Thomas Petazzoni, Nicolas Carrier, Adrian Perez de Castro,
	Bernd Kuhls, Daniel Lang, Dick Olsson, Fabio Urquiza,
	Joseph Kogut, Julien Olivain, Romain Naour, Valentin Korenblit,
	Alexis Lothoré

Multiple packages, under specific conditions described below, can fail
to build with the following error:

  In file included from [...]/output/host/opt/ext-toolchain/arm-buildroot-linux-gnueabihf/include/c++/14.2.0/bits/stl_algo.h:71,
                   from [...]/output/host/opt/ext-toolchain/arm-buildroot-linux-gnueabihf/include/c++/14.2.0/algorithm:61,
                   from [...]/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/qt5/QtCore/qglobal.h:142,
                   from [...]/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/qt5/QtCore/qnamespace.h:43,
                   from [...]/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/qt5/QtCore/qobjectdefs.h:48,
                   from [...]/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/qt5/QtCore/qobject.h:46,
                   from [...]/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/qt5/QtCore/QObject:1,
                   from [...]/output/build/kf5-networkmanager-qt-5.91.0/src/KF5NetworkManagerQt_autogen/EWIEGA46WW/../../accesspoint.h:16,
                   from [...]/output/build/kf5-networkmanager-qt-5.91.0/src/KF5NetworkManagerQt_autogen/EWIEGA46WW/moc_accesspoint.cpp:10,
                   from [...]/output/build/kf5-networkmanager-qt-5.91.0/src/KF5NetworkManagerQt_autogen/mocs_compilation.cpp:2:
  [...]/output/host/opt/ext-toolchain/arm-buildroot-linux-gnueabihf/include/c++/14.2.0/cstdlib:79:15: fatal error: stdlib.h: No such file or directory
     79 | #include_next <stdlib.h>

stdlib.h is obviously present in buildroot sysroot, but there is a
specific list of elements listed below that produce such failure:
- many cmake-based C++ packages include cstdlib, which contains an
  "#include_next stdlib.h": this header then expects to find stdlib.h
  _later than the current include path_ in the list of include paths,
  this means that the sysroot include path must be at the end of the whole
  "-I<path>" list
- this constraint is fulfilled in general, but for those failing cases,
  the sysroot include path does not appear at the end but ends up being
  set _before_ the path that exposes cstdlib.h, so stdlib.h is never
  found when processing the #include_next.
- The final include path list is computed by cmake: those include paths
  come from an aggregation of different sources; eg those provided on
  the command line at configure time, or those given by the compiler. The
  sysroot path that ends up being put too early is part of the compiler
  implicit include directories step (part of
  CMAKE_DETERMINE_COMPILER_ABI): cmake makes the compiler prints its
  configuration (and so its default include paths). It then deduplicates
  already known paths (eg: the sysroot path), this deduplication is the
  key element ensuring that the sysroot include path ends up being
  included later than cstdlib.h path
- But for faulty packages, this path is not deduplicated correctly,
  leading to cmake keeping the sysroot include path instead of
  deduplicating it, making it appear too early in the include path list.
  Indeed, before performing the comparison, cmake "collapses" path (ie
  translate any path to its absolute path), and for faulty packages, the
  sysroot include path, as seen in CMakeOutput.log, is wrongly collapsed
  into a non-existing path. For example, when running a buildroot build
  with O=out/output-kf5, we find the following line in CMakeOutput.log:

  collapse relative include dir [../../../../../host/arm-buildroot-linux-gnueabihf/sysroot/usr/include] ==> [/workspace/build/out/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include]

  This is where the bug triggers: this collapsed path does not exist, it
  is missing "output-kf5" (the bug does not depend on the build being
  out-of-tree, it triggers as well in-tree). Also, this bug does not
  trigger in nominal cases because the compiler already prints absolute
  paths in many cases: to be reproduced, the build configuration must
  include BR2_CCACHE, and more specifically BR2_CCACHE_USE_BASEDIR: the
  latter will print a _relative_ sysroot path that cmake will wrongly
  collapse
- This bug is in cmake and is known and fixed since many versions: cmake
  updated its detection logic to work in a new subdirectory, breaking
  the relative paths collapsing; this issue has been fixed with [0] and is
  part of any cmake version >= 3.25.2
- How can buildroot users end up using a cmake version old enough to
  trigger this bug ? This depends on whether they have cmake installed
  on their host, and if so, what is the installed version:
  - no cmake installed: Buildroot builds host-cmake 4.4, no issue
  - cmake installed with a version <= 3.18: too old, Buildroot builds
    host-cmake 4.4, no issue
  - cmake installed with a version >= 3.25.2: Buildroot uses it to build
    cmake packages, no issue
  - cmake installed with 3.18 <= version < 3.25.2: Buildroot uses it to
    build cmake packages, build fails

Despite 3.25.2 being more than 4 years old, cmake versions can be found
in standard distributions: that's the case for Debian 12 which is
currently shipping 3.25.1. Debian 12 has entered its LTS cycle, and so
will be maintained until June 2028.

Now, there are two ways of fixing this build issue:
- enforcing BR2_HOST_CMAKE_AT_LEAST_3_26 in all cmake-based C++ packages
  in Buildroot
- enforcing v3.26 for all cmake packages in package/cmake/Config.in.host

I have done some more tests in the setup able to trigger this build
failure: running a buildroot build in a Debian 12 container, with the
following base defconfig:
  BR2_x86_64=y
  BR2_TOOLCHAIN_EXTERNAL=y
  BR2_CCACHE=y

And while I've not been able to make _any cmake-based C++ package_ build
fail (so there is still one subtle detail I am not getting), I managed
to make many package build fail on this exact same "stdlib.h not found"
error:
  - protobuf
  - glog
  - dbus-cxx
  - sdbus-cpp
  - log4cxx
  - taglib
  - sqlitecpp
  - ...

As the issue affects many packages, and that the faulty cmake version is
still shipped on some standard distributions, bump the minimal host-cmake
version to 3.26 to prevent this issue.

[0] https://gitlab.kitware.com/cmake/cmake/-/commit/607bccb4efe1

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
Hi Buildroot community,
this patch proposes a quite aggressive cmake bump, following a quite
long investigation. While cmake 3.26 has been in the wild for more than
3 years, it has some non negligeable consequences for users and CI:
host-cmake will be systematically built in more cases than today,
extending the build time in the process. If that's a no-go, I am open to
ideas about how to better handle this.
---
 package/bitcoin/Config.in                  |  1 -
 package/cmake/Config.in.host               | 43 +++---------------------------
 package/kodi/Config.in                     |  1 -
 package/libjxl/Config.in                   |  1 -
 package/llvm-project/clang/Config.in       |  1 -
 package/llvm-project/compiler-rt/Config.in |  1 -
 package/llvm-project/libclc/Config.in      |  1 -
 package/llvm-project/lld/Config.in.host    |  1 -
 package/llvm-project/llvm/Config.in        |  1 -
 package/rustc/Config.in.host               |  2 --
 package/wpewebkit/Config.in                |  1 -
 support/dependencies/check-host-cmake.mk   |  2 +-
 12 files changed, 5 insertions(+), 51 deletions(-)

diff --git a/package/bitcoin/Config.in b/package/bitcoin/Config.in
index 835961718cf6..f94c7de12a44 100644
--- a/package/bitcoin/Config.in
+++ b/package/bitcoin/Config.in
@@ -19,7 +19,6 @@ config BR2_PACKAGE_BITCOIN
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_12
 	depends on BR2_TOOLCHAIN_HAS_THREADS # boost
 	depends on BR2_USE_WCHAR
-	select BR2_HOST_CMAKE_AT_LEAST_3_22
 	select BR2_PACKAGE_BOOST
 	select BR2_PACKAGE_LIBEVENT
 	help
diff --git a/package/cmake/Config.in.host b/package/cmake/Config.in.host
index b8221a7d2223..ab47effd5b9a 100644
--- a/package/cmake/Config.in.host
+++ b/package/cmake/Config.in.host
@@ -10,38 +10,11 @@ config BR2_PACKAGE_HOST_CMAKE
 
 	  http://www.cmake.org/
 
-# The minimum system cmake version we expect if 3.18 as provided by
-# Debian bullseye, that we use in our reference build docker image.
-config BR2_HOST_CMAKE_AT_LEAST_3_19
-	bool
-
-config BR2_HOST_CMAKE_AT_LEAST_3_20
-	bool
-	select BR2_HOST_CMAKE_AT_LEAST_3_19
-
-config BR2_HOST_CMAKE_AT_LEAST_3_21
-	bool
-	select BR2_HOST_CMAKE_AT_LEAST_3_20
-
-config BR2_HOST_CMAKE_AT_LEAST_3_22
-	bool
-	select BR2_HOST_CMAKE_AT_LEAST_3_21
-
-config BR2_HOST_CMAKE_AT_LEAST_3_23
-	bool
-	select BR2_HOST_CMAKE_AT_LEAST_3_22
-
-config BR2_HOST_CMAKE_AT_LEAST_3_24
-	bool
-	select BR2_HOST_CMAKE_AT_LEAST_3_23
-
-config BR2_HOST_CMAKE_AT_LEAST_3_25
-	bool
-	select BR2_HOST_CMAKE_AT_LEAST_3_24
-
+# The minimum system cmake version we expect is 3.26, as Debian bookworm
+# still provides 3.25.1, but it exposes a bug leading to C++ packages build
+# failures
 config BR2_HOST_CMAKE_AT_LEAST_3_26
 	bool
-	select BR2_HOST_CMAKE_AT_LEAST_3_25
 
 config BR2_HOST_CMAKE_AT_LEAST_3_27
 	bool
@@ -97,12 +70,4 @@ config BR2_HOST_CMAKE_AT_LEAST
 	default "3.29"	if BR2_HOST_CMAKE_AT_LEAST_3_29
 	default "3.28"	if BR2_HOST_CMAKE_AT_LEAST_3_28
 	default "3.27"	if BR2_HOST_CMAKE_AT_LEAST_3_27
-	default "3.26"	if BR2_HOST_CMAKE_AT_LEAST_3_26
-	default "3.25"	if BR2_HOST_CMAKE_AT_LEAST_3_25
-	default "3.24"	if BR2_HOST_CMAKE_AT_LEAST_3_24
-	default "3.23"	if BR2_HOST_CMAKE_AT_LEAST_3_23
-	default "3.22"	if BR2_HOST_CMAKE_AT_LEAST_3_22
-	default "3.21"	if BR2_HOST_CMAKE_AT_LEAST_3_21
-	default "3.20"	if BR2_HOST_CMAKE_AT_LEAST_3_20
-	default "3.19"	if BR2_HOST_CMAKE_AT_LEAST_3_19
-	default "3.18"
+	default "3.26"
diff --git a/package/kodi/Config.in b/package/kodi/Config.in
index 6f256ada4333..fad425e9a292 100644
--- a/package/kodi/Config.in
+++ b/package/kodi/Config.in
@@ -67,7 +67,6 @@ menuconfig BR2_PACKAGE_KODI
 	depends on BR2_PACKAGE_KODI_PLATFORM_SUPPORTS
 	depends on BR2_PACKAGE_PYTHON3
 	depends on !BR2_PACKAGE_PYTHON3_PYC_ONLY
-	select BR2_HOST_CMAKE_AT_LEAST_3_24
 	select BR2_PACKAGE_FFMPEG
 	select BR2_PACKAGE_FFMPEG_GPL
 	select BR2_PACKAGE_FFMPEG_POSTPROC
diff --git a/package/libjxl/Config.in b/package/libjxl/Config.in
index 923560298fce..da04b89f9b8c 100644
--- a/package/libjxl/Config.in
+++ b/package/libjxl/Config.in
@@ -7,7 +7,6 @@ config BR2_PACKAGE_LIBJXL
 	# libjxl fail to link statically due to libatomic issue
 	depends on !BR2_STATIC_LIBS
 	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_81426
-	select BR2_HOST_CMAKE_AT_LEAST_3_19
 	select BR2_PACKAGE_BROTLI
 	select BR2_PACKAGE_HIGHWAY
 	select BR2_PACKAGE_LCMS2
diff --git a/package/llvm-project/clang/Config.in b/package/llvm-project/clang/Config.in
index 4eda9391ddfa..2e2388872073 100644
--- a/package/llvm-project/clang/Config.in
+++ b/package/llvm-project/clang/Config.in
@@ -8,7 +8,6 @@ config BR2_PACKAGE_CLANG
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_USE_WCHAR # std::wstring
 	depends on BR2_HOST_GCC_AT_LEAST_7
-	select BR2_HOST_CMAKE_AT_LEAST_3_20 # cmake required version at least 3.20
 	select BR2_PACKAGE_LLVM
 	help
 	  Clang is a C/C++, Objective C/C++ and OpenCL C front-end
diff --git a/package/llvm-project/compiler-rt/Config.in b/package/llvm-project/compiler-rt/Config.in
index 9fa7fbccfc10..7f910c8cf490 100644
--- a/package/llvm-project/compiler-rt/Config.in
+++ b/package/llvm-project/compiler-rt/Config.in
@@ -5,7 +5,6 @@ config BR2_PACKAGE_COMPILER_RT
 	depends on BR2_TOOLCHAIN_USES_GLIBC # asan lib requires
 	depends on BR2_HOST_GCC_AT_LEAST_7 # host-clang
 	select BR2_PACKAGE_LIBXCRYPT
-	select BR2_HOST_CMAKE_AT_LEAST_3_20 # cmake required version at least 3.20
 	help
 	  A collection of runtime libraries primarily used by clang and
 	  llvm to provide builtins, sanitizer runtimes, and profiling
diff --git a/package/llvm-project/libclc/Config.in b/package/llvm-project/libclc/Config.in
index 6b92357e0f0a..85eb88857827 100644
--- a/package/llvm-project/libclc/Config.in
+++ b/package/llvm-project/libclc/Config.in
@@ -2,7 +2,6 @@ config BR2_PACKAGE_LIBCLC
 	bool "libclc"
 	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
 	depends on BR2_HOST_GCC_AT_LEAST_7 # host-llvm
-	select BR2_HOST_CMAKE_AT_LEAST_3_20 # cmake required version at least 3.20
 	help
 	  libclc is an open source, BSD licensed implementation of
 	  the library requirements of the OpenCL C programming language,
diff --git a/package/llvm-project/lld/Config.in.host b/package/llvm-project/lld/Config.in.host
index 63f9f6855804..3bed364a7925 100644
--- a/package/llvm-project/lld/Config.in.host
+++ b/package/llvm-project/lld/Config.in.host
@@ -2,7 +2,6 @@ config BR2_PACKAGE_HOST_LLD
 	bool "host lld"
 	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS # llvm
 	depends on BR2_HOST_GCC_AT_LEAST_7 # host-llvm
-	select BR2_HOST_CMAKE_AT_LEAST_3_20 # cmake required version at least 3.20
 	help
 	  LLD is a linker from the LLVM project that is a drop-in
 	  replacement for system linkers, and runs much faster than
diff --git a/package/llvm-project/llvm/Config.in b/package/llvm-project/llvm/Config.in
index fcf6417a3344..4ee84b3bcc29 100644
--- a/package/llvm-project/llvm/Config.in
+++ b/package/llvm-project/llvm/Config.in
@@ -24,7 +24,6 @@ config BR2_PACKAGE_LLVM
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_USE_WCHAR # std::wstring
 	depends on BR2_HOST_GCC_AT_LEAST_7 # host-llvm
-	select BR2_HOST_CMAKE_AT_LEAST_3_20 # cmake required version at least 3.20
 	help
 	  The LLVM Project is a collection of modular and reusable
 	  compiler and toolchain technologies.
diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
index 9cd912fc7468..c3286d610020 100644
--- a/package/rustc/Config.in.host
+++ b/package/rustc/Config.in.host
@@ -150,8 +150,6 @@ config BR2_PACKAGE_HOST_RUST
 	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
 	# triggers ICE on trunc_int_for_mode, at explow.c:56
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5 || !BR2_aarch64
-	# rust uses llvm >= 17 since 1.73.0
-	select BR2_HOST_CMAKE_AT_LEAST_3_20
 	help
 	  This package will build the compiler for the host as well as
 	  two flavors of the standard library: one for the host, another
diff --git a/package/wpewebkit/Config.in b/package/wpewebkit/Config.in
index c4ee5a27f7d3..49eedca7cdce 100644
--- a/package/wpewebkit/Config.in
+++ b/package/wpewebkit/Config.in
@@ -41,7 +41,6 @@ config BR2_PACKAGE_WPEWEBKIT
 	depends on BR2_PACKAGE_HAS_LIBGLES
 	depends on BR2_PACKAGE_HAS_LIBEGL # wpebackend-fdo
 	depends on BR2_PACKAGE_WPEWEBKIT_ARCH_SUPPORTS
-	select BR2_HOST_CMAKE_AT_LEAST_3_20
 	select BR2_PACKAGE_CAIRO if BR2_ENDIAN = "BIG"
 	select BR2_PACKAGE_CAIRO_PNG if BR2_ENDIAN = "BIG"
 	select BR2_PACKAGE_FONTCONFIG if BR2_ENDIAN = "LITTLE"
diff --git a/support/dependencies/check-host-cmake.mk b/support/dependencies/check-host-cmake.mk
index e3676903198b..225aa10627f9 100644
--- a/support/dependencies/check-host-cmake.mk
+++ b/support/dependencies/check-host-cmake.mk
@@ -1,4 +1,4 @@
-# The cmake minimum version is set to either 3.18 or higher,
+# The cmake minimum version is set to either 3.26 or higher,
 # depending on the highest minimum version required by any
 # of the packages bundled in Buildroot. If a package is
 # bumped or a new one added, and it requires a higher

---
base-commit: 9e9110bf23a86d1e312e23fc19921cd911f53861
change-id: 20260818-host-cmake-at-least-bump-4b3284d4796d

Best regards,
--  
Alexis Lothoré <alexis.lothore@bootlin.com>

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH] package/cmake: bump host-cmake minimum version to 3.26
  2026-08-18 12:11 [Buildroot] [PATCH] package/cmake: bump host-cmake minimum version to 3.26 Alexis Lothoré via buildroot
@ 2026-08-18 13:22 ` Alexis Lothoré via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Alexis Lothoré via buildroot @ 2026-08-18 13:22 UTC (permalink / raw)
  To: Alexis Lothoré, buildroot
  Cc: Thomas Petazzoni, Nicolas Carrier, Adrian Perez de Castro,
	Bernd Kuhls, Daniel Lang, Dick Olsson, Fabio Urquiza,
	Joseph Kogut, Julien Olivain, Romain Naour, Valentin Korenblit

On Tue Aug 18, 2026 at 2:11 PM CEST, Alexis Lothoré wrote:

[...]

> And while I've not been able to make _any cmake-based C++ package_ build
> fail (so there is still one subtle detail I am not getting), I managed
> to make many package build fail on this exact same "stdlib.h not found"
> error:
>   - protobuf
>   - glog
>   - dbus-cxx
>   - sdbus-cpp
>   - log4cxx
>   - taglib
>   - sqlitecpp
>   - ...

A small clarification, because my english may be a bit broken here: I
did not manage to reproduce the issue for _all_ C+ cmake-based packages,
only for a part of the upstream packages. The failure to reproduce the
issue could be explain for some (eg: many C++ projects do not trigger
any build, those are self-contained in a single header, eg
json-for-modern-cpp), but as another example, paho-mqtt-cpp builds fine
in my setup, while I would have expected it to fail.

> As the issue affects many packages, and that the faulty cmake version is
> still shipped on some standard distributions, bump the minimal host-cmake
> version to 3.26 to prevent this issue.
>
> [0] https://gitlab.kitware.com/cmake/cmake/-/commit/607bccb4efe1
>
> Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
> ---
> Hi Buildroot community,
> this patch proposes a quite aggressive cmake bump, following a quite
> long investigation. While cmake 3.26 has been in the wild for more than
> 3 years, it has some non negligeable consequences for users and CI:
> host-cmake will be systematically built in more cases than today,
> extending the build time in the process. If that's a no-go, I am open to
> ideas about how to better handle this.

I also failed to mention that the issue affects 2025.02.x, 2026.05.x and
master.

Alexis

-- 
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-18 13:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 12:11 [Buildroot] [PATCH] package/cmake: bump host-cmake minimum version to 3.26 Alexis Lothoré via buildroot
2026-08-18 13:22 ` Alexis Lothoré via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.