diff mbox

[U-Boot,v2,7/8] Makefile: default to cc for host compiler

Message ID 1406750096-7281-8-git-send-email-jeroen@myspectrum.nl
State Superseded
Delegated to: Albert ARIBAUD
Headers show

Commit Message

Jeroen Hofstee July 30, 2014, 7:54 p.m. UTC
Since the host compiler might not be gcc but e.g. clang
default to cc to invoke it.

cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Masahiro Yamada July 31, 2014, 10:01 a.m. UTC | #1
Hi Jeroen,


On Wed, 30 Jul 2014 21:54:55 +0200
Jeroen Hofstee <jeroen@myspectrum.nl> wrote:

> Since the host compiler might not be gcc but e.g. clang
> default to cc to invoke it.
> 
> cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
> cc: Tom Rini <trini@ti.com>
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 80eb239..c19f7d9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -204,7 +204,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
>  	  else if [ -x /bin/bash ]; then echo /bin/bash; \
>  	  else echo sh; fi ; fi)
>  
> -HOSTCC       = gcc
> +HOSTCC       = cc
>  HOSTCXX      = g++
>  HOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
>  HOSTCXXFLAGS = -O2



For consistency,

HOSTCXX         = c++

?


Kconfig has a C++ host program.
(scripts/kconfig/qconf.cc)



Could you please consider posting this patch to
linux-kbuild ML  because this may be,
I think, acceptable in Linux too.

On systems where both gcc and clang are installed,
we can select gcc or clang
by using update-alternatives (or alternative)
command.





Best Regards
Masahiro Yamada
Albert ARIBAUD Sept. 9, 2014, 2:31 p.m. UTC | #2
Hi Jeroen, Masahiro,

On Thu, 31 Jul 2014 19:01:22 +0900, Masahiro Yamada
<yamada.m@jp.panasonic.com> wrote:

> >  HOSTCXX      = g++
> >  HOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer

> For consistency,
> 
> HOSTCXX         = c++
> 
> ?

So, Jeroen, what is your pick ? Will you send a v3 7/8, or are you
sticking with g++?

(or if everyone agrees, I could to the change to v2 7/8 when applying
it, and add a comment about it in the commit message.)

Amicalement,
Jeroen Hofstee Sept. 9, 2014, 5:34 p.m. UTC | #3
Hello Albert,

On 09-09-14 16:31, Albert ARIBAUD wrote:
> On Thu, 31 Jul 2014 19:01:22 +0900, Masahiro Yamada
> <yamada.m@jp.panasonic.com> wrote:
>
>>>   HOSTCXX      = g++
>>>   HOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
>> For consistency,
>>
>> HOSTCXX         = c++
>>
>> ?
> So, Jeroen, what is your pick ? Will you send a v3 7/8, or are you
> sticking with g++?
>
> (or if everyone agrees, I could to the change to v2 7/8 when applying
> it, and add a comment about it in the commit message.)

I did check Masahiro's statement that cpp is actually used in u-boot
and it is; make xconfig uses it, if I recall correctly. And as Masahiro
suggested I sent it to linux-kbuild mailinglist, but I am in the impression
it never arrived, perhaps I need to be subscribed or something...

Anyway, Masahiro's suggestion is sound and I am fine you changing
it while applying. I tested it on FreeBSD, Xubuntu and Debian.

Regards,
Jeroen
Albert ARIBAUD Sept. 9, 2014, 7:59 p.m. UTC | #4
Hi Jeroen,

On Tue, 09 Sep 2014 19:34:44 +0200, Jeroen Hofstee
<jeroen@myspectrum.nl> wrote:

> Hello Albert,
> 
> On 09-09-14 16:31, Albert ARIBAUD wrote:
> > On Thu, 31 Jul 2014 19:01:22 +0900, Masahiro Yamada
> > <yamada.m@jp.panasonic.com> wrote:
> >
> >>>   HOSTCXX      = g++
> >>>   HOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
> >> For consistency,
> >>
> >> HOSTCXX         = c++
> >>
> >> ?
> > So, Jeroen, what is your pick ? Will you send a v3 7/8, or are you
> > sticking with g++?
> >
> > (or if everyone agrees, I could to the change to v2 7/8 when applying
> > it, and add a comment about it in the commit message.)
> 
> I did check Masahiro's statement that cpp is actually used in u-boot
> and it is; make xconfig uses it, if I recall correctly. And as Masahiro
> suggested I sent it to linux-kbuild mailinglist, but I am in the impression
> it never arrived, perhaps I need to be subscribed or something...
> 
> Anyway, Masahiro's suggestion is sound and I am fine you changing
> it while applying. I tested it on FreeBSD, Xubuntu and Debian.

I've tried building rpi_b as per the README, but I keep getting

	/usr/bin/as: unrecognized option '-mfloat-abi=soft'
	clang: error: assembler command failed with exit code 1 (use -v
	to see invocation)

Shouldn't rpi_b build properly since it is the one given as an example
for Debian-based building?

> Regards,
> Jeroen

Amicalement,
Jeroen Hofstee Sept. 9, 2014, 9:48 p.m. UTC | #5
Hi,

