turbostat: fix build with kernel 7.x
PATCH 1/6 turbostat: fix build with kernel 7.x
From: Khem Raj <[email protected]>
Since kernel 7.x tools/include/linux/compiler_types.h includes <linux/compiler-context-analysis.h>, a no-op stub for the new compiler-based context analysis annotations. The recipe copies compiler_types.h out of the kernel tree and rewrites its includes to local headers, but did not know about the new one, so the build fails:
./compiler_types.h:16:10: fatal error: 'linux/compiler-context-analysis.h' file not found
Copy the new header when the kernel provides it and rewrite the include like the others.
While here, fix the mangled quoting on the TMPCHECK line, which produced
run.do_compile: line 138: TMPCHECK=grep: command not found
and left TMPCHECK unset. The unquoted [ -n $TMPCHECK ] test then always succeeded, so the vdso branch was taken regardless of the grep result.
--- meta-oe/recipes-kernel/turbostat/turbostat.bb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
meta-oe/recipes-kernel/turbostat/turbostat.bb +6 -2
@@ -59,6 +59,9 @@ do_configure:prepend() { cp -r ${STAGING_KERNEL_DIR}/tools/include/linux/compiler.h ${S} cp -r ${STAGING_KERNEL_DIR}/tools/include/linux/compiler_types.h ${S} cp -r ${STAGING_KERNEL_DIR}/tools/include/linux/compiler-gcc.h ${S} + if [ -f "${STAGING_KERNEL_DIR}/tools/include/linux/compiler-context-analysis.h" ]; then + cp -r ${STAGING_KERNEL_DIR}/tools/include/linux/compiler-context-analysis.h ${S} + fi cp -r ${STAGING_KERNEL_DIR}/tools/power/x86/turbostat/* ${S} }
@@ -68,8 +71,9 @@ do_compile() { sed -i 's#<linux/compiler.h>#"compiler.h"#' build_bug.h sed -i 's#<linux/compiler_types.h>#"compiler_types.h"#' compiler.h sed -i 's#<linux/compiler-gcc.h>#"compiler-gcc.h"#' compiler_types.h - 'TMPCHECK='grep "<vdso/const.h>" bits.h'' || true - if [ -n $TMPCHECK ]; then + sed -i 's#<linux/compiler-context-analysis.h>#"compiler-context-analysis.h"#' compiler_types.h + TMPCHECK=$(grep "<vdso/const.h>" bits.h || true) + if [ -n "$TMPCHECK" ]; then sed -i 's#<vdso/const.h>#"const.h"#' bits.h sed -i 's#<uapi/linux/const.h>#<linux/const.h>#' const.h else
PATCH 2/6 pcapplusplus: Fix build with clang-23
--- ...lign-template-inline-instead-of-stat.patch | 34 +++++++++++++++++++ .../pcapplusplus/pcapplusplus_26.07.bb | 3 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-Common-declare-align-template-inline-instead-of-stat.patch
meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus/0001-Common-declare-align-template-inline-instead-of-stat.patch new file +34 -0
@@ -0,0 +1,34 @@ +From fe044dbd8459924558c0965833b8f1e78c8921ea Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Tue, 8 Sep 2026 02:16:00 +0000 +Subject: [PATCH] Common++: declare align() template inline instead of static + +Newer clang (23+) enables -Wunused-template for namespace-scope static +function templates defined in headers, which fails the -Werror build for +every translation unit that includes GeneralUtils.h without using +align(): + + Common++/header/GeneralUtils.h:50:38: error: unused function template 'align' [-Werror,-Wunused-template] + +Declare it inline instead; that is the correct linkage for a template +defined in a header and does not trigger the warning. + +Upstream-Status: Pending +Signed-off-by: Khem Raj <[email protected]> +--- + Common++/header/GeneralUtils.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Common++/header/GeneralUtils.h b/Common++/header/GeneralUtils.h +index 060acb4c..ba5428d6 100644 +--- a/Common++/header/GeneralUtils.h ++++ b/Common++/header/GeneralUtils.h +@@ -47,7 +47,7 @@ namespace pcpp + /// Calculates alignment. + /// @param[in] number Given number + /// @return The aligned number +- template <int alignment> static int align(int number) ++ template <int alignment> inline int align(int number) + { + // Only works for alignment with power of 2 + constexpr bool isPowerOfTwo = alignment && ((alignment & (alignment - 1)) == 0);
meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_26.07.bb +2 -1
@@ -7,7 +7,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=911690f51af322440237a253d695d19f" DEPENDS = "libpcap" -SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master;tag=v${PV}" +SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master;tag=v${PV} \ + file://0001-Common-declare-align-template-inline-instead-of-stat.patch" SRCREV = "0dbbb9c75eb232135f13fdb794318c4da3270ebc"
PATCH 3/6 libfaketime: Upgrade to 0.9.13
In reply to Khem RajRelease notes:
https://github.com/wolfcw/libfaketime/blob/v0.9.13/NEWS
Drop 0001-Add-const-qualifiers-to-fix-build-with-ISO-C23.patch, it is merged upstream via PR #525.
Add a patch to fix the build with clang 23, which added -Wunused-but-set-global and turns the -Werror in src/Makefile into:
libfaketime.c:340:23: error: variable 'real_lstat' set but not used
[-Werror,-Wunused-but-set-global]
ftpl_init() resolves every real_* pointer up front by design, so the ones whose wrappers are not compiled on Linux/glibc end up written and never read. Annotate those with __attribute__((unused)) rather than adding -Wno-error=unused-but-set-global to CFLAGS, since the Makefile has no flag-probing and older clang rejects the unknown warning group under the same -Werror.
---
...qualifiers-to-fix-build-with-ISO-C23.patch | 34 ----------
...-write-only-real_-pointers-as-unused.patch | 68 +++++++++++++++++++
...ketime_0.9.12.bb => libfaketime_0.9.13.bb} | 4 +-
3 files changed, 70 insertions(+), 36 deletions(-)
delete mode 100644 meta-oe/recipes-test/libfaketime/libfaketime/0001-Add-const-qualifiers-to-fix-build-with-ISO-C23.patch
create mode 100644 meta-oe/recipes-test/libfaketime/libfaketime/0001-Mark-write-only-real_-pointers-as-unused.patch
rename meta-oe/recipes-test/libfaketime/{libfaketime_0.9.12.bb => libfaketime_0.9.13.bb} (85%)meta-oe/recipes-test/libfaketime/libfaketime/0001-Add-const-qualifiers-to-fix-build-with-ISO-C23.patch deleted +0 -34
@@ -1,34 +0,0 @@ -From dbe865dfdba0145d993d70b7fd4ec88b2f47554b Mon Sep 17 00:00:00 2001 -From: Tomas Korbar <[email protected]> -Date: Mon, 15 Dec 2025 11:03:21 +0100 -Subject: [PATCH] Add const qualifiers to fix build with ISO C23 - -Fix https://github.com/wolfcw/libfaketime/issues/524 - -Upstream-Status: Backport [https://github.com/wolfcw/libfaketime/pull/525] ---- - src/libfaketime.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/libfaketime.c b/src/libfaketime.c -index ef1dca9..02839c8 100644 ---- a/src/libfaketime.c -+++ b/src/libfaketime.c -@@ -2666,7 +2666,7 @@ int timespec_get(struct timespec *ts, int base) - static void parse_ft_string(const char *user_faked_time) - { - struct tm user_faked_time_tm; -- char * tmp_time_fmt; -+ const char * tmp_time_fmt; - char * nstime_str; - - if (!strncmp(user_faked_time, user_faked_time_saved, BUFFERLEN)) -@@ -3338,7 +3338,7 @@ static void prepare_config_contents(char *contents) - bool str_array_contains(const char *haystack, const char *needle) - { - size_t needle_len = strlen(needle); -- char *pos = strstr(haystack, needle); -+ const char *pos = strstr(haystack, needle); - while (pos) { - if (pos == haystack || *(pos - 1) == ',') { - char nextc = *(pos + needle_len);
meta-oe/recipes-test/libfaketime/libfaketime/0001-Mark-write-only-real_-pointers-as-unused.patch new file +68 -0
68 lines not on this page · raw message
meta-oe/recipes-test/libfaketime/libfaketime_0.9.13.bb renamed from meta-oe/recipes-test/libfaketime/libfaketime_0.9.12.bb +2 -2
@@ -3,10 +3,10 @@ SECTION = "libs" LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" -SRCREV = "3ccdd344aadf1e317156fa5fb7c881f2c4404778" +SRCREV = "86b37fde2fed7336ea2d0c17928e3015a55d9b4a" SRC_URI = "git://github.com/wolfcw/libfaketime.git;branch=master;tag=v${PV};protocol=https \ - file://0001-Add-const-qualifiers-to-fix-build-with-ISO-C23.patch \ + file://0001-Mark-write-only-real_-pointers-as-unused.patch \ " CFLAGS:append:libc-musl = " -D_LARGEFILE64_SOURCE"
PATCH 4/6 microsoft-gsl: upgrade 4.2.2 -> 5.0.0
In reply to Khem RajRelease notes:
https://github.com/microsoft/GSL/releases/tag/v5.0.0
Switch to the rel/5.0 branch. New in this release is the gsl::dyn_array container, so the -dev package gains include/gsl/dyn_array.
Fix the build with clang 22. The tests are compiled with -Weverything -Werror, so every new clang diagnostic becomes a build failure; the newly added lifetime-safety suggestions produce:
notnull_tests.cpp:63:19: error: parameter in intra-TU constructor should
be marked [[clang::lifetimebound]] [-Werror,-Wlifetime-safety-intra-tu-constructor-suggestions]
---
.../microsoft-gsl/microsoft-gsl/run-ptest | 14 +++++++++++--
...ft-gsl_4.2.2.bb => microsoft-gsl_5.0.0.bb} | 20 +++++++++++--------
2 files changed, 24 insertions(+), 10 deletions(-)
rename meta-oe/recipes-devtools/microsoft-gsl/{microsoft-gsl_4.2.2.bb => microsoft-gsl_5.0.0.bb} (75%)meta-oe/recipes-devtools/microsoft-gsl/microsoft-gsl/run-ptest +12 -2
@@ -1,4 +1,14 @@ #!/bin/sh -gsl_tests && echo "PASS: gsl_tests" || echo "FAIL: gsl_tests" -gsl_noexcept_tests && echo "PASS: gsl_noexcept_tests" || echo "FAIL: gsl_noexcept_tests" +# Upstream builds one executable per tests/*.cpp source, so iterate rather +# than naming them individually. +cd "$(dirname "$0")" || exit 1 + +for t in *_tests; do + [ -x "./$t" ] || continue + if "./$t"; then + echo "PASS: $t" + else + echo "FAIL: $t" + fi +done
meta-oe/recipes-devtools/microsoft-gsl/microsoft-gsl_5.0.0.bb renamed from meta-oe/recipes-devtools/microsoft-gsl/microsoft-gsl_4.2.2.bb +12 -8
@@ -8,10 +8,10 @@ HOMEPAGE = "https://github.com/microsoft/GSL" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://LICENSE;md5=363055e71e77071107ba2bb9a54bd9a7" -SRC_URI = "git://github.com/microsoft/GSL.git;protocol=https;branch=rel/4.2;tag=v${PV} \ +SRC_URI = "git://github.com/microsoft/GSL.git;protocol=https;branch=rel/5.0;tag=v${PV} \ file://run-ptest \ " -SRCREV = "152d6eb989a1ecd23fe9c9cfb2fb8cfc7c0cd0c1" +SRCREV = "417ef685eafd626db765f0027b7fc5a0057e0770" inherit cmake pkgconfig ptest
@@ -24,18 +24,22 @@ PACKAGECONFIG ??= "${@bb.utils.contains('PTEST_ENABLED', '1', 'ptest','', d)}" PACKAGECONFIG[ptest] = "-DGSL_TEST=ON,-DGSL_TEST=OFF,googletest" # clang disagrees with https://github.com/google/googletest/pull/3457 -CXXFLAGS:append:toolchain-clang = " -Wno-error=switch-default" +# The tests are built with -Weverything -Werror, so each clang release turns +# its new diagnostics into build failures. +CXXFLAGS:append:toolchain-clang = "\ + -Wno-error=switch-default \ + -Wno-unknown-warning-option \ + -Wno-error=lifetime-safety-intra-tu-suggestions \ + -Wno-error=lifetime-safety-intra-tu-constructor-suggestions \ +" # Disable disabled-macro-expansion warning as error as its seen on musl CXXFLAGS:append:toolchain-clang:libc-musl = " -Wno-error=disabled-macro-expansion" do_install_ptest() { - install -d ${D}${bindir} - install -m 0755 ${B}/tests/gsl_tests ${D}${bindir} - install -m 0755 ${B}/tests/gsl_noexcept_tests ${D}${bindir} + install -d ${D}${PTEST_PATH} + install -m 0755 ${B}/tests/*_tests ${D}${PTEST_PATH} } -FILES:${PN}-ptest = "${bindir}/gsl*_tests" - # there is already other gsl recipe, so recipe name does not match the real component name CVE_PRODUCT = "microsoft:gsl"
PATCH 5/6 pegtl: Fix build with clang-23
In reply to Khem Rajclang 23 enables -Wunused-template under plain -Wall, and every test in src/test is compiled with -pedantic -Wall -Wextra -Wshadow -Werror, so the whole test build fails:
include/tao/pegtl/internal/match_impl.hpp:24:30: error: unused function
template 'match_no_control' [-Werror,-Wunused-template]
match_no_control() is a namespace-scope static function template in a header, so it has internal linkage in every translation unit. It is only ever referenced from other templates, so in a TU where none of those get instantiated it really is unused and clang says so.
Add a patch declaring the two overloads inline instead, which is the correct linkage for a function template defined in a header.
--- ...-match_no_control-inline-instead-of-.patch | 48 +++++++++++++++++++ meta-oe/recipes-extended/pegtl/pegtl_4.0.1.bb | 1 + 2 files changed, 49 insertions(+) create mode 100644 meta-oe/recipes-extended/pegtl/pegtl/0001-internal-declare-match_no_control-inline-instead-of-.patch
meta-oe/recipes-extended/pegtl/pegtl/0001-internal-declare-match_no_control-inline-instead-of-.patch new file +48 -0
@@ -0,0 +1,48 @@ +From e5997938100dd459ad9473bf574ab9a75e5a0a53 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Tue, 8 Sep 2026 05:31:46 +0000 +Subject: [PATCH] internal: declare match_no_control() inline instead of static + +Newer clang (23+) enables -Wunused-template for namespace-scope static +function templates defined in headers. match_no_control() is only ever +referenced from other templates, so in any translation unit where none of +those get instantiated the internal-linkage template is genuinely unused +and the -Werror test build fails: + + include/tao/pegtl/internal/match_impl.hpp:24:30: error: unused function + template 'match_no_control' [-Werror,-Wunused-template] + +This breaks every test in src/test, since they are all compiled with +-Wall -Werror. + +Declare the two overloads inline instead; that is the correct linkage for +a function template defined in a header and does not trigger the warning. + +Upstream-Status: Pending +Signed-off-by: Khem Raj <[email protected]> +--- + include/tao/pegtl/internal/match_impl.hpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/tao/pegtl/internal/match_impl.hpp b/include/tao/pegtl/internal/match_impl.hpp +index 8723dae2..c13dd4f7 100644 +--- a/include/tao/pegtl/internal/match_impl.hpp ++++ b/include/tao/pegtl/internal/match_impl.hpp +@@ -21,7 +21,7 @@ namespace TAO_PEGTL_NAMESPACE::internal + template< typename... > class Control, + typename ParseInput, + typename... States > +- [[nodiscard]] static auto match_no_control( ParseInput& in, States&&... st ) ++ [[nodiscard]] inline auto match_no_control( ParseInput& in, States&&... st ) + -> decltype( Rule::template match< A, M, Action, Control >( in, st... ) ) + { + return Rule::template match< A, M, Action, Control >( in, st... ); +@@ -34,7 +34,7 @@ namespace TAO_PEGTL_NAMESPACE::internal + template< typename... > class Control, + typename ParseInput, + typename... States > +- [[nodiscard]] static auto match_no_control( ParseInput& in, States&&... /*unused*/ ) ++ [[nodiscard]] inline auto match_no_control( ParseInput& in, States&&... /*unused*/ ) + -> decltype( Rule::match( in ) ) + { + return Rule::match( in );
meta-oe/recipes-extended/pegtl/pegtl_4.0.1.bb +1 -0
@@ -4,6 +4,7 @@ LICENSE = "BSL-1.0" LIC_FILES_CHKSUM = "file://LICENSE_1_0.txt;md5=e4224ccaecb14d942c71d31bef20d78c" SRC_URI = "git://github.com/taocpp/PEGTL.git;protocol=https;branch=4.x \ + file://0001-internal-declare-match_no_control-inline-instead-of-.patch \ file://run-ptest \ "
PATCH 6/6 polkit-gnome: Fix build against gtk+3 without the X11 backend
In reply to Khem RajFrom: Khem Raj <[email protected]>
0004-Use-fresh-X11-timestamps-when-displaying-authenticat.patch includes gdk/gdkx.h unconditionally, which does not exist when gtk+3 is configured without the X11 backend, as is the case on wayland only distros:
polkitgnomeauthenticator.c:29:10: fatal error: 'gdk/gdkx.h' file not found
The patch already checks GDK_IS_X11_WINDOW() at runtime, but that is not
enough: the macro is declared in gdkx.h too, so the include and the gdk_x11_get_server_time() call have to be compiled out as well. Guard both with GDK_WINDOWING_X11 and keep gtk_window_present() as the non-X11 path.
Include gdk/gdk.h explicitly before the guard. GDK_WINDOWING_X11 comes from gdkconfig.h and no gdk or gtk header is pulled in earlier in that file, so without it the guard would always be false and X11 builds would silently lose the fresh timestamp instead of failing to build.
--- ...mestamps-when-displaying-authenticat.patch | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-)
meta-gnome/recipes-extended/polkit-gnome/polkit-gnome/0004-Use-fresh-X11-timestamps-when-displaying-authenticat.patch +27 -8
@@ -8,41 +8,60 @@ Bug: https://bugzilla.gnome.org/show_bug.cgi?id=676076 Bug-Debian: https://bugs.debian.org/684300 Bug-Ubuntu: https://launchpad.net/bugs/946171 +Guard the X11 specific parts with GDK_WINDOWING_X11 so this still builds +against a gtk+3 configured without the X11 backend, as is the case on +wayland only distros: + + polkitgnomeauthenticator.c:29:10: fatal error: 'gdk/gdkx.h' file not found + +gdk/gdkx.h does not exist in such a build, and GDK_IS_X11_WINDOW() is +declared there too, so the include and the gdk_x11_get_server_time() call +both have to be compiled out rather than only guarded at runtime. + +gdk/gdk.h is included explicitly before the guard because GDK_WINDOWING_X11 +comes from gdkconfig.h, and no gdk or gtk header is pulled in earlier in +this file; without it the guard would always be false and X11 builds would +silently lose the fresh timestamp. + Upstream-Status: Pending Signed-off-by: Khem Raj <[email protected]> --- - src/polkitgnomeauthenticator.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) + src/polkitgnomeauthenticator.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/polkitgnomeauthenticator.c b/src/polkitgnomeauthenticator.c -index 23163b4..e57d76e 100644 +index 23163b4..ae237de 100644 --- a/src/polkitgnomeauthenticator.c +++ b/src/polkitgnomeauthenticator.c -@@ -26,6 +26,7 @@ +@@ -26,6 +26,10 @@ #include <sys/types.h> #include <pwd.h> #include <glib/gi18n.h> ++#include <gdk/gdk.h> ++#ifdef GDK_WINDOWING_X11 +#include <gdk/gdkx.h> ++#endif #include <polkit/polkit.h> #include <polkitagent/polkitagent.h> -@@ -306,7 +307,17 @@ session_request (PolkitAgentSession *session, +@@ -306,7 +310,19 @@ session_request (PolkitAgentSession *session, } gtk_widget_show_all (GTK_WIDGET (authenticator->dialog)); - gtk_window_present (GTK_WINDOW (authenticator->dialog)); ++#ifdef GDK_WINDOWING_X11 + GdkWindow *window = gtk_widget_get_window (GTK_WIDGET (authenticator->dialog)); + + if (GDK_IS_X11_WINDOW (window)) + { -+ gtk_window_present_with_time (GTK_WINDOW (authenticator->dialog), gdk_x11_get_server_time (window)); ++ gtk_window_present_with_time (GTK_WINDOW (authenticator->dialog), gdk_x11_get_server_time (window)); + } + else ++#endif + { -+ gtk_window_present (GTK_WINDOW (authenticator->dialog)); ++ gtk_window_present (GTK_WINDOW (authenticator->dialog)); + } + password = polkit_gnome_authentication_dialog_run_until_response_for_prompt (POLKIT_GNOME_AUTHENTICATION_DIALOG (authenticator->dialog), modified_request, echo_on, -