cpufrequtils: fix latent do_install build failure
cover cpufrequtils: fix latent do_install build failure
do_install runs make with -e, and install: depends on all:, so anything out of date at install time gets recompiled under -e. -e makes the environment beat the makefile's own assignments, and every CPPFLAGS and CFLAGS use in this makefile is +=, seeded from the environment. bitbake exports CPPFLAGS (empty by default), so the makefile's
CPPFLAGS += -DVERSION=\"$(VERSION)\" -DPACKAGE=\"$(PACKAGE)\" \
-DPACKAGE_BUGREPORT=\"$(PACKAGE_BUGREPORT)\" -D_GNU_SOURCEis discarded. print_header() in utils/info.c and utils/set.c uses PACKAGE and VERSION unconditionally, so the recompile fails:
utils/info.c:447:16: error: 'PACKAGE' undeclared (first use in this function) utils/set.c:38:16: error: 'PACKAGE' undeclared (first use in this function)
make: *** [Makefile:166: cpufreq-info] Error 1
A from-scratch build does not hit this: do_compile leaves everything up to date, so all: has nothing to redo and nothing is compiled under -e. It bites only when something is newer than the binaries by the time do_install runs, which is why it survived this long. To reproduce on an unpatched tree:
bitbake cpufrequtils -c compile
touch .../cpufrequtils-008/utils/info.c
bitbake cpufrequtils -c install
Dropping -e fixes it, and also makes do_install compile with the same flags do_compile used - the install-time relink was otherwise losing -pipe and $(WARNINGS) too.
-e is also why 0001-dont-unset-cflags.patch exists: it was there to override the makefile's CC/LD/AR/STRIP/RANLIB assignments. CC is the only one the makefile ever references, so passing it on the make command line replaces the patch entirely.
Patch 1 is source provenance and whitespace only; patch 2 is the fix above, plus NLS as a PACKAGECONFIG.
Verified with clean cleansstate builds for a 32-bit Arm target, and the reproducer above no longer fails.
---
Alex Kiernan (2):
cpufrequtils: fetch from git.kernel.org, mark PV as post-release
cpufrequtils: fix do_install, drop the toolchain patch, add nls PACKAGECONFIG
.../cpufrequtils/0001-dont-unset-cflags.patch | 32 ---------------------- .../recipes-bsp/cpufrequtils/cpufrequtils_008.bb | 27 ++++++++---------- 2 files changed, 12 insertions(+), 47 deletions(-)
---
base-commit: 58dbc84826947c9436d4b527a4569fdd1ce5ea19
change-id: 20260814-cpufrequtils-0a49f332a1c2
Best regards,
Signature · 1 line
Alex Kiernan <[email protected]>
PATCH 1/2 cpufrequtils: fetch from git.kernel.org, mark PV as post-release
SRC_URI pointed at github.com/emagii/cpufrequtils. The canonical upstream repository is still live and its master HEAD is exactly the SRCREV pinned here, a2f0c39d, so the source is unchanged. The kernel.org URL was already in the recipe, commented out and malformed (unterminated quote). Both git://
and https:// serve it today, so there was no technical reason for the mirror; https is used per the usual preference.
The pinned revision is 8 commits past the 008 release that the tarball at kernel.org/pub/linux/utils/kernel/cpufreq/ contains - removal of the /proc interface, Catalan translations, MAX_LINE_LEN, two x86 aperf fixes, and the "make NLS optional" commit that introduces the NLS switch this recipe relies on. PV gains +git so it stops claiming to be the 2010 release.
Shell function bodies are reindented to tabs. No functional change.
AI-Generated: Claude Opus 5 (Claude Code)
--- meta-oe/recipes-bsp/cpufrequtils/cpufrequtils_008.bb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
meta-oe/recipes-bsp/cpufrequtils/cpufrequtils_008.bb +7 -7
@@ -8,9 +8,9 @@ LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" SRCREV = "a2f0c39d5f21596bb9f5223e895c0ff210b265d0" -# SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/cpufreq/cpufrequtils.git +PV .= "+git" -SRC_URI = "git://github.com/emagii/cpufrequtils.git;branch=master;protocol=https \ +SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/cpufreq/cpufrequtils.git;branch=master;protocol=https \ file://0001-dont-unset-cflags.patch \ "
@@ -26,13 +26,13 @@ TARGET_CC_ARCH += "${LDFLAGS}" EXTRA_OEMAKE = "V=1 CROSS=${TARGET_PREFIX} STRIPCMD=echo 'CP=cp'" do_compile() { - oe_runmake + oe_runmake } do_install() { - oe_runmake -e install DESTDIR=${D} - rm -f ${D}${libdir}/libcpufreq.so.0 ${D}${libdir}/libcpufreq.so - ln -s libcpufreq.so.0.0.0 ${D}${libdir}/libcpufreq.so.0 - ln -s libcpufreq.so.0.0.0 ${D}${libdir}/libcpufreq.so + oe_runmake -e install DESTDIR=${D} + rm -f ${D}${libdir}/libcpufreq.so.0 ${D}${libdir}/libcpufreq.so + ln -s libcpufreq.so.0.0.0 ${D}${libdir}/libcpufreq.so.0 + ln -s libcpufreq.so.0.0.0 ${D}${libdir}/libcpufreq.so }
Signature · 1 line
2.43.0
PATCH 2/2 cpufrequtils: fix do_install, drop the toolchain patch, add nls PACKAGECONFIG
In reply to Alex Kiernando_install ran make with -e, which gives the environment precedence over the makefile's own assignments. Every CPPFLAGS and CFLAGS use in the makefile is +=, seeded from the environment, so -e discarded all of the makefile's additions: the CPPFLAGS += defining PACKAGE, PACKAGE_BUGREPORT and VERSION, the conditional -DNLS, -pipe and $(WARNINGS). utils/info.c and utils/set.c then failed to build with "'PACKAGE' undeclared" while relinking cpufreq-info and cpufreq-set, which install: pulls in via all:. Dropping -e also makes do_install and do_compile agree on flags, where the install-time relink previously produced binaries built differently from the ones do_compile had made.
-e predates 0001-dont-unset-cflags.patch, back when the makefile assigned CC/LD/AR/STRIP/RANLIB absolutely and -e was the only way to override them. That patch is dropped here in favour of setting CC on the make command line, which outranks a makefile assignment without needing a patch at all. CC is the only one of those variables the makefile ever references: LD, AR and RANLIB are assigned but never used, and STRIP only feeds STRIPCMD, which the recipe already overrides. The patch had carried
Upstream-Status: Pending since 2012 against a project whose last commit was in 2011.
NLS becomes a PACKAGECONFIG rather than an inline USE_NLS expression so it can be set per-recipe, defaulting from USE_NLS so existing behaviour is unchanged. gettext-native is named explicitly because gettext.bbclass substitutes gettext-minimal-native when USE_NLS is no, and that has no xgettext/msgmerge for the update-gmo target this enables. The gettext inherit becomes conditional on the same PACKAGECONFIG, deferred because it reads a value that does not exist yet at that point in the parse.
AI-Generated: Claude Opus 5 (Claude Code)
--- .../cpufrequtils/0001-dont-unset-cflags.patch | 32 ---------------------- .../recipes-bsp/cpufrequtils/cpufrequtils_008.bb | 17 +++++------- 2 files changed, 7 insertions(+), 42 deletions(-)
meta-oe/recipes-bsp/cpufrequtils/cpufrequtils/0001-dont-unset-cflags.patch deleted +0 -32
@@ -1,32 +0,0 @@ -Upstream-Status: Pending - ---- git.old/Makefile 2012-04-17 13:29:46.280435340 +0200 -+++ git/Makefile 2012-04-17 13:31:13.664433470 +0200 -@@ -77,17 +77,7 @@ INSTALL_PROGRAM = ${INSTALL} - INSTALL_DATA = ${INSTALL} -m 644 - INSTALL_SCRIPT = ${INSTALL_PROGRAM} - --# If you are running a cross compiler, you may want to set this --# to something more interesting, like "arm-linux-". If you want --# to compile vs uClibc, that can be done here as well. --CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- --CC = $(CROSS)gcc --LD = $(CROSS)gcc --AR = $(CROSS)ar --STRIP = $(CROSS)strip --RANLIB = $(CROSS)ranlib --HOSTCC = gcc -- -+HOSTCC = $(BUILD_CC) - - # Now we set up the build system - # -@@ -95,7 +85,7 @@ HOSTCC = gcc - # set up PWD so that older versions of make will work with our build. - PWD = $(shell pwd) - --export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS -+export CFLAGS LDFLAGS LIB_OBJS - - # check if compiler option is supported - cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
meta-oe/recipes-bsp/cpufrequtils/cpufrequtils_008.bb +7 -10
@@ -1,6 +1,6 @@ DESCRIPTION = "To make access to the Linux kernel cpufreq subsystem easier for users and cpufreq userspace tools, a cpufrequtils package was created" -inherit gettext +inherit_defer ${@bb.utils.contains('PACKAGECONFIG', 'nls', 'gettext', '', d)} DEPENDS = "libtool-cross"
@@ -10,27 +10,24 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" SRCREV = "a2f0c39d5f21596bb9f5223e895c0ff210b265d0" PV .= "+git" -SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/cpufreq/cpufrequtils.git;branch=master;protocol=https \ - file://0001-dont-unset-cflags.patch \ -" +SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/cpufreq/cpufrequtils.git;branch=master;protocol=https" # Upstream repo does not tag UPSTREAM_CHECK_COMMITS = "1" -EXTRA_OEMAKE:append = " ${@['', 'NLS=false']['${USE_NLS}' == 'no']} " - - - TARGET_CC_ARCH += "${LDFLAGS}" -EXTRA_OEMAKE = "V=1 CROSS=${TARGET_PREFIX} STRIPCMD=echo 'CP=cp'" +PACKAGECONFIG ??= "${@oe.utils.conditional('USE_NLS', 'no', '', 'nls', d)}" +PACKAGECONFIG[nls] = "NLS=true,NLS=false,gettext-native" + +EXTRA_OEMAKE = "V=1 CROSS=${TARGET_PREFIX} CC='${CC}' STRIPCMD=echo 'CP=cp' ${PACKAGECONFIG_CONFARGS}" do_compile() { oe_runmake } do_install() { - oe_runmake -e install DESTDIR=${D} + oe_runmake install DESTDIR=${D} rm -f ${D}${libdir}/libcpufreq.so.0 ${D}${libdir}/libcpufreq.so ln -s libcpufreq.so.0.0.0 ${D}${libdir}/libcpufreq.so.0 ln -s libcpufreq.so.0.0.0 ${D}${libdir}/libcpufreq.so
Signature · 1 line
2.43.0