2022-05-16 18:29:08

by Antonio Terceiro

[permalink] [raw]
Subject: [PATCH] kselftest: alsa: handle cross compilation

Calling just `pkg-config` is adequate for native builds, but finding the
foreign libraries with pkg-config needs pkg-config to be called via its
architecture-specific wrapper. This works in Debian, where there is a
corresponding *-pkg-config wrapper script for each enabled foreign
architecture, just like there are *-gcc, *-ld.

Signed-off-by: Antonio Terceiro <[email protected]>
---
tools/testing/selftests/alsa/Makefile | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/alsa/Makefile b/tools/testing/selftests/alsa/Makefile
index f64d9090426d..f5675b3c929d 100644
--- a/tools/testing/selftests/alsa/Makefile
+++ b/tools/testing/selftests/alsa/Makefile
@@ -1,8 +1,10 @@
# SPDX-License-Identifier: GPL-2.0
#

-CFLAGS += $(shell pkg-config --cflags alsa)
-LDLIBS += $(shell pkg-config --libs alsa)
+PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
+
+CFLAGS += $(shell $(PKG_CONFIG) --cflags alsa)
+LDLIBS += $(shell $(PKG_CONFIG) --libs alsa)

TEST_GEN_PROGS := mixer-test

--
2.35.1



2022-05-17 03:40:30

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] kselftest: alsa: handle cross compilation

On Mon, May 16, 2022 at 01:58:56PM -0300, Antonio Terceiro wrote:
> Calling just `pkg-config` is adequate for native builds, but finding the
> foreign libraries with pkg-config needs pkg-config to be called via its
> architecture-specific wrapper. This works in Debian, where there is a
> corresponding *-pkg-config wrapper script for each enabled foreign
> architecture, just like there are *-gcc, *-ld.

Why does this only apply to the ALSA selftests? There's a bunch of
kselftests that use unadorned pkg-config calls.


Attachments:
(No filename) (531.00 B)
signature.asc (499.00 B)
Download all attachments