librelist archives

« back to archive

Support for GCC

Support for GCC

From:
Konrad Rudolph
Date:
2012-01-25 @ 12:03
Continuing the discussion from issue [9768][]:

[Summary of the argument so far: Clang is the default compiler on OS X, no
need to support GCC]

I see three issues with this approach:

1. Clang isn’t a GCC yet. While I completely support Apple’s effort to 
push an objectively better compiler software (Clang), it’s simply not a 
complete replacement yet.

2. Xcode (intentionally?) ships ancient versions. This is an advantage if 
your first and foremost goal is stability. But given the number of 
features acquired in recent versions, it’s also a major hindrance.

3. Installing GCC by hand is fairly complicated and convoluted. Having an 
officially supported formula for it (whether keg-only or not) would 
greatly help.

To list just two points where Xcode's clang version falls short is OpenMP 
[1] and C++0x support [2].

This also effectively means that there’s some software which cannot be 
used with Homebrew even though it’s nominally supported [3]. (This may be 
a minor issue. Personally, I need an up to date compiler for C++0x 
support)

Please note (since there seemed some confusion in the comments of the 
issue) that I’m not pushing for making GCC the default compiler for brew, 
simply to offer offical support for a formula.

--
Regards,
Konrad

[9768]: https://github.com/mxcl/homebrew/issues/9768
[1]: https://github.com/mxcl/homebrew/issues/2801
[2]: http://gcc.gnu.org/projects/cxx0x.html
[3]: https://github.com/mxcl/homebrew/issues/9518

Re: [homebrew] Support for GCC

From:
Charlie Sharpsteen
Date:
2012-01-25 @ 16:26
On Wed, Jan 25, 2012 at 4:03 AM, Konrad Rudolph
<konrad_rudolph@madrat.net> wrote:
> 2. Xcode (intentionally?) ships ancient versions. This is an advantage 
if your first and foremost goal is stability. But given the number of 
features acquired in recent versions, it’s also a major hindrance.

Another important point to consider is that Apple's GCC includes
custom patches that allow it to build universal binaries by simply passing
multiple `-arch` flags to the compilers. So, if you need to ship
universal binaries, using another GCC version really isn't a good
option. It can be done using the `lipo` command, but it is not easy
and only gets harder as your project grows bigger and more complex.


On Wed, Jan 25, 2012 at 4:44 AM, Konrad Rudolph
<konrad_rudolph@madrat.net> wrote:
> I will do that, then. I'm currently trying to install GCC manually and 
might submit an issue or pull request to the alt repository.

Please do try the GCC formula that is already in Homebrew-alt before
starting from scratch:

  https://github.com/adamv/homebrew-alt/blob/master/duplicates/gcc.rb

Pull requests to improve it are definitely welcomed. I am currently
working on adding LTO support and the Dragonegg plugin.


-Charlie

Re: [homebrew] Support for GCC

From:
Konrad Rudolph
Date:
2012-01-25 @ 16:51
> Please do try the GCC formula that is already in Homebrew-alt before
> starting from scratch:
> 
>  https://github.com/adamv/homebrew-alt/blob/master/duplicates/gcc.rb

I tried using this version first a few days ago and reproducibly got 
linker errors (same as with the other GCC version on the Custom GCC wiki 
page). That's why I filed the bug report in the first place. I should 
re-file it in the homebrew-alt repo, I know.

> Pull requests to improve it are definitely welcomed. I am currently
> working on adding LTO support and the Dragonegg plugin.

The problem is that I don't really see where the issue is coming from … 
manually installing GCC actually works with pretty minimal custom 
configuration and without any patching.

The only obvious difference to the brew formula is that I didn't tinker 
with the environment (unlike the formula), and I only built C, C++ and 
Fortran. Oh, and I didn't use the `bootstrap` target. So, after all, 
actually some substantial differences. I might do a little more 
investigating when I find the time.

--
Konrad

Re: [homebrew] Support for GCC

From:
Misty De Meo
Date:
2012-01-25 @ 17:09
> I tried using this version first a few days ago and reproducibly got 
linker errors (same as with the other GCC version on the Custom GCC wiki 
page). That's why I filed the bug report in the first place. I should 
re-file it in the homebrew-alt repo, I know.

If, as you mentioned before, the problem is trying to compile GCC
using llvm-gcc/clang, have you tried installing the binary apple-gcc42
formula and building the gcc formula using that (via `--use-gcc`)? I'm
able to build from that formula successfully using gcc-4.2.

