CMake fails to bootstrap its host tool with GCC 16:
cmake.o: undefined reference to
`cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake*)'
Source/cmake.cxx includes cmGlobalGhsMultiGenerator.h guarded only by
__linux__, not by CMAKE_BOOTSTRAP. The NewFactory() call is compiled out
during bootstrap, but GCC 16 devirtualization still emits the uncalled
inline NewFactory() and the cmGlobalGeneratorSimpleFactory<> template,
which reference symbols only defined in cmGlobalGhsMultiGenerator.cxx, a
file that is not compiled during bootstrap.
Backport the upstream fix, which moves the include behind the existing
CMAKE_BOOTSTRAP guard. It is in no 3.30.x release (that branch is EOL);
upstream shipped it first in 3.31.10 / 4.0.5 / 4.1.2.
Assisted-by: Claude:claude-opus-4-8
Link: https://github.com/openwrt/openwrt/pull/24303
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit ee6e56c82ef738199312e3eb28df40806ddf41cf)
32 lines
1017 B
Diff
32 lines
1017 B
Diff
From ea04e19daf7010781d0df980b9683a642093e381 Mon Sep 17 00:00:00 2001
|
|
From: Brad King <brad.king@kitware.com>
|
|
Date: Wed, 24 Sep 2025 12:02:37 -0400
|
|
Subject: bootstrap: Fix compilation with gcc 16 devirtualization
|
|
|
|
Avoid including a header for a subclass whose implementation is not
|
|
compiled during bootstrap.
|
|
|
|
Fixes: #27256
|
|
---
|
|
Source/cmake.cxx | 6 +++---
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
--- a/Source/cmake.cxx
|
|
+++ b/Source/cmake.cxx
|
|
@@ -126,12 +126,12 @@
|
|
# include "cmExtraEclipseCDT4Generator.h"
|
|
# include "cmExtraKateGenerator.h"
|
|
# include "cmExtraSublimeTextGenerator.h"
|
|
-#endif
|
|
|
|
// NOTE: the __linux__ macro is predefined on Android host too, but
|
|
// main CMakeLists.txt filters out this generator by host name.
|
|
-#if (defined(__linux__) && !defined(__ANDROID__)) || defined(_WIN32)
|
|
-# include "cmGlobalGhsMultiGenerator.h"
|
|
+# if (defined(__linux__) && !defined(__ANDROID__)) || defined(_WIN32)
|
|
+# include "cmGlobalGhsMultiGenerator.h"
|
|
+# endif
|
|
#endif
|
|
|
|
#if defined(__APPLE__)
|