On 09-09-14 21:59, Albert ARIBAUD wrote:
> Hi Jeroen,
>
> On Tue, 09 Sep 2014 19:34:44 +0200, Jeroen Hofstee
> <jeroen@myspectrum.nl> wrote:
>
>> Hello Albert,
>>
>> On 09-09-14 16:31, Albert ARIBAUD wrote:
>>> On Thu, 31 Jul 2014 19:01:22 +0900, Masahiro Yamada
>>> <yamada.m@jp.panasonic.com> wrote:
>>>
>>>>>    HOSTCXX      = g++
>>>>>    HOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
>>>> For consistency,
>>>>
>>>> HOSTCXX         = c++
>>>>
>>>> ?
>>> So, Jeroen, what is your pick ? Will you send a v3 7/8, or are you
>>> sticking with g++?
>>>
>>> (or if everyone agrees, I could to the change to v2 7/8 when applying
>>> it, and add a comment about it in the commit message.)
>> I did check Masahiro's statement that cpp is actually used in u-boot
>> and it is; make xconfig uses it, if I recall correctly. And as Masahiro
>> suggested I sent it to linux-kbuild mailinglist, but I am in the impression
>> it never arrived, perhaps I need to be subscribed or something...
>>
>> Anyway, Masahiro's suggestion is sound and I am fine you changing
>> it while applying. I tested it on FreeBSD, Xubuntu and Debian.
> I've tried building rpi_b as per the README, but I keep getting
>
> 	/usr/bin/as: unrecognized option '-mfloat-abi=soft'
> 	clang: error: assembler command failed with exit code 1 (use -v
> 	to see invocation)
>
> Shouldn't rpi_b build properly since it is the one given as an example
> for Debian-based building?
>
>

As discussed with Albert there seems to be some Debian / Ubuntu
specific changes to the package causing trouble. Checking out the
llvm 3.5 branch works fine, using the package fails with above
mentioned error.

No idea why at the moment, patches are fine...

Regards,
Jeroen
Jeroen Hofstee Sept. 10, 2014, 10:02 a.m. UTC | #6
Hello Albert,

On 09-09-14 21:59, Albert ARIBAUD wrote:
> Hi Jeroen,
>
> On Tue, 09 Sep 2014 19:34:44 +0200, Jeroen Hofstee
> <jeroen@myspectrum.nl> wrote:
>
>
> I've tried building rpi_b as per the README, but I keep getting
>
> 	/usr/bin/as: unrecognized option '-mfloat-abi=soft'
> 	clang: error: assembler command failed with exit code 1 (use -v
> 	to see invocation)
>
> Shouldn't rpi_b build properly since it is the one given as an example
> for Debian-based building?
>

ok, this turns out to be a simple issue. The gas for arm is not
found since CROSS_COMPILE has a trailing dash. When it is removed
the correct as is picked up (and libs is found automagically as well).
Both the 3.4 and 3.5 binary packages from Ubuntu are able to
compile u-boot with this change, so the README should be updated.

Regards,
Jeroen

This should work:
make HOSTCC=clang CC="clang -target arm-linux-gnueabi -mllvm 
-arm-use-movt=0 -no-integrated-as" V=1 all
Masahiro Yamada Sept. 11, 2014, 5:03 a.m. UTC | #7
Hi Jeroen,


On Tue, 09 Sep 2014 19:34:44 +0200
Jeroen Hofstee <jeroen@myspectrum.nl> wrote:

> Hello Albert,
> 
> On 09-09-14 16:31, Albert ARIBAUD wrote:
> > On Thu, 31 Jul 2014 19:01:22 +0900, Masahiro Yamada
> > <yamada.m@jp.panasonic.com> wrote:
> >
> >>>   HOSTCXX      = g++
> >>>   HOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
> >> For consistency,
> >>
> >> HOSTCXX         = c++
> >>
> >> ?
> > So, Jeroen, what is your pick ? Will you send a v3 7/8, or are you
> > sticking with g++?
> >
> > (or if everyone agrees, I could to the change to v2 7/8 when applying
> > it, and add a comment about it in the commit message.)
> 
> I did check Masahiro's statement that cpp is actually used in u-boot
> and it is; make xconfig uses it, if I recall correctly. And as Masahiro
> suggested I sent it to linux-kbuild mailinglist, but I am in the impression
> it never arrived, perhaps I need to be subscribed or something...


I received it because you cced me.

But I am afraid it did not reach the kbuild ML
because I could not find it in the kbuild ML archive.


I recommend to subscribe to the ML and then
resend your patch.


To subscribe to it, visit the following and click 'subscribe'
http://vger.kernel.org/vger-lists.html#linux-kbuild

The kbuild ML does not have much volume.
I guess you won't be annoyed.


To attract the attention of key persons, I'd like to suggest:

 - add 'kbuild: ' prefix to the subject like:

     kbuild: default to cc/c++ for host compiler

 - you can cc linux-kernel@vger.kernel.org too.
   (scripts/get_maintainer.pl will do it automatically.
    But I am not sure if it can be reached from unsubscribers.
    this ML has a huge volume..)





Best Regards
Masahiro Yamada
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 80eb239..c19f7d9 100644
--- a/Makefile
+++ b/Makefile
@@ -204,7 +204,7 @@  CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
 	  else if [ -x /bin/bash ]; then echo /bin/bash; \
 	  else echo sh; fi ; fi)
 
-HOSTCC       = gcc
+HOSTCC       = cc
 HOSTCXX      = g++
 HOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
 HOSTCXXFLAGS = -O2