[OpenWrt-Devel] kernel-build: fix kernel_menuconfig breakage by forcing YACC
diff mbox series

Message ID 20191111205558.2403-1-ynezz@true.cz
State Accepted
Delegated to: Petr Štetiar
Headers show
Series
  • [OpenWrt-Devel] kernel-build: fix kernel_menuconfig breakage by forcing YACC
Related show

Commit Message

Petr Štetiar Nov. 11, 2019, 8:55 p.m. UTC
Commit 965f341aa9fd ("build: fix host menu config targets using
ncurses") has moved host's path with pkg-config (usually /usr/bin) at
the first place in PATH variable, which is now causing issues with bison
as BISON_PKGDATADIR points into STAGING_DIR_HOST, but the actual bison
used is the one under host PATH (usually /usr/bin/bison), leading to the
following strange failures:

 $ make target/linux/clean kernel_menuconfig V=sc

 export MAKEFLAGS= ;make -C /somewhere/linux-4.19.81 menuconfig
 make -f ./scripts/Makefile.build obj=scripts/kconfig menuconfig
  ...
  bison -oscripts/kconfig/zconf.tab.c -t -l scripts/kconfig/zconf.y
  staging_dir/host/bin/m4: cannot open `staging_dir/host/share/bison/bison.m4': No such file or directory
  staging_dir/host/bin/m4: cannot open `staging_dir/host/share/bison/c-skel.m4': No such file or directory
  ...
  gcc -Wp,-MD,scripts/kconfig/.zconf.tab.o.d <...snip...> -o scripts/kconfig/zconf.tab.o scripts/kconfig/zconf.tab.c
  gcc: error: scripts/kconfig/zconf.tab.c: No such file or directory
  gcc: fatal error: no input files

Fix this by forcing usage of bison under STAGING_DIR_HOST/bin via YACC
make variable.

Cc: Thomas Albers <thomas.gameiro@gmail.com>
Cc: Stijn Tintel <stijn@linux-ipv6.be>
Cc: Eneas U de Queiroz <cotequeiroz@gmail.com>
Ref: https://forum.openwrt.org/t/bpi-r64-kernel-4-19-kernel-menuconfig-error
Fixes: 965f341aa9fd ("build: fix host menu config targets using ncurses")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 include/kernel-build.mk | 1 +
 1 file changed, 1 insertion(+)

Comments

René van Dorst via openwrt-devel Nov. 12, 2019, 6:02 a.m. UTC | #1
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.
Hello!

Since the purpose of the previous patch is to use host pkg-config
instead of toolchain pkg-config, wouldn't the more correct be to also
use host bison?

The current patch
> +               YACC=$(STAGING_DIR_HOST)/bin/bison \
uses toolchain bison to be consistent with the definition of
BISON_PKGDATADIR but that may have the logic backwards.

Thomas
Petr Štetiar Nov. 12, 2019, 7:43 a.m. UTC | #2
Thomas Albers <thomas.gameiro@googlemail.com> [2019-11-12 00:02:37]:

Hi,

> Since the purpose of the previous patch is to use host pkg-config
> instead of toolchain pkg-config, wouldn't the more correct be to also
> use host bison?

as you can see, relying on anything from the host is very fragile, but in this
limited kernel_menuconfig scope it is probably acceptable trade-off in
comparison to building of ncurses for the host. As we build bison, I think,
that it makes more sense to use that known version instead.

-- ynezz
René van Dorst via openwrt-devel Nov. 12, 2019, 6:42 p.m. UTC | #3
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.
On Mon, 11 Nov 2019 at 14:56, Petr Štetiar <ynezz@true.cz> wrote:
> Commit 965f341aa9fd ("build: fix host menu config targets using
> ncurses") has moved host's path with pkg-config (usually /usr/bin) at
> the first place in PATH variable, which is now causing issues with bison
> as BISON_PKGDATADIR points into STAGING_DIR_HOST, but the actual bison
> used is the one under host PATH

This fixes "make kernel_menuconfig" for 4.19 kernels.

Tested-by: Thomas Albers <thomas.gameiro@googlemail.com>

Patch
diff mbox series

diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index 3fdf7efc5285..684fbd34d3c0 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -163,6 +163,7 @@  define BuildKernel
 	$(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config
 	$(_SINGLE)$(KERNEL_MAKE) \
 		$(if $(findstring Darwin,$(HOST_OS)),HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib -lncurses") \
+		YACC=$(STAGING_DIR_HOST)/bin/bison \
 		$$@
 	$(LINUX_RECONF_DIFF) $(LINUX_DIR)/.config > $(LINUX_RECONFIG_TARGET)