* [Qemu-devel] [PATCH] configure: Default to 'cc', not 'gcc', on MacOS X
@ 2012-11-16 16:37 Peter Maydell
2012-11-17 13:02 ` Andreas Färber
0 siblings, 1 reply; 9+ messages in thread
From: Peter Maydell @ 2012-11-16 16:37 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Anthony Liguori, Andreas Färber, patches
When building for MacOS X, default the C compiler to 'cc' (usually
clang) rather than 'gcc'. This avoids the Apple 'gcc', which is
generally an elderly llvm-gcc provided mostly for legacy purposes,
in favour of the best supported compiler available on the platform.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
I now seem to be getting failures to compile due to weak refs on
clang as well, but defaulting to cc seems like a good long term
plan anyway. I've mostly been building and testing with --cc=clang
so this isn't a sudden compiler switch from my point of view.
I'm ambivalent about whether this should go in 1.3 or not, given
it doesn't actually fix the weakref issues.
configure | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index f847ee2..ec9932b 100755
--- a/configure
+++ b/configure
@@ -116,7 +116,13 @@ audio_drv_list=""
audio_card_list="ac97 es1370 sb16 hda"
audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
block_drv_whitelist=""
-host_cc="gcc"
+if test "$(uname -s)" = "Darwin"; then
+ # On MacOS X the standard supported system compiler is 'cc' (usually clang),
+ # and 'gcc' is a legacy llvm-gcc which is rather elderly and best avoided.
+ host_cc="cc"
+else
+ host_cc="gcc"
+fi
libs_softmmu=""
libs_tools=""
audio_pt_int=""
@@ -250,7 +256,16 @@ done
# Using uname is really, really broken. Once we have the right set of checks
# we can eliminate its usage altogether.
-cc="${CC-${cross_prefix}gcc}"
+# Preferred compiler:
+# ${CC} (if set)
+# ${cross_prefix}gcc (if cross-prefix specified)
+# system compiler
+if test -z "${CC}${cross_prefix}"; then
+ cc="$host_cc"
+else
+ cc="${CC-${cross_prefix}gcc}"
+fi
+
ar="${AR-${cross_prefix}ar}"
objcopy="${OBJCOPY-${cross_prefix}objcopy}"
ld="${LD-${cross_prefix}ld}"
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: Default to 'cc', not 'gcc', on MacOS X
2012-11-16 16:37 [Qemu-devel] [PATCH] configure: Default to 'cc', not 'gcc', on MacOS X Peter Maydell
@ 2012-11-17 13:02 ` Andreas Färber
2012-11-17 13:10 ` Peter Maydell
0 siblings, 1 reply; 9+ messages in thread
From: Andreas Färber @ 2012-11-17 13:02 UTC (permalink / raw)
To: Peter Maydell; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel, patches
Am 16.11.2012 17:37, schrieb Peter Maydell:
> When building for MacOS X, default the C compiler to 'cc' (usually
> clang) rather than 'gcc'. This avoids the Apple 'gcc', which is
> generally an elderly llvm-gcc provided mostly for legacy purposes,
> in favour of the best supported compiler available on the platform.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I now seem to be getting failures to compile due to weak refs on
> clang as well, but defaulting to cc seems like a good long term
> plan anyway. I've mostly been building and testing with --cc=clang
> so this isn't a sudden compiler switch from my point of view.
> I'm ambivalent about whether this should go in 1.3 or not, given
> it doesn't actually fix the weakref issues.
>
> configure | 19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index f847ee2..ec9932b 100755
> --- a/configure
> +++ b/configure
> @@ -116,7 +116,13 @@ audio_drv_list=""
> audio_card_list="ac97 es1370 sb16 hda"
> audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
> block_drv_whitelist=""
> -host_cc="gcc"
> +if test "$(uname -s)" = "Darwin"; then
> + # On MacOS X the standard supported system compiler is 'cc' (usually clang),
> + # and 'gcc' is a legacy llvm-gcc which is rather elderly and best avoided.
This comment strikes me as wrong in this generality. It should at least
be qualified with OSX version numbers.
Andreas
> + host_cc="cc"
> +else
> + host_cc="gcc"
> +fi
> libs_softmmu=""
> libs_tools=""
> audio_pt_int=""
> @@ -250,7 +256,16 @@ done
> # Using uname is really, really broken. Once we have the right set of checks
> # we can eliminate its usage altogether.
>
> -cc="${CC-${cross_prefix}gcc}"
> +# Preferred compiler:
> +# ${CC} (if set)
> +# ${cross_prefix}gcc (if cross-prefix specified)
> +# system compiler
> +if test -z "${CC}${cross_prefix}"; then
> + cc="$host_cc"
> +else
> + cc="${CC-${cross_prefix}gcc}"
> +fi
> +
> ar="${AR-${cross_prefix}ar}"
> objcopy="${OBJCOPY-${cross_prefix}objcopy}"
> ld="${LD-${cross_prefix}ld}"
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: Default to 'cc', not 'gcc', on MacOS X
2012-11-17 13:02 ` Andreas Färber
@ 2012-11-17 13:10 ` Peter Maydell
2012-11-21 23:19 ` Peter Maydell
0 siblings, 1 reply; 9+ messages in thread
From: Peter Maydell @ 2012-11-17 13:10 UTC (permalink / raw)
To: Andreas Färber; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel, patches
On 17 November 2012 13:02, Andreas Färber <andreas.faerber@web.de> wrote:
> Am 16.11.2012 17:37, schrieb Peter Maydell:
>> When building for MacOS X, default the C compiler to 'cc' (usually
>> clang) rather than 'gcc'. This avoids the Apple 'gcc', which is
>> generally an elderly llvm-gcc provided mostly for legacy purposes,
>> in favour of the best supported compiler available on the platform.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>> I now seem to be getting failures to compile due to weak refs on
>> clang as well, but defaulting to cc seems like a good long term
>> plan anyway. I've mostly been building and testing with --cc=clang
>> so this isn't a sudden compiler switch from my point of view.
>> I'm ambivalent about whether this should go in 1.3 or not, given
>> it doesn't actually fix the weakref issues.
>>
>> configure | 19 +++++++++++++++++--
>> 1 file changed, 17 insertions(+), 2 deletions(-)
>>
>> diff --git a/configure b/configure
>> index f847ee2..ec9932b 100755
>> --- a/configure
>> +++ b/configure
>> @@ -116,7 +116,13 @@ audio_drv_list=""
>> audio_card_list="ac97 es1370 sb16 hda"
>> audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
>> block_drv_whitelist=""
>> -host_cc="gcc"
>> +if test "$(uname -s)" = "Darwin"; then
>> + # On MacOS X the standard supported system compiler is 'cc' (usually clang),
>> + # and 'gcc' is a legacy llvm-gcc which is rather elderly and best avoided.
>
> This comment strikes me as wrong in this generality. It should at least
> be qualified with OSX version numbers.
How about "and if 'gcc' is not the same as 'cc' then it is a legacy llvm-gcc
which is rather elderly and best avoided" ? I'd rather not get into having
to research which versions of OSX shipped with which compiler as 'cc',
when really the point is that 'cc' will always give you whichever compiler
Apple thought was the best default for that version.
-- PMM
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: Default to 'cc', not 'gcc', on MacOS X
2012-11-17 13:10 ` Peter Maydell
@ 2012-11-21 23:19 ` Peter Maydell
2012-11-22 0:04 ` Andreas Färber
0 siblings, 1 reply; 9+ messages in thread
From: Peter Maydell @ 2012-11-21 23:19 UTC (permalink / raw)
To: Andreas Färber; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel, patches
On 17 November 2012 13:10, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 17 November 2012 13:02, Andreas Färber <andreas.faerber@web.de> wrote:
>> Am 16.11.2012 17:37, schrieb Peter Maydell:
>>> +if test "$(uname -s)" = "Darwin"; then
>>> + # On MacOS X the standard supported system compiler is 'cc' (usually clang),
>>> + # and 'gcc' is a legacy llvm-gcc which is rather elderly and best avoided.
>>
>> This comment strikes me as wrong in this generality. It should at least
>> be qualified with OSX version numbers.
>
> How about "and if 'gcc' is not the same as 'cc' then it is a legacy llvm-gcc
> which is rather elderly and best avoided" ? I'd rather not get into having
> to research which versions of OSX shipped with which compiler as 'cc',
> when really the point is that 'cc' will always give you whichever compiler
> Apple thought was the best default for that version.
Andreas: ping? are you happy with this suggested rephrasing? Do you
think this is 1.3 material? (now the static-stublib stuff is in it's
less critical, but it still seems like the right idea...)
thanks
-- PMM
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: Default to 'cc', not 'gcc', on MacOS X
2012-11-21 23:19 ` Peter Maydell
@ 2012-11-22 0:04 ` Andreas Färber
2012-11-22 8:33 ` Peter Maydell
0 siblings, 1 reply; 9+ messages in thread
From: Andreas Färber @ 2012-11-22 0:04 UTC (permalink / raw)
To: Peter Maydell; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel, patches
Am 22.11.2012 00:19, schrieb Peter Maydell:
> On 17 November 2012 13:10, Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 17 November 2012 13:02, Andreas Färber <andreas.faerber@web.de> wrote:
>>> Am 16.11.2012 17:37, schrieb Peter Maydell:
>>>> +if test "$(uname -s)" = "Darwin"; then
>>>> + # On MacOS X the standard supported system compiler is 'cc' (usually clang),
>>>> + # and 'gcc' is a legacy llvm-gcc which is rather elderly and best avoided.
>>>
>>> This comment strikes me as wrong in this generality. It should at least
>>> be qualified with OSX version numbers.
>>
>> How about "and if 'gcc' is not the same as 'cc' then it is a legacy llvm-gcc
>> which is rather elderly and best avoided" ? I'd rather not get into having
>> to research which versions of OSX shipped with which compiler as 'cc',
>> when really the point is that 'cc' will always give you whichever compiler
>> Apple thought was the best default for that version.
>
> Andreas: ping? are you happy with this suggested rephrasing?
Not quite... clang is a relatively new thing. On v10.5.8 ppc64 'cc' is a
symlink to a real (well, Apple-flavoured) 'gcc-4.0'.
What about "... (clang on recent systems) and 'gcc' may be a legacy
llvm-gcc ..."?
> Do you
> think this is 1.3 material? (now the static-stublib stuff is in it's
> less critical, but it still seems like the right idea...)
I wouldn't be opposed to taking the default change into 1.3 as long as
we can still override it to a specific compiler.
But then again there's the question of why not doing it on Linux as well
now that we seem to compile under clang, we have cc -> gcc-4.7 on
openSUSE 12.2. Among our supported platforms only Solaris comes to my
mind where cc might be an incompatible proprietary compiler.
Andreas
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: Default to 'cc', not 'gcc', on MacOS X
2012-11-22 0:04 ` Andreas Färber
@ 2012-11-22 8:33 ` Peter Maydell
2012-11-22 8:38 ` Brad Smith
0 siblings, 1 reply; 9+ messages in thread
From: Peter Maydell @ 2012-11-22 8:33 UTC (permalink / raw)
To: Andreas Färber; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel, patches
On 22 November 2012 00:04, Andreas Färber <andreas.faerber@web.de> wrote:
> Am 22.11.2012 00:19, schrieb Peter Maydell:
>> On 17 November 2012 13:10, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> On 17 November 2012 13:02, Andreas Färber <andreas.faerber@web.de> wrote:
>>>> Am 16.11.2012 17:37, schrieb Peter Maydell:
>>>>> +if test "$(uname -s)" = "Darwin"; then
>>>>> + # On MacOS X the standard supported system compiler is 'cc' (usually clang),
>>>>> + # and 'gcc' is a legacy llvm-gcc which is rather elderly and best avoided.
>>>>
>>>> This comment strikes me as wrong in this generality. It should at least
>>>> be qualified with OSX version numbers.
>>>
>>> How about "and if 'gcc' is not the same as 'cc' then it is a legacy llvm-gcc
>>> which is rather elderly and best avoided" ? I'd rather not get into having
>>> to research which versions of OSX shipped with which compiler as 'cc',
>>> when really the point is that 'cc' will always give you whichever compiler
>>> Apple thought was the best default for that version.
>>
>> Andreas: ping? are you happy with this suggested rephrasing?
>
> Not quite... clang is a relatively new thing. On v10.5.8 ppc64 'cc' is a
> symlink to a real (well, Apple-flavoured) 'gcc-4.0'.
Yes, that's the case where gcc is the same as cc, ie the "if" condition
in the comment is false. (I guess this is saying my rephrasing is at
best not very clear...)
> What about "... (clang on recent systems) and 'gcc' may be a legacy
> llvm-gcc ..."?
Sounds ok.
>> Do you
>> think this is 1.3 material? (now the static-stublib stuff is in it's
>> less critical, but it still seems like the right idea...)
>
> I wouldn't be opposed to taking the default change into 1.3 as long as
> we can still override it to a specific compiler.
--cc=whatever remains available.
> But then again there's the question of why not doing it on Linux as well
> now that we seem to compile under clang, we have cc -> gcc-4.7 on
> openSUSE 12.2. Among our supported platforms only Solaris comes to my
> mind where cc might be an incompatible proprietary compiler.
Do any of the BSDs ship with some odd non-GPL thing as cc ?
-- PMM
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: Default to 'cc', not 'gcc', on MacOS X
2012-11-22 8:33 ` Peter Maydell
@ 2012-11-22 8:38 ` Brad Smith
2012-11-22 8:41 ` Peter Maydell
0 siblings, 1 reply; 9+ messages in thread
From: Brad Smith @ 2012-11-22 8:38 UTC (permalink / raw)
To: Peter Maydell
Cc: Paolo Bonzini, Andreas F??rber, patches, Anthony Liguori,
qemu-devel
On Thu, Nov 22, 2012 at 08:33:17AM +0000, Peter Maydell wrote:
> On 22 November 2012 00:04, Andreas F??rber <andreas.faerber@web.de> wrote:
> > Am 22.11.2012 00:19, schrieb Peter Maydell:
> >> On 17 November 2012 13:10, Peter Maydell <peter.maydell@linaro.org> wrote:
> >>> On 17 November 2012 13:02, Andreas F??rber <andreas.faerber@web.de> wrote:
> >>>> Am 16.11.2012 17:37, schrieb Peter Maydell:
> >>>>> +if test "$(uname -s)" = "Darwin"; then
> >>>>> + # On MacOS X the standard supported system compiler is 'cc' (usually clang),
> >>>>> + # and 'gcc' is a legacy llvm-gcc which is rather elderly and best avoided.
> >>>>
> >>>> This comment strikes me as wrong in this generality. It should at least
> >>>> be qualified with OSX version numbers.
> >>>
> >>> How about "and if 'gcc' is not the same as 'cc' then it is a legacy llvm-gcc
> >>> which is rather elderly and best avoided" ? I'd rather not get into having
> >>> to research which versions of OSX shipped with which compiler as 'cc',
> >>> when really the point is that 'cc' will always give you whichever compiler
> >>> Apple thought was the best default for that version.
> >>
> >> Andreas: ping? are you happy with this suggested rephrasing?
> >
> > Not quite... clang is a relatively new thing. On v10.5.8 ppc64 'cc' is a
> > symlink to a real (well, Apple-flavoured) 'gcc-4.0'.
>
> Yes, that's the case where gcc is the same as cc, ie the "if" condition
> in the comment is false. (I guess this is saying my rephrasing is at
> best not very clear...)
>
> > What about "... (clang on recent systems) and 'gcc' may be a legacy
> > llvm-gcc ..."?
>
> Sounds ok.
>
> >> Do you
> >> think this is 1.3 material? (now the static-stublib stuff is in it's
> >> less critical, but it still seems like the right idea...)
> >
> > I wouldn't be opposed to taking the default change into 1.3 as long as
> > we can still override it to a specific compiler.
>
> --cc=whatever remains available.
>
> > But then again there's the question of why not doing it on Linux as well
> > now that we seem to compile under clang, we have cc -> gcc-4.7 on
> > openSUSE 12.2. Among our supported platforms only Solaris comes to my
> > mind where cc might be an incompatible proprietary compiler.
>
> Do any of the BSDs ship with some odd non-GPL thing as cc ?
non-GPL yes, odd no.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: Default to 'cc', not 'gcc', on MacOS X
2012-11-22 8:38 ` Brad Smith
@ 2012-11-22 8:41 ` Peter Maydell
2012-11-22 8:45 ` Brad Smith
0 siblings, 1 reply; 9+ messages in thread
From: Peter Maydell @ 2012-11-22 8:41 UTC (permalink / raw)
To: Brad Smith
Cc: Paolo Bonzini, Andreas F??rber, patches, Anthony Liguori,
qemu-devel
On 22 November 2012 08:38, Brad Smith <brad@comstyle.com> wrote:
> On Thu, Nov 22, 2012 at 08:33:17AM +0000, Peter Maydell wrote:
>> On 22 November 2012 00:04, Andreas F??rber <andreas.faerber@web.de> wrote:
>> > But then again there's the question of why not doing it on Linux as well
>> > now that we seem to compile under clang, we have cc -> gcc-4.7 on
>> > openSUSE 12.2. Among our supported platforms only Solaris comes to my
>> > mind where cc might be an incompatible proprietary compiler.
>>
>> Do any of the BSDs ship with some odd non-GPL thing as cc ?
>
> non-GPL yes, odd no.
Does QEMU build OK with them? Should we be preferring them
to gcc?
-- PMM
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: Default to 'cc', not 'gcc', on MacOS X
2012-11-22 8:41 ` Peter Maydell
@ 2012-11-22 8:45 ` Brad Smith
0 siblings, 0 replies; 9+ messages in thread
From: Brad Smith @ 2012-11-22 8:45 UTC (permalink / raw)
To: Peter Maydell
Cc: Paolo Bonzini, Andreas F??rber, patches, Anthony Liguori,
qemu-devel
On Thu, Nov 22, 2012 at 08:41:19AM +0000, Peter Maydell wrote:
> On 22 November 2012 08:38, Brad Smith <brad@comstyle.com> wrote:
> > On Thu, Nov 22, 2012 at 08:33:17AM +0000, Peter Maydell wrote:
> >> On 22 November 2012 00:04, Andreas F??rber <andreas.faerber@web.de> wrote:
> >> > But then again there's the question of why not doing it on Linux as well
> >> > now that we seem to compile under clang, we have cc -> gcc-4.7 on
> >> > openSUSE 12.2. Among our supported platforms only Solaris comes to my
> >> > mind where cc might be an incompatible proprietary compiler.
> >>
> >> Do any of the BSDs ship with some odd non-GPL thing as cc ?
> >
> > non-GPL yes, odd no.
>
> Does QEMU build OK with them? Should we be preferring them
> to gcc?
The release notes for 1.3 seem to indicate Clang is supported
now so I would think so. AFAIK FreeBSD -current does not
ship with gcc anymore. Bitrig is a fork of OpenBSD that only
ships with Clang.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-11-22 8:45 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-16 16:37 [Qemu-devel] [PATCH] configure: Default to 'cc', not 'gcc', on MacOS X Peter Maydell
2012-11-17 13:02 ` Andreas Färber
2012-11-17 13:10 ` Peter Maydell
2012-11-21 23:19 ` Peter Maydell
2012-11-22 0:04 ` Andreas Färber
2012-11-22 8:33 ` Peter Maydell
2012-11-22 8:38 ` Brad Smith
2012-11-22 8:41 ` Peter Maydell
2012-11-22 8:45 ` Brad Smith
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).