Misty

Re: [homebrew] Support for GCC

From:
Charlie Sharpsteen
Date:
2012-01-25 @ 17:15
On Wed, Jan 25, 2012 at 9:09 AM, Misty De Meo <mistydemeo@gmail.com> wrote:
>> I tried using this version first a few days ago and reproducibly got 
linker errors (same as with the other GCC version on the Custom GCC wiki 
page). That's why I filed the bug report in the first place. I should 
re-file it in the homebrew-alt repo, I know.

Just to clarify: Did you get linker errors while building the formula?
Or linker errors when using the compilers built by the formula?

Re: [homebrew] Support for GCC

From:
Konrad Rudolph
Date:
2012-01-25 @ 17:19
On 25 Jan 2012, at 17:15, Charlie Sharpsteen wrote:

> Just to clarify: Did you get linker errors while building the formula?
> Or linker errors when using the compilers built by the formula?

When building the formula.

--
Konrad

Re: [homebrew] Support for GCC

From:
Charlie Sharpsteen
Date:
2012-01-25 @ 17:34
On Wed, Jan 25, 2012 at 9:19 AM, Konrad Rudolph
<konrad_rudolph@madrat.net> wrote:
>
> On 25 Jan 2012, at 17:15, Charlie Sharpsteen wrote:
>
>> Just to clarify: Did you get linker errors while building the formula?
>> Or linker errors when using the compilers built by the formula?
>
> When building the formula.

Hmm... that's odd. I installed GCC from Homebrew-alt just fine on
Saturday using Lion 10.7.2 and XCode 4.2.1.

Might have only built the C compiler though.

-Charlie

Re: [homebrew] Support for GCC

From:
John Harrison
Date:
2012-01-25 @ 15:36
On Jan 25, 2012, at 6:03 AM, Konrad Rudolph wrote:

> 2. Xcode (intentionally?) ships ancient versions. This is an advantage 
if your first and foremost goal is stability. But given the number of 
features acquired in recent versions, it’s also a major hindrance.

Well, there is another reason for this as well. GCC and a number of GNU 
libraries switched licenses. Apple doesn't like to include anything with 
the GPLv3 (eg. GCC 4.3 and beyond). They also replaced Samba with an 
in-house re-write for Windows Networking in Lion. It wouldn't surprise me 
if they eventually removed all GPL'ed code from OS X. I only mention Samba
because it was one of the latest libraries to be replaced.

Just wanted to add that tidbit in, its not really for stability's sake 
that they haven't upgraded a number of libraries, it has more to do with 
licenses. 


--
John Harrison
github.com/ashgti

Re: [homebrew] Support for GCC

From:
Date:
2012-01-25 @ 16:13
GCC-Without-Xcode is a good alternative to OSX GCC Installer if you need 
proprietary headers, such as CoreData, CoreAudio, OpenGL. None of the cool
stuff compiles without those headers.

--
Sorin Ionescu

On 25 Jan 2012, at 10:36, John Harrison wrote:

> On Jan 25, 2012, at 6:03 AM, Konrad Rudolph wrote:
> 
>> 2. Xcode (intentionally?) ships ancient versions. This is an advantage 
if your first and foremost goal is stability. But given the number of 
features acquired in recent versions, it’s also a major hindrance.
> 
> Well, there is another reason for this as well. GCC and a number of GNU 
libraries switched licenses. Apple doesn't like to include anything with 
the GPLv3 (eg. GCC 4.3 and beyond). They also replaced Samba with an 
in-house re-write for Windows Networking in Lion. It wouldn't surprise me 
if they eventually removed all GPL'ed code from OS X. I only mention Samba
because it was one of the latest libraries to be replaced.
> 
> Just wanted to add that tidbit in, its not really for stability's sake 
that they haven't upgraded a number of libraries, it has more to do with 
licenses. 
> 
> 
> --
> John Harrison
> github.com/ashgti

Re: [homebrew] Support for GCC

From:
Mike McQuaid
Date:
2012-01-25 @ 12:14
On 25 Jan 2012, at 12:03, Konrad Rudolph wrote:

> 1. Clang isn’t a GCC yet. While I completely support Apple’s effort to 
push an objectively better compiler software (Clang), it’s simply not a 
complete replacement yet.

