[Toybox] [PATCH] Support HOSTCFLAGS on musl
orc
orc at sibserver.ru
Wed Jun 20 22:40:17 PDT 2012
On Wed, 20 Jun 2012 18:56:35 -0500
Rob Landley <rob at landley.net> wrote:
> On 06/19/2012 02:41 AM, orc wrote:
> > 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'.
>
> Ok, with no patch, try:
>
> make distclean
> HOSTCC="cc --static" make defconfig
>
> The --static flag gets applied to the compiler.
Okay, I'm see now that I can apply any CFLAGS :-)
>
> >> (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:
>
> You're right, that's why commit 484 set hostcc if it isn't already
> set. Forgot that.
>
> Eventually when menuconfig gets redone the whole kconfig directory
> goes with it, and the new stuff should actually get built by a script
> like the rest of it. (Makefiles are not my friend.)
>
> > 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?)
>
> Upon further review I noticed that your patch only modified the
> kconfig stuff and not the build for scripts/install.c binary. The
> instlist binary is also built with the host compiler, and already had
> a different variable performing this function. So simply applying
> your patch would have made the code inconsistent.
>
> Your patch added three lines, but upon further review I thought I
> might be able to do it with only one line, and now I suspect i just
> need to add a FAQ entry to add the flags to HOSTCC and not add any
> code to the build scripts at all.
I modified only kconfig, but you can always review and improve/reject
changes. Just did not got that CFLAGS can be set with HOSTCC (many
projects suggest to use CFLAGS). Now the issue with toybox configuring
is solved.
>
> Rob
1340257217.0
More information about the Toybox
mailing list