Message ID | 1420145678-11134-3-git-send-email-bjorn.forsman@gmail.com |
---|---|
State | Superseded |
Headers | show |
Bjørn, All, On 2015-01-01 21:54 +0100, Bjørn Forsman spake thusly: > Buildroot unexports PKG_CONFIG_PATH in the top-level Makefile for purity > reasons. But it has an unfortunate side-effect in that "make menuconfig" > will not (necessarily) be able to pick up ncurses via host pkg-config, > breaking "make menuconfig" on systems where ncurses is installed in a > non-standard location. > > This patch saves the original PKG_CONFIG_PATH variable in > HOST_PKG_CONFIG_PATH and restores the original PKG_CONFIG_PATH variable > only in the sub-processes that builds the various menuconfig/nconfig/... > targets. > > With this change, I am able to run "make menuconfig" on NixOS[1]. > > [1]: http://nixos.org/ > > Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com> > --- > Makefile | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index 5e0b4f2..2f1108f 100644 > --- a/Makefile > +++ b/Makefile > @@ -264,6 +264,7 @@ export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD > export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE > > # Make sure pkg-config doesn't look outside the buildroot tree > +export HOST_PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) I think you'd want to do an immediate assignment here, and not do an export (see below): HOST_PKG_CONFIG_PATH:=$(PKG_CONFIG_PATH) > unexport PKG_CONFIG_PATH > unexport PKG_CONFIG_SYSROOT_DIR > unexport PKG_CONFIG_LIBDIR > @@ -692,7 +693,10 @@ export HOSTCFLAGS > > $(BUILD_DIR)/buildroot-config/%onf: > mkdir -p $(@D)/lxdialog > - $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) > + (export PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH); \ > + $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \ > + obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) \ > + ) Well, you do not need this convoluted sub-shell. Just pass the variable as a make option: $(MAKE) PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) Thus, you do not need to export HOST_PKG_CONFIG_PATH (see above). Regards, Yann E. MORIN. > > DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG)) > > -- > 2.1.3 > > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot
Hi Yann, Thanks for the feedback. Comments below. On 2 January 2015 at 17:16, Yann E. MORIN <yann.morin.1998@free.fr> wrote: > Bjørn, All, > > On 2015-01-01 21:54 +0100, Bjørn Forsman spake thusly: >> Buildroot unexports PKG_CONFIG_PATH in the top-level Makefile for purity >> reasons. But it has an unfortunate side-effect in that "make menuconfig" >> will not (necessarily) be able to pick up ncurses via host pkg-config, >> breaking "make menuconfig" on systems where ncurses is installed in a >> non-standard location. >> >> This patch saves the original PKG_CONFIG_PATH variable in >> HOST_PKG_CONFIG_PATH and restores the original PKG_CONFIG_PATH variable >> only in the sub-processes that builds the various menuconfig/nconfig/... >> targets. >> >> With this change, I am able to run "make menuconfig" on NixOS[1]. >> >> [1]: http://nixos.org/ >> >> Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com> >> --- >> Makefile | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/Makefile b/Makefile >> index 5e0b4f2..2f1108f 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -264,6 +264,7 @@ export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD >> export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE >> >> # Make sure pkg-config doesn't look outside the buildroot tree >> +export HOST_PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) > > I think you'd want to do an immediate assignment here, and not do an > export (see below): > > HOST_PKG_CONFIG_PATH:=$(PKG_CONFIG_PATH) Will fix. >> unexport PKG_CONFIG_PATH >> unexport PKG_CONFIG_SYSROOT_DIR >> unexport PKG_CONFIG_LIBDIR >> @@ -692,7 +693,10 @@ export HOSTCFLAGS >> >> $(BUILD_DIR)/buildroot-config/%onf: >> mkdir -p $(@D)/lxdialog >> - $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) >> + (export PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH); \ >> + $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \ >> + obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) \ >> + ) > > Well, you do not need this convoluted sub-shell. Just pass the variable > as a make option: > > $(MAKE) PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) I tested that. It doesn't work. I guess when the variable is given on the command line to make (not 'exported') it is not available to sub-processes that make spawns. - Bjørn
On 2 January 2015 at 22:28, Bjørn Forsman <bjorn.forsman@gmail.com> wrote: > Hi Yann, > > Thanks for the feedback. Comments below. > > On 2 January 2015 at 17:16, Yann E. MORIN <yann.morin.1998@free.fr> wrote: >> Bjørn, All, >> >> On 2015-01-01 21:54 +0100, Bjørn Forsman spake thusly: >>> Buildroot unexports PKG_CONFIG_PATH in the top-level Makefile for purity >>> reasons. But it has an unfortunate side-effect in that "make menuconfig" >>> will not (necessarily) be able to pick up ncurses via host pkg-config, >>> breaking "make menuconfig" on systems where ncurses is installed in a >>> non-standard location. >>> >>> This patch saves the original PKG_CONFIG_PATH variable in >>> HOST_PKG_CONFIG_PATH and restores the original PKG_CONFIG_PATH variable >>> only in the sub-processes that builds the various menuconfig/nconfig/... >>> targets. >>> >>> With this change, I am able to run "make menuconfig" on NixOS[1]. >>> >>> [1]: http://nixos.org/ >>> >>> Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com> >>> --- >>> Makefile | 6 +++++- >>> 1 file changed, 5 insertions(+), 1 deletion(-) >>> >>> diff --git a/Makefile b/Makefile >>> index 5e0b4f2..2f1108f 100644 >>> --- a/Makefile >>> +++ b/Makefile >>> @@ -264,6 +264,7 @@ export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD >>> export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE >>> >>> # Make sure pkg-config doesn't look outside the buildroot tree >>> +export HOST_PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) >> >> I think you'd want to do an immediate assignment here, and not do an >> export (see below): >> >> HOST_PKG_CONFIG_PATH:=$(PKG_CONFIG_PATH) > > Will fix. Some comments. There are other HOST_* variables that are exported from the top-level Makefile. I guess that's why I used 'export' in the first place. For now, nobody but Buildroot itself uses HOST_PKG_CONFIG_PATH (well, when this patch gets in), but I can see a future where pkg-config is used within Buildroot for other host packages too. But it is of course trivial to add the "export" at any time :-) - Bjørn
Bjørn, All, On 2015-01-02 22:28 +0100, Bjørn Forsman spake thusly: > On 2 January 2015 at 17:16, Yann E. MORIN <yann.morin.1998@free.fr> wrote: > > On 2015-01-01 21:54 +0100, Bjørn Forsman spake thusly: > >> Buildroot unexports PKG_CONFIG_PATH in the top-level Makefile for purity > >> reasons. But it has an unfortunate side-effect in that "make menuconfig" > >> will not (necessarily) be able to pick up ncurses via host pkg-config, > >> breaking "make menuconfig" on systems where ncurses is installed in a > >> non-standard location. [--SNIP--] > >> @@ -692,7 +693,10 @@ export HOSTCFLAGS > >> > >> $(BUILD_DIR)/buildroot-config/%onf: > >> mkdir -p $(@D)/lxdialog > >> - $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) > >> + (export PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH); \ > >> + $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \ > >> + obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) \ > >> + ) > > > > Well, you do not need this convoluted sub-shell. Just pass the variable > > as a make option: > > > > $(MAKE) PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) > > I tested that. It doesn't work. I guess when the variable is given on > the command line to make (not 'exported') it is not available to > sub-processes that make spawns. In that case, just put it in front of it, like: PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH) $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) This will put PKG_CONFIG_PATH in the environment just for the duration of the sub-make. Regards, Yann E. MORIN.
Bjørn, All, On 2015-01-02 22:34 +0100, Bjørn Forsman spake thusly: > On 2 January 2015 at 22:28, Bjørn Forsman <bjorn.forsman@gmail.com> wrote: > > On 2 January 2015 at 17:16, Yann E. MORIN <yann.morin.1998@free.fr> wrote: > >> Bjørn, All, > >> > >> On 2015-01-01 21:54 +0100, Bjørn Forsman spake thusly: > >>> Buildroot unexports PKG_CONFIG_PATH in the top-level Makefile for purity > >>> reasons. But it has an unfortunate side-effect in that "make menuconfig" > >>> will not (necessarily) be able to pick up ncurses via host pkg-config, > >>> breaking "make menuconfig" on systems where ncurses is installed in a > >>> non-standard location. > >>> > >>> This patch saves the original PKG_CONFIG_PATH variable in > >>> HOST_PKG_CONFIG_PATH and restores the original PKG_CONFIG_PATH variable > >>> only in the sub-processes that builds the various menuconfig/nconfig/... > >>> targets. > >>> > >>> With this change, I am able to run "make menuconfig" on NixOS[1]. > >>> > >>> [1]: http://nixos.org/ > >>> > >>> Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com> > >>> --- > >>> Makefile | 6 +++++- > >>> 1 file changed, 5 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/Makefile b/Makefile > >>> index 5e0b4f2..2f1108f 100644 > >>> --- a/Makefile > >>> +++ b/Makefile > >>> @@ -264,6 +264,7 @@ export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD > >>> export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE > >>> > >>> # Make sure pkg-config doesn't look outside the buildroot tree > >>> +export HOST_PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) > >> > >> I think you'd want to do an immediate assignment here, and not do an > >> export (see below): > >> > >> HOST_PKG_CONFIG_PATH:=$(PKG_CONFIG_PATH) > > > > Will fix. > > Some comments. There are other HOST_* variables that are exported from > the top-level Makefile. I guess that's why I used 'export' in the > first place. You're right. I believe export is not needed, but for consistency sake, I understand you would want to use export on it. Do with an export if you want, I won't complain much. ;-) But state in the commit log that it is not strictly required for the current use-case, and is here just for consistency with other similarly-named variables. > For now, nobody but Buildroot itself uses > HOST_PKG_CONFIG_PATH (well, when this patch gets in), but I can see a > future where pkg-config is used within Buildroot for other host > packages too. But it is of course trivial to add the "export" at any > time :-) Hey! :-) Thanks! Regards, Yann E. MORIN.
On 2 January 2015 at 22:39, Yann E. MORIN <yann.morin.1998@free.fr> wrote: > Bjørn, All, > > On 2015-01-02 22:28 +0100, Bjørn Forsman spake thusly: >> On 2 January 2015 at 17:16, Yann E. MORIN <yann.morin.1998@free.fr> wrote: >> > On 2015-01-01 21:54 +0100, Bjørn Forsman spake thusly: >> >> Buildroot unexports PKG_CONFIG_PATH in the top-level Makefile for purity >> >> reasons. But it has an unfortunate side-effect in that "make menuconfig" >> >> will not (necessarily) be able to pick up ncurses via host pkg-config, >> >> breaking "make menuconfig" on systems where ncurses is installed in a >> >> non-standard location. > [--SNIP--] >> >> @@ -692,7 +693,10 @@ export HOSTCFLAGS >> >> >> >> $(BUILD_DIR)/buildroot-config/%onf: >> >> mkdir -p $(@D)/lxdialog >> >> - $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) >> >> + (export PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH); \ >> >> + $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \ >> >> + obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) \ >> >> + ) >> > >> > Well, you do not need this convoluted sub-shell. Just pass the variable >> > as a make option: >> > >> > $(MAKE) PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) >> >> I tested that. It doesn't work. I guess when the variable is given on >> the command line to make (not 'exported') it is not available to >> sub-processes that make spawns. > > In that case, just put it in front of it, like: > > PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH) $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) > > This will put PKG_CONFIG_PATH in the environment just for the duration > of the sub-make. Ah, good point. That works and looks cleaner. Will update. - Bjørn
diff --git a/Makefile b/Makefile index 5e0b4f2..2f1108f 100644 --- a/Makefile +++ b/Makefile @@ -264,6 +264,7 @@ export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE # Make sure pkg-config doesn't look outside the buildroot tree +export HOST_PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) unexport PKG_CONFIG_PATH unexport PKG_CONFIG_SYSROOT_DIR unexport PKG_CONFIG_LIBDIR @@ -692,7 +693,10 @@ export HOSTCFLAGS $(BUILD_DIR)/buildroot-config/%onf: mkdir -p $(@D)/lxdialog - $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) + (export PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH); \ + $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \ + obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) \ + ) DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG))
Buildroot unexports PKG_CONFIG_PATH in the top-level Makefile for purity reasons. But it has an unfortunate side-effect in that "make menuconfig" will not (necessarily) be able to pick up ncurses via host pkg-config, breaking "make menuconfig" on systems where ncurses is installed in a non-standard location. This patch saves the original PKG_CONFIG_PATH variable in HOST_PKG_CONFIG_PATH and restores the original PKG_CONFIG_PATH variable only in the sub-processes that builds the various menuconfig/nconfig/... targets. With this change, I am able to run "make menuconfig" on NixOS[1]. [1]: http://nixos.org/ Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com> --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)