Skip to contentSkip to conversation

pm: cpupower: Makefile: Fix cross compilation

PATCH In review Florian Fainelli 2 participants 3 messages Nov 21, 2024 – Nov 22, 2024 CPU power monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pm: cpupower: Makefile: Fix cross compilation

After f79473ed9220 ("pm: cpupower: Makefile: Allow overriding cross-compiling env params") we would fail to cross compile cpupower in buildroot which uses the recipe at [1] where only the CROSS variable is being set.

The issue here is the use of the lazy evaluation for all variables: CC, LD, AR, STRIP, RANLIB, rather than just CROSS.

[1]:
https://git.buildroot.net/buildroot/tree/package/linux-tools/linux-tool-cpupower.mk.in

Fixes f79473ed9220 ("pm: cpupower: Makefile: Allow overriding cross-compiling env params")
Change-Id Id98f2c648c82c08044b7281714bc6a8e921629ad
---
 tools/power/cpupower/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tools/power/cpupower/Makefile +5 -5
index 175004ce44b2..96bb1e5f3970 100644
@@ -87,11 +87,11 @@ INSTALL_SCRIPT = ${INSTALL} -m 644
 # 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
+CC = $(CROSS)gcc
+LD = $(CROSS)gcc
+AR = $(CROSS)ar
+STRIP = $(CROSS)strip
+RANLIB = $(CROSS)ranlib
 HOSTCC = gcc
 MKDIR = mkdir
 
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 29 lines · Florian Fainelli

After f79473ed9220 ("pm: cpupower: Makefile: Allow overriding cross-compiling env params") we would fail to cross compile cpupower in buildroot which uses the recipe at [1] where only the CROSS variable is being set.

The issue here is the use of the lazy evaluation for all variables: CC, LD, AR, STRIP, RANLIB, rather than just CROSS.

[1]:
https://git.buildroot.net/buildroot/tree/package/linux-tools/linux-tool-cpupower.mk.in

Fixes f79473ed9220 ("pm: cpupower: Makefile: Allow overriding cross-compiling env params")
Change-Id Id98f2c648c82c08044b7281714bc6a8e921629ad
---
  tools/power/cpupower/Makefile | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
tools/power/cpupower/Makefile +0 -3
index 175004ce44b2..96bb1e5f3970 100644
@@ -87,11 +87,11 @@ INSTALL_SCRIPT = ${INSTALL} -m 644
  # 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

tools/power/cpupower/Makefile INSTALL_SCRIPT = ${INSTALL} -m 644 · line 97

Quoted 10 lines
tools/power/cpupower/Makefile +5 -2
-STRIP ?= $(CROSS)strip
-RANLIB ?= $(CROSS)ranlib
+CC = $(CROSS)gcc
+LD = $(CROSS)gcc
+AR = $(CROSS)ar
+STRIP = $(CROSS)strip
+RANLIB = $(CROSS)ranlib
  HOSTCC = gcc
  MKDIR = mkdir
 

Thank you for the patch. I will apply this once the merge window closes.

thanks,
-- Shuah

#2 lore raw
Quoted 34 lines · Shuah Khan
Quoted 33 lines · Florian Fainelli

After f79473ed9220 ("pm: cpupower: Makefile: Allow overriding cross-compiling env params") we would fail to cross compile cpupower in buildroot which uses the recipe at [1] where only the CROSS variable is being set.

The issue here is the use of the lazy evaluation for all variables: CC, LD, AR, STRIP, RANLIB, rather than just CROSS.

[1]:
https://git.buildroot.net/buildroot/tree/package/linux-tools/linux- tool-cpupower.mk.in

Fixes f79473ed9220 ("pm: cpupower: Makefile: Allow overriding cross- compiling env params")
Change-Id Id98f2c648c82c08044b7281714bc6a8e921629ad

---
  tools/power/cpupower/Makefile | 10 +++++-----

  1 file changed, 5 insertions(+), 5 deletions(-)
tools/power/cpupower/Makefile +0 -0
index 175004ce44b2..96bb1e5f3970 100644
@@ -87,11 +87,11 @@ INSTALL_SCRIPT = ${INSTALL} -m 644
   # 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-

tools/power/cpupower/Makefile +2 -5
-CC ?= $(CROSS)gcc
-LD ?= $(CROSS)gcc
-AR ?= $(CROSS)ar
-STRIP ?= $(CROSS)strip
-RANLIB ?= $(CROSS)ranlib
+CC = $(CROSS)gcc
+LD = $(CROSS)gcc
Quoted 8 lines
Quoted 5 lines
tools/power/cpupower/Makefile +3 -0
+AR = $(CROSS)ar
+STRIP = $(CROSS)strip
+RANLIB = $(CROSS)ranlib

  HOSTCC = gcc
  MKDIR = mkdir

Thank you for the patch. I will apply this once the merge window closes.

Thanks for taking a look, there is still an on-going discussion with Peng about how to best approach this, the discussion is here:

https://lore.kernel.org/all/PAXPR04MB84595BA5BEAE2D21F015036688232@PAXPR04MB8459.eurprd04.prod.outlook.com/

Let's wait until that settles before taking this patch, or Peng's.

Signature · 1 line
Florian