On Wed, 01 Feb 2023 21:25:25 +0100 Johannes Schauer Marin Rodrigues <josch@xxxxxxxxxxxxxxxx> wrote: > Hi, > > Quoting Steven Rostedt (2023-02-01 20:31:44) > > On Fri, 20 Jan 2023 08:08:09 +0100 > > Johannes Schauer Marin Rodrigues <josch@xxxxxxxxxxxxxxxx> wrote: > > > > > For a successful cross-build, the host-architecture version of > > > pkg-config must be used or otherwise host architecture headers of > > > libtracefs and libtraceevent will not be found. > > > > > > Signed-off-by: Johannes Schauer Marin Rodrigues <josch@xxxxxxxxxxxxxxxx> > > > --- > > > tools/tracing/rtla/Makefile | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile > > > index 22e28b76f800..26ebd46ec29c 100644 > > > --- a/tools/tracing/rtla/Makefile > > > +++ b/tools/tracing/rtla/Makefile > > > @@ -18,7 +18,7 @@ endef > > > $(call allow-override,CC,$(CROSS_COMPILE)gcc) > > > $(call allow-override,AR,$(CROSS_COMPILE)ar) > > > $(call allow-override,STRIP,$(CROSS_COMPILE)strip) > > > -$(call allow-override,PKG_CONFIG,pkg-config) > > > +$(call allow-override,PKG_CONFIG,$(CROSS_COMPILE)pkg-config) > > > $(call allow-override,LD_SO_CONF_PATH,/etc/ld.so.conf.d/) > > > $(call allow-override,LDCONFIG,ldconfig) > > > > > > > I don't usually have pkg-config as part of my cross build path. I have just > > overridden it to use different commands, by defining the variable of > > PKG_CONFIG, but I have not had any issues. But my compiler path never > > included pkg-config. > > I found this problem when cross-compiling the linux Debian package. You can > find a build log (on amd64 for arm64) of how this fails on our Debian > crossbuild QA service: > > https://crossqa.debian.net/build/linux_6.1.7-1_arm64_20230122165920.log > > At the very bottom of that log you can see the following error message: > > ******************************************** > ** NOTICE: Failed build dependencies > ** > ** Required Libraries: > ** libtraceevent version 1.5 or higher > ** libtracefs version 1.3 or higher > ** > ** Consider installing the latest libtracefs from your > ** distribution, e.g., 'dnf install libtraceevent-devel libtracefs-devel' on Fedora, > ** or from source: > ** > ** https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ > ** https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ > ** > ******************************************** > > This error goes away after applying my patch. You can see that the both > libraries do get installed for arm64 at the top of the log. But they are not > found because the wrong pkg-config is used. > So it works for your Debian environment, but my fear is this change may break other environments. As I believe all you need to do is set the pkg-config environment variables, and it will work with the normal path pkg-config. With this change, that method will break if $(CROSS_COMPILE)pkg-config does not exist. I just installed linux-libc-dev-arm64-cross and I don't see pkg-config in it. What package has that? And doing some searches, I see that those that have $(CROSS_COMPILE)pkg-config was just adding a wrapper around the host pkg-config that sets the proper pkg-config environment variables. As I said, this may work for your environment, but it is likely to break others. Just add "PKG_CONFIG=${CROSS_COMPILE}pkg-config" before the "make" command, and it should build properly. -- Steve