I disagree.


> 2. Xcode (intentionally?) ships ancient versions. This is an advantage 
if your first and foremost goal is stability. But given the number of 
features acquired in recent versions, it’s also a major hindrance.

Apple ships old versions of libraries. This argument applies to pretty 
much any system duplicate.


> 3. Installing GCC by hand is fairly complicated and convoluted. Having 
an officially supported formula for it (whether keg-only or not) would 
greatly help.
> 
> To list just two points where Xcode's clang version falls short is 
OpenMP [1] and C++0x support [2].
> 
> This also effectively means that there’s some software which cannot be 
used with Homebrew even though it’s nominally supported [3]. (This may be 
a minor issue. Personally, I need an up to date compiler for C++0x 
support)
> 
> Please note (since there seemed some confusion in the comments of the 
issue) that I’m not pushing for making GCC the default compiler for brew, 
simply to offer offical support for a formula.

I think it would be good if there was an easy way to install GCC but I 
don't think it should be part of the main repository yet. I would suggest 
the best way of improving this would be to file bugs and submit patches to
those versions available here:
https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers

A good start would be perhaps encouraging bottles so they can be installed
without GCC being required to build them.

--
Mike McQuaid
http://mikemcquaid.com

Re: [homebrew] Support for GCC

From:
Konrad Rudolph
Date:
2012-01-25 @ 12:25
>> 1. Clang isn’t a GCC yet. While I completely support Apple’s effort to 
push an objectively better compiler software (Clang), it’s simply not a 
complete replacement yet.
> 
> I disagree.

With which part of my assessment? That it's not a complete replacement or 
that Apple is wrong in pushing it?

>> 2. Xcode (intentionally?) ships ancient versions. This is an advantage 
if your first and foremost goal is stability. But given the number of 
features acquired in recent versions, it’s also a major hindrance.
> 
> Apple ships old versions of libraries. This argument applies to pretty 
much any system duplicate.

I  wasn't trying to criticise Apple here. Shipping old, stable versions is
completely fine.

> I think it would be good if there was an easy way to install GCC but I 
don't think it should be part of the main repository yet. I would suggest 
the best way of improving this would be to file bugs and submit patches to
those versions available here:
> https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers
> 
> A good start would be perhaps encouraging bottles so they can be 
installed without GCC being required to build them.

That might be the right approach, I'll look into this. Still, I don't see 
the issue with having GCC in the main repository (again, it could still be
keg-only, like e.g. cairo).

--
Regards,
Konrad

Re: [homebrew] Support for GCC

From:
Mike McQuaid
Date:
2012-01-25 @ 12:36
On 25 Jan 2012, at 12:25, Konrad Rudolph wrote:

> With which part of my assessment? That it's not a complete replacement 
or that Apple is wrong in pushing it?

I don't have GCC installed on my system and yet manage to write and ship 
commercial software running on OSX to customers. I felt it was worth 
highlighting there is a difference of opinion but I don't want to get 
bogged down into an argument about it.

>> I think it would be good if there was an easy way to install GCC but I 
don't think it should be part of the main repository yet. I would suggest 
the best way of improving this would be to file bugs and submit patches to
those versions available here:
>> https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers
>> 
>> A good start would be perhaps encouraging bottles so they can be 
installed without GCC being required to build them.
> 
> That might be the right approach, I'll look into this. Still, I don't 
see the issue with having GCC in the main repository (again, it could 
still be keg-only, like e.g. cairo).

Adding things to the main repository adds to our maintenance burden. At 
the moment I don't think the burden is worth the benefit but that may 
change in the future if people improve the GCC formula, test it 
thoroughly, perhaps add a bottle and it looks like the community has an 
interest in keeping it up to date and working.

--
Mike McQuaid
http://mikemcquaid.com

Re: [homebrew] Support for GCC

From:
Konrad Rudolph
Date:
2012-01-25 @ 12:44
>> With which part of my assessment? That it's not a complete replacement 
or that Apple is wrong in pushing it?
> 
> I don't have GCC installed on my system and yet manage to write and ship
commercial software running on OSX to customers. I felt it was worth 
highlighting there is a difference of opinion but I don't want to get 
bogged down into an argument about it.

When I said "complete replacement" I meant feature-complete; in 
particular, if a software (or you) use OpenMP or C++0x you are out of 
luck. This isn't a matter of opinion so the "I disagree" threw me off. I 
do agree that for purposes other than those Clang *is* a mature 
replacement.

