infra/pkg-kconfig: build host-ccache before kconfig
PATCH 1/1 infra/pkg-kconfig: build host-ccache before kconfig
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.
--- package/pkg-kconfig.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
package/pkg-kconfig.mk +5 -1
@@ -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 + # The config file as well as the fragments could be in-tree, so before # depending on them the package should be extracted (and patched) first. #
@@ -108,7 +112,7 @@ endef # fragments are merged together to .config, after the package has been patched. # Since the file could be a defconfig file it needs to be expanded to a # full .config first. -$$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES) +$$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES) $$($(2)_KCONFIG_DEPENDENCIES) $$(Q)$$(if $$($(2)_KCONFIG_DEFCONFIG), \ $$($(2)_KCONFIG_MAKE) $$($(2)_KCONFIG_DEFCONFIG), \ $$(INSTALL) -m 0644 -D $$($(2)_KCONFIG_FILE) $$(@))
Signature · 1 line
2.18.0
PATCH 1/1 infra/pkg-kconfig: build host-ccache before kconfig
Hello,
Quoted 12 lines · ???
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-menuconfigmay callsKconfigbefore the host-ccache is ready. If the host-ccache is not ready yet, theKconfigwill 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
Quoted 4 lines
This patch fixes this issue by add host-ccache to the dependencies of .config. So that the
Kconfigcan use $HOSTCC.Signed-off-by Zhai Zhaoxuan <[email protected]>
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 2I also tried manually a configuration with BR2_CCACHE enabled and busybox enabled, and "make busybox-menuconfig" worked just fine, without host-ccache being built.
package/pkg-kconfig.mk $(2)_KCONFIG_FIXUP_CMDS ?= · line 59
Quoted 11 lines
package/pkg-kconfig.mk +3
-0@@ -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
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 infra/pkg-kconfig: build host-ccache before kconfig
Hi Thomas,
??? I am so sorry that I sent the incorrect commands.
??? After checking this issue again, I found this issue only appears on
the uclibc and the linux package.
??? I mistakenly thought this was a problem with pkg-kconfig.mk and
modified it. And after that, it works.
??? You can try to reproduce this issue by replacing
"busybox-menuconfig" to "uclibc-menuconfig".
??? Please forgive my mistakes. I will send another patch to fix this
issue by using HOSTCC_NOCCACHE instead.
Quoted 65 lines · On?19/07/2018?19:01?PM,?Thomas Petazzoni?wrote:
Hello,
Quoted 12 lines · ???
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-menuconfigmay callsKconfigbefore the host-ccache is ready. If the host-ccache is not ready yet, theKconfigwill 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-menuconfigQuoted 4 lines
This patch fixes this issue by add host-ccache to the dependencies of .config. So that the
Kconfigcan use $HOSTCC.Signed-off-by Zhai Zhaoxuan <[email protected]>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 2I also tried manually a configuration with
BR2_CCACHEenabled and busybox enabled, and "make busybox-menuconfig" worked just fine, without host-ccache being built.package/pkg-kconfig.mk $(2)_KCONFIG_FIXUP_CMDS ?= · line 59
Quoted 11 lines
package/pkg-kconfig.mk +3
-0@@ -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 +endifI *think* what we will want instead is to use
HOSTCC_NOCCACHEto build the kconfig utilities.
Quoted 3 lines
Best regards,
Thomas
Thanks
------------------
MIOT
Zhai Zhaoxuan