checking for gcc

Ryan Schmidt ryandesign at macports.org
Fri Mar 20 16:52:24 PDT 2009


On Mar 20, 2009, at 17:53, Thomas De Contes wrote:

> Le 16 mars 09 à 00:05, Ryan Schmidt a écrit :
>
>> On Mar 15, 2009, at 17:36, Thomas De Contes wrote:
>>
>>> i updade MacPorts, and at the step "port upgrade outdated" it  
>>> always sets
>>> checking for gcc... /usr/bin/gcc-4.0
>>>
>>> whereas /usr/bin/gcc-4.0 does not exist and /usr/bin/gcc points  
>>> on gcc-3.3
>>>
>>>
>>> what is the problem ?
>>
>> /usr/bin/gcc-4.0 should exist, and /usr/bin/gcc should point to  
>> it, on Tiger and later.
>
> ok
> if /usr/bin/gcc-4.0 exists but /usr/bin/gcc does not point to it,  
> it's not right ?

If /usr/bin/gcc-4.0 exists but /usr/bin/gcc points to gcc-3.3 then  
you have most likely used the gcc_select program to select gcc 3.3.  
This should not affect the majority of ports since MacPorts tells  
ports to use /usr/bin/gcc-4.0 by default on Tiger and later. Specific  
ports may override this as needed. For example some very old software  
must compile with gcc-3.3 because gcc-4.0 is too new; in this case,  
those ports indicate this requirement and MacPorts allows them to use  
gcc-3.3 instead.

Some ports do not pay attention to the compiler MacPorts tells them  
to use, and they instead use just "cc" or "gcc" in which case they  
will use whatever you have gcc_select'ed, so gcc_select'ing something  
other than the default gcc-4.0 can still cause problems. But it is a  
bug for ports to use "cc" or "gcc" instead of what MacPorts tells  
them to use, and if you find a port that does this, you should file a  
bug against that port.

Because you are getting the message

checking for gcc... /usr/bin/gcc-4.0
checking for C compiler default output... configure: error: C  
compiler cannot create executables

I believe /usr/bin/gcc-4.0 either does not exist on your system or it  
is broken in some way (perhaps some of its support files are missing).


>> MacPorts will use /usr/bin/gcc-4.0 on Tiger and later, and /usr/ 
>> bin/gcc-3.3 on Panther.
>
> ok
>
>> What OS version do you have? What version of Xcode?
>
> checking Mac OS X version... 10.4.11
> checking Xcode version... 2.4.1

Xcode 2.4.1 is probably fine on Tiger. 2.5 is the latest available  
but I used 2.4.1 for a long time and it works fine. And it certainly  
should provide /usr/bin/gcc-4.0.


>> Try reinstalling the latest version of Xcode for your OS.
>
> ok
>
> i would like to install as less as possible
> which part of xcode do you think is necessary, please ? :-)
>
> developer tools software ?
> gcc 4.0 ?
> software development kits ?

I don't know specifically what component of Xcode provides gcc-4.0  
but if it's missing on your system, then reinstall (all of) Xcode  
2.4.1 or 2.5.


> btw,
>
> why does it work fine to build MacPorts itself, with gcc 3.3, and  
> not to build software ?

Port authors have limited resources with which to test ports. Usually  
people only have a single Mac, running either Leopard or Tiger, with  
either an Intel or PowerPC processor. This means most port authors  
are only testing on 1/4 of the supported systems. Problems can crop  
up on the remaining 3/4 of the supported systems the author did not  
test on.

We do not want to increase the testing burden even further by  
allowing users to compile ports with a different compiler than the  
one the port author tested with. For this reason, MacPorts instructs  
ports to ignore what the user has gcc_selected'ed and instead to use  
a specific compiler on specific OS versions (3.3 on Panther, 4.0 on  
Tiger and Leopard). Individual ports can override this if it's  
necessary for those ports, but users are not supposed to override this.


> why does it say :
> checking for gcc... /usr/bin/gcc-4.0
> checking for C compiler default output... configure: error: C  
> compiler cannot create executables
> rather than sth like
> checking for gcc... /usr/bin/gcc-4.0 not found
> ?
> and why not searh for gcc-4.0 in $PATH ?

Here you are asking about the configure script of the port you were  
trying to install. For questions about why that configure script does  
what it does, you'll have to ask the authors of that software, or  
probably the authors of autotools, since this looks like the output  
from a standard autotools-generated configure script.

But as I understand it, "checking for gcc" does not mean "checking  
where on your system gcc is located". Instead, it means "checking if  
you have asked me to use a specific gcc" and the answer is "you have  
asked me to use /usr/bin/gcc-4.0" which is correct. The fact that / 
usr/bin/gcc-4.0 doesn't actually exist on your system is a problem on  
your system.

As explained above, it is not desired in MacPorts to search for the  
compiler anywhere. It is desired to use a very specific compiler  
which is always located at a specific path (which may vary from port  
to port and OS to OS, but not from user to user).




More information about the macports-users mailing list