> Adding things to the main repository adds to our maintenance burden. At 
the moment I don't think the burden is worth the benefit but that may 
change in the future if people improve the GCC formula, test it 
thoroughly, perhaps add a bottle and it looks like the community has an 
interest in keeping it up to date and working.

I will do that, then. I'm currently trying to install GCC manually and 
might submit an issue or pull request to the alt repository.

Either way, working with brew formulae is just a breeze.

--
Konrad

Re: [homebrew] Support for GCC

From:
Nicolas Desprès
Date:
2012-01-25 @ 13:13
Hi,

Sorry to jump in the topic and my remark will probably be stupid but
did you try osx-gcc-installer? I had trouble to get ruby-1.9.3-p0 to
build using rvm. Installing osx-gcc-installer fixed my problem.
Although I understand what the wiki page says, I did not get any
trouble with any formula yet.

Cheers,
-Nico

On Wed, Jan 25, 2012 at 1:44 PM, Konrad Rudolph
<konrad_rudolph@madrat.net> wrote:
>>> With which part of my assessment? That it's not a complete replacement
or that Apple is wrong in pushing it?
>>
>> I don't have GCC installed on my system and yet manage to write and 
ship commercial software running on OSX to customers. I felt it was worth 
highlighting there is a difference of opinion but I don't want to get 
bogged down into an argument about it.
>
> When I said "complete replacement" I meant feature-complete; in 
particular, if a software (or you) use OpenMP or C++0x you are out of 
luck. This isn't a matter of opinion so the "I disagree" threw me off. I 
do agree that for purposes other than those Clang *is* a mature 
replacement.
>
>> Adding things to the main repository adds to our maintenance burden. At
the moment I don't think the burden is worth the benefit but that may 
change in the future if people improve the GCC formula, test it 
thoroughly, perhaps add a bottle and it looks like the community has an 
interest in keeping it up to date and working.
>
> I will do that, then. I'm currently trying to install GCC manually and 
might submit an issue or pull request to the alt repository.
>
> Either way, working with brew formulae is just a breeze.
>
> --
> Konrad



-- 
Nicolas Desprès

Re: [homebrew] Support for GCC

From:
Kenneth Reitz
Date:
2012-01-25 @ 13:16
OSX-GCC-Installer works perfectly as long as you don't need any 
proprietary headers: CoreData, CoreAudio, OpenGL, etc.


--  
Kenneth Reitz


On Wednesday, January 25, 2012 at 8:13 AM, Nicolas Desprès wrote:

> Hi,
>  
> Sorry to jump in the topic and my remark will probably be stupid but
> did you try osx-gcc-installer? I had trouble to get ruby-1.9.3-p0 to
> build using rvm. Installing osx-gcc-installer fixed my problem.
> Although I understand what the wiki page says, I did not get any
> trouble with any formula yet.
>  
> Cheers,
> -Nico
>  
> On Wed, Jan 25, 2012 at 1:44 PM, Konrad Rudolph
> <konrad_rudolph@madrat.net (mailto:konrad_rudolph@madrat.net)> wrote:
> > > > With which part of my assessment? That it's not a complete 
replacement or that Apple is wrong in pushing it?
> > >  
> > >  
> > > I don't have GCC installed on my system and yet manage to write and 
ship commercial software running on OSX to customers. I felt it was worth 
highlighting there is a difference of opinion but I don't want to get 
bogged down into an argument about it.
> >  
> > When I said "complete replacement" I meant feature-complete; in 
particular, if a software (or you) use OpenMP or C++0x you are out of 
luck. This isn't a matter of opinion so the "I disagree" threw me off. I 
do agree that for purposes other than those Clang *is* a mature 
replacement.
> >  
> > > Adding things to the main repository adds to our maintenance burden.
At the moment I don't think the burden is worth the benefit but that may 
change in the future if people improve the GCC formula, test it 
thoroughly, perhaps add a bottle and it looks like the community has an 
interest in keeping it up to date and working.
> >  
> > I will do that, then. I'm currently trying to install GCC manually and
might submit an issue or pull request to the alt repository.
> >  
> > Either way, working with brew formulae is just a breeze.
> >  
> > --
> > Konrad
> >  
>  
>  
>  
>  
> --  
> Nicolas Desprès
>  
>