Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
Cc: Heiko Thiery <heiko.thiery@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [Buildroot] [PATCH] configs/kontron_bl_imx8mm_defconfig: fix build failure with u-boot 2022.04
Date: Mon, 15 Aug 2022 12:14:12 +0200	[thread overview]
Message-ID: <20220815121412.3be64939@windsurf> (raw)
In-Reply-To: <20220809100602.2fb39e1c@windsurf>

Hello Heiko,

On Tue, 9 Aug 2022 10:06:02 +0200
Thomas Petazzoni via buildroot <buildroot@buildroot.org> wrote:

> But this is not normal, because:
> 
> UBOOT_MAKE_OPTS += \
>         CROSS_COMPILE="$(TARGET_CROSS)" \
>         ARCH=$(UBOOT_ARCH) \
>         HOSTCC="$(HOSTCC) $(subst -I/,-isystem /,$(subst -I /,-isystem /,$(HOST_CFLAGS)))" \
>         HOSTLDFLAGS="$(HOST_LDFLAGS)" \
>         $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS))
> 
> see we're passing HOSTLDFLAGS here? It contains -L$(HOST_DIR)/lib. So
> it means there is also something wrong in U-Boot in that it doesn't use
> $(HOSTLDFLAGS).

Could you try this change in U-Boot:

diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index 69983a19a44..7624304e3e9 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -89,7 +89,7 @@ hostcxx_flags  = -Wp,-MD,$(depfile) $(__hostcxx_flags)
 # Create executable from a single .c file
 # host-csingle -> Executable
 quiet_cmd_host-csingle         = HOSTCC  $@
-      cmd_host-csingle = $(HOSTCC) $(hostc_flags) -o $@ $< \
+      cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(KBUILD_HOSTLDFLAGS) -o $@ $< \
                $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
 $(host-csingle): $(obj)/%: $(src)/%.c FORCE
        $(call if_changed_dep,host-csingle)

(without your pkg-config patch, of course).

Indeed, scripts/Makefile.host is a copy of the kernel's
scripts/Makefile.host, and the kernel copy does use KBUILD_HOSTLDFLAGS
when building host tools that are based on a single source file, but
for some reason the U-Boot copy does not have it, which doesn't make
much sense.

I think it doesn't mean your pkg-config patch is bogus: it still makes
sense to use pkg-config when possible, but I also think not passing
KBUILD_HOSTLDFLAGS is incorrect.

Of course, if it works, I think both patches should be submitted to
U-Boot upstream.

Could you have a look?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2022-08-15 10:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-07 21:03 [Buildroot] [PATCH] configs/kontron_bl_imx8mm_defconfig: fix build failure with u-boot 2022.04 Heiko Thiery
2022-08-08  8:41 ` Thomas Petazzoni via buildroot
2022-08-09  6:45   ` Heiko Thiery
2022-08-09  8:06     ` Thomas Petazzoni via buildroot
2022-08-15 10:14       ` Thomas Petazzoni via buildroot [this message]
2022-08-23 17:30         ` Heiko Thiery

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220815121412.3be64939@windsurf \
    --to=buildroot@buildroot.org \
    --cc=heiko.thiery@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox