[Toybox] [PATCH] Support HOSTCFLAGS on musl

orc orc at sibserver.ru
Tue Jun 19 00:41:52 PDT 2012


On Mon, 18 Jun 2012 11:23:10 -0500
Rob Landley <rob at landley.net> wrote:

> On 06/14/2012 03:50 AM, orc wrote:
> > On Thu, 14 Jun 2012 11:52:00 +1000
> > David Seikel <onefang at gmail.com> wrote:
> > 
> >> On Thu, 14 Jun 2012 01:30:33 +0800 orc <orc at sibserver.ru> wrote:
> >>
> >>> On Wed, 13 Jun 2012 11:59:23 -0500
> >>> Rob Landley <rob at landley.net> wrote:
> >>>
> >>>> On 06/13/2012 10:02 AM, orc wrote:
> >>>>> Sorry for corrupted email. I've attached original patch here.
> >>>>
> >>>> Could you give me a name for the commit message, please? (I like
> >>>> to attribute patches properly.)
> >>>>
> >>>> Thanks,
> >>>>
> >>>> Rob
> >>>>
> >>>
> >>> Support kconfig HOSTCFLAGS
> >>>
> >>> Support HOSTCFLAGS environment variable for building kconfig on
> >>> musl system (HOSTCFLAGS=-D_GNU_SOURCE)
> >>
> >> Rob asked for your name for the commit message, not the commit
> >> message.  So that he can say who made the patch.
> >>
> > 
> > I am sorry, I misunderstand that. Just 'orc'.
> 
> Sorry for the delay, the weekend got away from me.
> 
> I noticed I already have a "CCFLAGS" (from 2007) being applied to
> $HOSTCC for building install.c in both Makefile and
> scripts/install.sh. It's not being used for the HOSTCC invocations in
> kconfig, and it seems to me that means I'm doing it wrong.
> 
> Is this a reasonable equivalent to your patch?
> 
> --- a/configure	Sat Jun 16 15:16:08 2012 -0500
> +++ b/configure	Mon Jun 18 11:16:01 2012 -0500
> @@ -11,3 +11,4 @@
>  [ -z "$CC" ] && CC=cc
>  [ -z "$STRIP" ] && STRIP=strip
>  [ -z "$HOSTCC" ] && HOSTCC=gcc
> +HOSTCC="$HOSTCC $HOSTCFLAGS"

Seems no,

cc -o kconfig/mconf kconfig/mconf.c kconfig/zconf.tab.c \
		kconfig/lxdialog/*.c -lcurses
-DCURSES_LOC="<ncurses.h>" \ -DKBUILD_NO_NLS=1 -DPROJECT_NAME=\"ToyBox\"
kconfig/mconf.c:274: error: 'PATH_MAX' undeclared here (not in a
function)
...

setting HOSTCC works, but HOSTCFLAGS still not passed to $CC, results
in above when doing 'make menuconfig HOSTCFLAGS=-D_GNU_SOURCE'.

> 
> (And then ripping out the old CCFLAGS stuff which apparently never got
> documented.)
> 
> It seems easiest to just add the flags straight into the one variable
> since it gets expanded and reparsed for whitespace by the existing
> scripts. (Admittedly that means if you have path to hostcc with a
> space in it, it won't work, but that's already the case and nobody's
> complained...)

But scripts are not called before cc called. make -n menuconfig shows
on top of clean toybox-0.3.0:

ln -s zconf.tab.c_shipped kconfig/zconf.tab.c
ln -s lex.zconf.c_shipped kconfig/lex.zconf.c
ln -s zconf.hash.c_shipped kconfig/zconf.hash.c
cc -o kconfig/mconf kconfig/mconf.c kconfig/zconf.tab.c \
		kconfig/lxdialog/*.c -lcurses
-DCURSES_LOC="<ncurses.h>" \ -DKBUILD_NO_NLS=1 -DPROJECT_NAME=\"ToyBox\"
scripts/genconfig.sh
kconfig/mconf Config.in

And because of that I patched kconfig/Makefile directly, for setting
HOSTCFLAGS at the menuconfig stage, without HOSTCFLAGS it fails due to
feature test macros on musl.

(There already was a mail about that and you answered 'Seems
reasonable.', that one I've sent with attachment was the result of
corrupted patch pasted into message. Are we talking about 'make
menuconfig' failure or I missed something?)

> 
> Rob


 1340091712.0


More information about the Toybox mailing list