apple-gcc42 fails to build

Ryan Schmidt ryandesign at macports.org
Mon Aug 17 18:43:18 PDT 2015


On Aug 17, 2015, at 9:36 AM, Thomas Ruedas wrote:

>> One suggestion in that ticket is to make sure you have the latest Xcode. Do you?
>> The latest Xcode for Leopard is 3.1.4. Even if you already have 3.1.4, it couldn't
>> hurt to try reinstalling it; perhaps something is corrupt and reinstalling would fix it.
> Just to be sure, I downloaded and re-installed Xcode again, made a
> sudo port clean apple-gcc42
> and
> sudo port install apple-gcc42
> but it failed again in the same way.
> 
> I wonder why gcc42 is needed in the first place, when the most recent version of gcc is much newer (isn't it?).

The most recent version of the Apple-modified version of GCC is 4.2.1. With version 4.3, the GCC project switched its license to GPL version 3, and Apple appears to have a corporate policy against dealing with software under that version of that license. So instead, Apple developed the clang compiler and uses it on current versions of OS X. Versions of clang are also available in MacPorts.

Non-Apple-modified versions of GCC are not suitable for general use in MacPorts, because they use their own version of the libstdc++ library which is partly incompatible with the system version of libstdc++ as used on OS X 10.8 and earlier, and totally incompatible with libc++ which is used on OS X 10.9 and later. Also, non-Apple-modified versions of GCC cannot compile for multiple architectures at the same time, which is a capability MacPorts expects the default compilers to have.

Why was apple-gcc42 needed? You didn't say which port needed it, and indeed MacPorts doesn't necessarily make it easy to find out. But you said you were trying to install gnuplot, so I checked its recursive dependencies. I found that gnuplot depends on libcaca, which depends on freeglut and libGLU, both of which depend on mesa. And mesa's portfile contains the following lines:

> # This project is affected by a bug in Apple's gcc driver driver that I fixed in the apple-gcc42 port.
> # Use that or clang.
> compiler.blacklist gcc-3.3 gcc-4.0 gcc-4.2 llvm-gcc-4.2 {clang < 100}

So, it appears that the version of Apple GCC 4.2.1 included in Xcode 3.1.4 on Leopard has a bug which affects the mesa port, therefore the mesa port prohibits building with gcc-4.2 and other affected compilers, leaving MacPorts to choose the next best compiler, which in this case is the newer version of Apple GCC 4.2.1 that we have in MacPorts in which the problem has been fixed.


> Anyway, I observe that apple-gcc42 depends on ld64 and cctools. I did notice in my long upgrade attempt yesterday that there was a conflict with cctools:
> --->  Installing libmacho-headers @862_2
> --->  Cleaning libmacho-headers
> --->  Deactivating cctools-headers @855_0
> --->  Unable to deactivate cctools-headers @855_0, the following ports depend on it:
> --->  	cctools @855_1+llvm33
> Warning: Deactivate forced.  Proceeding despite dependencies.
> --->  Cleaning cctools-headers
> --->  Activating libmacho-headers @862_2
> 
> although a bit later, just before trying to install apple-gcc42 there was:
> --->  Installing cctools @862_1+llvm33
> --->  Cleaning cctools
> --->  Computing dependencies for cctools
> --->  Deactivating cctools @855_1+llvm33
> --->  Cleaning cctools
> --->  Activating cctools @862_1+llvm33
> 
> so maybe that part was ok after all.

Yes, the above output is normal. You had the cctools-headers port installed. This port is now obsolete and has been replaced by the libmacho-headers port. It is confusing that when a replaced port gets upgraded to its replacement, MacPorts prints the "Unable to deactivate" message, followed by "Warning: Deactivate forced.  Proceeding despite dependencies", even though the user did not explicitly force anything, and it would be nice to improve those messages to be more helpful, but for now, this is expected behavior when a port has been replaced and is nothing to be worried about.


I see from the above that you have cctools installed with the llvm33 variant, which is the default on Leopard, but you could try using a newer version of llvm with cctools, by running

sudo port install cctools +llvm36

or

sudo port install cctools +llvm35

or

sudo port install cctools +llvm34


The strip command, which is the one having a problem dealing with your system's libstdc++ library, is part of cctools, so letting it use a newer llvm library might help. I experienced an error myself with the cctools port's otool command which was fixed by using a newer llvm.


Which ld64 subport do you have installed? You can find out by running "port installed subportof:ld64". Looks like the default ld64 subport for Leopard is ld64-127. It too has llvm variants, and you should probably install it with the same llvm variant you use for cctools.

After changing the llvm variant of cctools and your installed ld64 subport, try cleaning apple-gcc42 and trying to install it again.




More information about the macports-users mailing list