Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] infra/pkg-kconfig: build host-ccache before kconfig
Date: Thu, 19 Jul 2018 13:01:47 +0200	[thread overview]
Message-ID: <20180719130147.669f214d@windsurf> (raw)
In-Reply-To: <20180719094658.26826-1-zhaizhaoxuan@xiaomi.com>

Hello,

On Thu, 19 Jul 2018 09:47:09 +0000, ??? wrote:
> When the ccache is enabled, the HOSTCC variable refers to the ccache binary.
> 
> But the host-ccache is not a dependency of the kconfig's .config. Some targets
> such as `busybox-menuconfig` may calls Kconfig before the host-ccache is ready.
> If the host-ccache is not ready yet, the Kconfig will fail. Because it can not
> use $HOSTCC to build its utilities without ccache.
> 
> This issue can be reproduce with the following commands:
>  1. make clean defconfig
>  2. echo "BR2_CCACHE=y" >> .config
>  3. make olddefconfig busybox-menuconfig
> 
> This patch fixes this issue by add host-ccache to the dependencies of .config.
> So that the Kconfig can use $HOSTCC.
> 
> Signed-off-by: Zhai Zhaoxuan <zhaizhaoxuan@xiaomi.com>

Thanks for this contribution! However, I have not been able to
reproduce the problem with the steps you describe. Here is what happens
here:

thomas at windsurf:~/projets/buildroot (master)$ make clean defconfig
rm -rf /home/thomas/projets/buildroot/output/target /home/thomas/projets/buildroot/output/images /home/thomas/projets/buildroot/output/host  \
	/home/thomas/projets/buildroot/output/build /home/thomas/projets/buildroot/output/staging \
	/home/thomas/projets/buildroot/output/legal-info /home/thomas/projets/buildroot/output/graphs
mkdir -p /home/thomas/projets/buildroot/output/build/buildroot-config/lxdialog
PKG_CONFIG_PATH="" make CC="/usr/bin/gcc" HOSTCC="/usr/bin/gcc" \
    obj=/home/thomas/projets/buildroot/output/build/buildroot-config -C support/kconfig -f Makefile.br conf
/usr/bin/gcc -D_GNU_SOURCE -D_DEFAULT_SOURCE  -DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE  -I/home/thomas/projets/buildroot/output/build/buildroot-config -DCONFIG_=\"\"  -MM *.c > /home/thomas/projets/buildroot/output/build/buildroot-config/.depend 2>/dev/null || :
/usr/bin/gcc -D_GNU_SOURCE -D_DEFAULT_SOURCE  -DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE  -I/home/thomas/projets/buildroot/output/build/buildroot-config -DCONFIG_=\"\"   -c conf.c -o /home/thomas/projets/buildroot/output/build/buildroot-config/conf.o
/usr/bin/gcc -D_GNU_SOURCE -D_DEFAULT_SOURCE  -DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE  -I/home/thomas/projets/buildroot/output/build/buildroot-config -DCONFIG_=\"\"  -I. -c /home/thomas/projets/buildroot/output/build/buildroot-config/zconf.tab.c -o /home/thomas/projets/buildroot/output/build/buildroot-config/zconf.tab.o
/usr/bin/gcc -D_GNU_SOURCE -D_DEFAULT_SOURCE  -DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE  -I/home/thomas/projets/buildroot/output/build/buildroot-config -DCONFIG_=\"\"   /home/thomas/projets/buildroot/output/build/buildroot-config/conf.o /home/thomas/projets/buildroot/output/build/buildroot-config/zconf.tab.o  -o /home/thomas/projets/buildroot/output/build/buildroot-config/conf
rm /home/thomas/projets/buildroot/output/build/buildroot-config/zconf.tab.c
#
# configuration written to /home/thomas/projets/buildroot/.config
#
thomas at windsurf:~/projets/buildroot (master)$ echo "BR2_CCACHE=y" >> .config
thomas at windsurf:~/projets/buildroot (master)$ make olddefconfig busybox-menuconfig
/home/thomas/projets/buildroot/.config:3912:warning: override: reassigning to symbol BR2_CCACHE
#
# configuration written to /home/thomas/projets/buildroot/.config
#
make[1]: *** No rule to make target 'busybox-menuconfig'.  Stop.
make: *** [Makefile:79: _all] Error 2

I also tried manually a configuration with BR2_CCACHE enabled and
busybox enabled, and "make busybox-menuconfig" worked just fine,
without host-ccache being built.

> diff --git a/package/pkg-kconfig.mk b/package/pkg-kconfig.mk
> index 81bba5220c..44bcda4cd2 100644
> --- a/package/pkg-kconfig.mk
> +++ b/package/pkg-kconfig.mk
> @@ -54,6 +54,10 @@ $(2)_KCONFIG_FIXUP_CMDS ?=
>  $(2)_KCONFIG_FRAGMENT_FILES ?=
>  $(2)_KCONFIG_DOTCONFIG ?= .config
>  
> +ifeq ($(BR2_CCACHE),y)
> +$(2)_KCONFIG_DEPENDENCIES += host-ccache
> +endif

I *think* what we will want instead is to use HOSTCC_NOCCACHE to build
the kconfig utilities.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2018-07-19 11:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-19  9:47 [Buildroot] [PATCH] infra/pkg-kconfig: build host-ccache before kconfig 翟召轩
2018-07-19 11:01 ` Thomas Petazzoni [this message]
2018-07-19 12:18   ` 翟召轩

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=20180719130147.669f214d@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /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