Skip to contentSkip to conversation

package/linux-tools: use PKG_CONFIG_LIBDIR in perf make flags

PATCH In review Vasileios Amoiridis 2 participants 3 messages Apr 3, 2025 – May 5, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 package/linux-tools: use PKG_CONFIG_LIBDIR in perf make flags

After commit 440cf77625e300e683ca0edc39fbc4b6f3175feb ("perf:
build: Setup PKG_CONFIG_LIBDIR for cross compilation") in the Linux Kernel it is needed to add PKG_CONFIG_LIBDIR in the make flags to avoid warnings from the Kernel, such as:

Makefile.perf:207: Missing PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH and PKG_CONFIG_SYSROOT_DIR for cross compilation,
Makefile.perf:208: set PKG_CONFIG_LIBDIR for using Multiarch libs.

---
 package/linux-tools/linux-tool-perf.mk.in | 1 +
 1 file changed, 1 insertion(+)
package/linux-tools/linux-tool-perf.mk.in +1 -0
index d67318571a..1526652ce4 100644
@@ -20,6 +20,7 @@ endif
 
 PERF_MAKE_FLAGS = \
 	$(LINUX_MAKE_FLAGS) \
+	PKG_CONFIG_LIBDIR=$(HOST_DIR)/lib/pkgconfig:$(HOST_DIR)/share/pkgconfig \
 	JOBS=$(PARALLEL_JOBS) \
 	ARCH=$(PERF_ARCH) \
 	DESTDIR=$(TARGET_DIR) \
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Vasileios,

Quoted 5 lines · On Fri, 4 Apr 2025 00:44:17 +0200 Vasileios Amoiridis…

After commit 440cf77625e300e683ca0edc39fbc4b6f3175feb ("perf:
build: Setup PKG_CONFIG_LIBDIR for cross compilation") in the Linux Kernel it is needed to add PKG_CONFIG_LIBDIR in the make flags to avoid warnings from the Kernel, such as:

Quoted 7 lines

Makefile.perf:207: Missing PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH and PKG_CONFIG_SYSROOT_DIR for cross compilation,
Makefile.perf:208: set PKG_CONFIG_LIBDIR for using Multiarch libs.

Thanks for the patch!

package/linux-tools/linux-tool-perf.mk.in endif · line 23

Quoted 9 lines
package/linux-tools/linux-tool-perf.mk.in +1 -0
index d67318571a..1526652ce4 100644
@@ -20,6 +20,7 @@ endif
 
 PERF_MAKE_FLAGS = \
 	$(LINUX_MAKE_FLAGS) \
+	PKG_CONFIG_LIBDIR=$(HOST_DIR)/lib/pkgconfig:$(HOST_DIR)/share/pkgconfig \

However, this value is incorrect I believe.

Indeed, linux-tool-perf.mk.in is cross-compiling perf for the target, so pkg-config should look for cross-compiled libraries... and here you're pointing to natively compiled libraries installed in $(HOST_DIR), so this is not correct.

I'm not sure what the correct fix is, as PKG_CONFIG_LIBDIR is passed internally in our pkg-config wrapper, it's really just the kernel Makefile being over-zealous here. Maybe we could play with the kernel accepting a $(CROSS_COMPILE)pkg-config, and have such a script in a private directory, added in the PATH when building perf? Another option is to define PKG_CONFIG_LIBDIR, replicating what our pkg-config uses as a value.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
Quoted 26 lines · Thomas Petazzoni

Hello Vasileios,

Quoted 5 lines · On Fri, 4 Apr 2025 00:44:17 +0200 Vasileios Amoiridis…

After commit 440cf77625e300e683ca0edc39fbc4b6f3175feb ("perf:
build: Setup PKG_CONFIG_LIBDIR for cross compilation") in the Linux Kernel it is needed to add PKG_CONFIG_LIBDIR in the make flags to avoid warnings from the Kernel, such as:

Quoted 7 lines

Makefile.perf:207: Missing PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH and PKG_CONFIG_SYSROOT_DIR for cross compilation,
Makefile.perf:208: set PKG_CONFIG_LIBDIR for using Multiarch libs.

Thanks for the patch!

Quoted 6 lines
package/linux-tools/linux-tool-perf.mk.in +0 -0
index d67318571a..1526652ce4 100644
@@ -20,6 +20,7 @@ endif
 
Quoted 6 lines

package/linux-tools/linux-tool-perf.mk.in endif · line 23

Quoted 3 lines
package/linux-tools/linux-tool-perf.mk.in +1 -0
 PERF_MAKE_FLAGS = \
 	$(LINUX_MAKE_FLAGS) \
+	PKG_CONFIG_LIBDIR=$(HOST_DIR)/lib/pkgconfig:$(HOST_DIR)/share/pkgconfig \

However, this value is incorrect I believe.

Hi Thomas,

Thanks for the reply and you are right here, I totally missed it.

Quoted 5 lines

Indeed, linux-tool-perf.mk.in is cross-compiling perf for the target, so pkg-config should look for cross-compiled libraries... and here you're pointing to natively compiled libraries installed in $(HOST_DIR), so this is not correct.

Quoted 8 lines

I'm not sure what the correct fix is, as PKG_CONFIG_LIBDIR is passed internally in our pkg-config wrapper, it's really just the kernel Makefile being over-zealous here. Maybe we could play with the kernel accepting a $(CROSS_COMPILE)pkg-config, and have such a script in a private directory, added in the PATH when building perf? Another option is to define PKG_CONFIG_LIBDIR, replicating what our pkg-config uses as a value.

Solution no.2 which is about re-defining the PKG_CONFIG_LIBDIR as we do in the pkg-config could solve this "issue" but I would like to see if there is a better way than replicating.

Solution no.1 though I feel a bit confused with what you mean. What I understand from the $(CROSS_COMPILE)pkg-config is that we should put into the PATH the $(CROSS_COMPILE)pkg-config binary. What do you mean exactly by script?

Cheers,
Vasilis

Quoted 5 lines

Thomas

Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot