Chosing the C and C++ compilers

Akim Demaille akim at lrde.epita.fr
Fri Nov 7 00:22:52 PST 2008


Le 6 nov. 08 à 22:56, Ryan Schmidt a écrit :

> On Nov 6, 2008, at 08:06, Akim Demaille wrote:
>
>> Le 5 nov. 08 à 23:55, Ryan Schmidt a écrit :
>>
>>> configure.cc is a Portfile command; it doesn't do anything in  
>>> macports.conf.
>>>
>>> I was not familiar with distcc. I just looked it up  
>>> (www.distcc.org) and it sounds interesting. I'm not sure how to  
>>> best use it with MacPorts. MacPorts always defaults to using e.g. / 
>>> usr/bin/gcc-4.0 to compile on Tiger and Leopard. Maybe distcc has  
>>> a way to translate that?
>>
>> It seems that "configuredistcc yes" does the trick from  
>> macports.conf, I did nothing else (and running distccmontext I saw  
>> that the compilation was indeed distributed).  But yes, there are  
>> means to play symlinks treaks to have gcc bounce to "distcc gcc",  
>> yet I don't like that.
>>
>> Really, I just wish I had a simple means (= not by having to  
>> specify it on each port command line) to specify CC and CXX.
>
> Why would you want to do that? We have few enough volunteers with  
> few enough resources as it is; I don't think we can afford to  
> require port maintainers to allow any compiler to be used with their  
> ports. It's good that we lock it down to a specific compiler. Port  
> maintainers can override that if necessary for their specific ports,  
> but it should not be for users to change.

Well, if I change the compiler, I'm well aware that I'm off tracks,  
and if something goes wrong, it's on my side.


>> Or else, I would prefer that the hard coded values be fully  
>> qualified (/usr/bin/i686-apple-darwin9-gcc-4.0.1) instead of short  
>> (/usr/bin/gcc-4.0).
>
> But then we would have to find out what that value is, for the  
> current processor architecture and OS version. And what happens when  
> we want to build a universal binary?

This is something Anders helped me understand, and as I wrote  
elsewhere, I think that sticking to /usr/bin/gcc-4.0 is a fine option  
*provided* that the proper cflags are given to the compiler to clarify  
the target architecture.  In that case I can use my compile farm  
efficiently, whatever the combination of architectures.

>> In that case I have nothing special to do to use distcc with  
>> macports.
>
> Since we already have some distcc options in MacPorts we obviously  
> want it to be easy to use with MacPorts. But I personally have never  
> used it so I have no input on how best to do so.

Using distcc provides a huge speed-up.  At work I "make -kj20".  It  
makes a large difference.  And I wish I could use the same amount of  
cpu to upgrade my laptop.

Really, all it requires is to pass the proper flags to the compiler.

Of course I can change my /usr/bin/gcc-4.0 to make it a wrapper around  
the original one passing additional flags, but I feel that it is more  
appropriate to have ports pass more precise flags to the compilers.


More information about the macports-users mailing list