public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Makefile: Fix cross building
@ 2021-04-21  0:19 Patrick Waterlander
  2021-04-21 10:10 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Waterlander @ 2021-04-21  0:19 UTC (permalink / raw)
  To: nathan.d.ciobanu
  Cc: Patrick Waterlander, Masahiro Yamada, Michal Marek, linux-kbuild,
	linux-kernel

The native pkg-config is always called which may result in incorrect
flags and paths being passed to the cross compiler. Implement
$(CROSS_COMPILE)pkg-config to avoid this issue.

Signed-off-by: Patrick Waterlander <patrick.waterlander@intel.com>
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index bc19584fee59..9aa2073f68d6 100644
--- a/Makefile
+++ b/Makefile
@@ -462,6 +462,7 @@ LZMA		= lzma
 LZ4		= lz4c
 XZ		= xz
 ZSTD		= zstd
+PKG_CONFIG     ?= $(CROSS_COMPILE)pkg-config
 
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
 		  -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
@@ -1089,7 +1090,7 @@ mod_sign_cmd = true
 endif
 export mod_sign_cmd
 
-HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
+HOST_LIBELF_LIBS = $(shell $(PKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf)
 
 has_libelf = $(call try-run,\
                echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] Makefile: Fix cross building
  2021-04-21  0:19 [PATCH 1/1] Makefile: Fix cross building Patrick Waterlander
@ 2021-04-21 10:10 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2021-04-21 10:10 UTC (permalink / raw)
  To: Patrick Waterlander
  Cc: nathan.d.ciobanu, Michal Marek, Linux Kbuild mailing list,
	Linux Kernel Mailing List

On Wed, Apr 21, 2021 at 9:20 AM Patrick Waterlander
<patrick.waterlander@intel.com> wrote:
>
> The native pkg-config is always called which may result in incorrect
> flags and paths being passed to the cross compiler. Implement
> $(CROSS_COMPILE)pkg-config to avoid this issue.
>
> Signed-off-by: Patrick Waterlander <patrick.waterlander@intel.com>
> ---
>  Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index bc19584fee59..9aa2073f68d6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -462,6 +462,7 @@ LZMA                = lzma
>  LZ4            = lz4c
>  XZ             = xz
>  ZSTD           = zstd
> +PKG_CONFIG     ?= $(CROSS_COMPILE)pkg-config
>
>  CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
>                   -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
> @@ -1089,7 +1090,7 @@ mod_sign_cmd = true
>  endif
>  export mod_sign_cmd
>
> -HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
> +HOST_LIBELF_LIBS = $(shell $(PKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf)


libelf will be linked to host programs.

This is clear from HOST_LIBELF_LIBS.
                   ^^^^

pkg-config should be OK.




>
>  has_libelf = $(call try-run,\
>                 echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
> --
> 2.17.1
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-21 10:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-21  0:19 [PATCH 1/1] Makefile: Fix cross building Patrick Waterlander
2021-04-21 10:10 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox