Skip to contentSkip to conversation

tools/power/x86/intel-speed-select: Prefix header search path with sysroot

PATCH In review Khem Raj 2 participants 2 messages Jan 29, 2025 – Feb 4, 2025

Subsystems (2)
lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 tools/power/x86/intel-speed-select: Prefix header search path with sysroot

This helps when using a cross-compiler for building intel-speed-select, currently, its hardcoded to pick libnl3 headers from build host which may not be same as build target when cross compiling.

cc -print-sysroot will print nothing if compiler is configured without a sysroot and result in same string as it is now.

Fixes errors with gcc configured with host include poisoning e.g.

cc1: error: include location "/usr/include/libnl3" is unsafe for cross-compilation [-Werror=poison-system-directories]

Cc Srinivas Pandruvada <[email protected]>
Cc Len Brown <[email protected]>
---
 tools/power/x86/intel-speed-select/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/x86/intel-speed-select/Makefile +1 -1
index 7221f2f55e8b..8d3a02a20f3d 100644
@@ -13,7 +13,7 @@ endif
 # Do not use make's built-in rules
 # (this improves performance and avoids hard-to-debug behaviour);
 MAKEFLAGS += -r
-override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include -I/usr/include/libnl3
+override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include -I$(shell $(CC) -print-sysroot)/usr/include/libnl3
 override LDFLAGS += -lnl-genl-3 -lnl-3
 
 ALL_TARGETS := intel-speed-select
#1 lore raw
Quoted 10 lines · Khem Raj

This helps when using a cross-compiler for building intel-speed- select,
currently, its hardcoded to pick libnl3 headers from build host which may
not be same as build target when cross compiling.

cc -print-sysroot will print nothing if compiler is configured without
a sysroot and result in same string as it is now.

Quoted 8 lines

Fixes errors with gcc configured with host include poisoning e.g.

cc1: error: include location "/usr/include/libnl3" is unsafe for cross-compilation [-Werror=poison-system-directories]

Cc Srinivas Pandruvada <[email protected]>
Cc Len Brown <[email protected]>

Thanks. will take for the next release.

-Srinivas

Quoted 20 lines

---
 tools/power/x86/intel-speed-select/Makefile | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/x86/intel-speed-select/Makefile +0 -0
index 7221f2f55e8b..8d3a02a20f3d 100644
@@ -13,7 +13,7 @@ endif
  # Do not use make's built-in rules
  # (this improves performance and avoids hard-to-debug behaviour);

 MAKEFLAGS += -r
-override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include - I/usr/include/libnl3
+override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include - I$(shell $(CC) -print-sysroot)/usr/include/libnl3 override LDFLAGS += -lnl-genl-3 -lnl-3

 ALL_TARGETS := intel-speed-select