build: fix host menu config targets using ncurses
On a recent Gentoo Linux installation, invoking `make menuconfig`, `make
kernel_menuconfig` or `make kernel_nconfig` in the build system fails,
whereas for example `make menuconfig` in the kernel tree alone works as
expected.
This is happening because STAGING_PREFIX is not defined when kernel's
{menu,n}config target calls pkg-config from the toolchain/host and thus
pkg-config returns an empty value, and the fallback values in the kernel
config script are applied but those are off and the linking fails.
Solution is to use system's pkg-config for all ncurses based menu config
targets in order to provide proper compiler/linker flags.
Ref: FS#2423
Cc: Thomas Albers <thomas.gameiro@gmail.com>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
Tested-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
			
			
This commit is contained in:
		
							
								
								
									
										1
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								Makefile
									
									
									
									
									
								
							| @@ -18,6 +18,7 @@ $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt dir | |||||||
|  |  | ||||||
| world: | world: | ||||||
|  |  | ||||||
|  | DISTRO_PKG_CONFIG:=$(shell which -a pkg-config | grep -E '\/usr' | head -n 1) | ||||||
| export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) | export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) | ||||||
|  |  | ||||||
| ifneq ($(OPENWRT_BUILD),1) | ifneq ($(OPENWRT_BUILD),1) | ||||||
|   | |||||||
| @@ -99,13 +99,18 @@ prepare-tmpinfo: FORCE | |||||||
| 		$(_SINGLE)$(NO_TRACE_MAKE) menuconfig $(PREP_MK); \ | 		$(_SINGLE)$(NO_TRACE_MAKE) menuconfig $(PREP_MK); \ | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
|  | ifneq ($(DISTRO_PKG_CONFIG),) | ||||||
|  | scripts/config/mconf: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH) | ||||||
|  | endif | ||||||
| scripts/config/mconf: | scripts/config/mconf: | ||||||
| 	@$(_SINGLE)$(SUBMAKE) -s -C scripts/config all CC="$(HOSTCC_WRAPPER)" | 	@$(_SINGLE)$(SUBMAKE) -s -C scripts/config all CC="$(HOSTCC_WRAPPER)" | ||||||
|  |  | ||||||
| $(eval $(call rdep,scripts/config,scripts/config/mconf)) | $(eval $(call rdep,scripts/config,scripts/config/mconf)) | ||||||
|  |  | ||||||
| scripts/config/qconf: | scripts/config/qconf: | ||||||
| 	@$(_SINGLE)$(SUBMAKE) -s -C scripts/config qconf CC="$(HOSTCC_WRAPPER)" | 	@$(_SINGLE)$(SUBMAKE) -s -C scripts/config qconf \ | ||||||
|  | 		CC="$(HOSTCC_WRAPPER)" \ | ||||||
|  | 		DISTRO-PKG-CONFIG="$(DISTRO_PKG_CONFIG)" | ||||||
|  |  | ||||||
| scripts/config/conf: | scripts/config/conf: | ||||||
| 	@$(_SINGLE)$(SUBMAKE) -s -C scripts/config conf CC="$(HOSTCC_WRAPPER)" | 	@$(_SINGLE)$(SUBMAKE) -s -C scripts/config conf CC="$(HOSTCC_WRAPPER)" | ||||||
| @@ -157,6 +162,10 @@ endif | |||||||
| kernel_oldconfig: prepare_kernel_conf | kernel_oldconfig: prepare_kernel_conf | ||||||
| 	$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux oldconfig | 	$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux oldconfig | ||||||
|  |  | ||||||
|  | ifneq ($(DISTRO_PKG_CONFIG),) | ||||||
|  | kernel_menuconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH) | ||||||
|  | kernel_nconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH) | ||||||
|  | endif | ||||||
| kernel_menuconfig: prepare_kernel_conf | kernel_menuconfig: prepare_kernel_conf | ||||||
| 	$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux menuconfig | 	$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux menuconfig | ||||||
|  |  | ||||||
|   | |||||||
| @@ -20,8 +20,6 @@ check_lxdialog = $(shell $(SHELL) $(CURDIR)/lxdialog/check-lxdialog.sh -$(1)) | |||||||
| export CFLAGS += -DKBUILD_NO_NLS -I. $(call check_lxdialog,ccflags) | export CFLAGS += -DKBUILD_NO_NLS -I. $(call check_lxdialog,ccflags) | ||||||
| export CXXFLAGS += -DKBUILD_NO_NLS | export CXXFLAGS += -DKBUILD_NO_NLS | ||||||
|  |  | ||||||
| DISTRO-PKG-CONFIG := $(shell which -a pkg-config | grep -E '\/usr' | head -n 1) |  | ||||||
|  |  | ||||||
| conf-objs	:= conf.o zconf.tab.o | conf-objs	:= conf.o zconf.tab.o | ||||||
| mconf-objs	:= mconf.o zconf.tab.o | mconf-objs	:= mconf.o zconf.tab.o | ||||||
| qconf-cxxobjs	:= qconf.o | qconf-cxxobjs	:= qconf.o | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Petr Štetiar
					Petr Štetiar