Updating gcc on PPC with Leopard

Michael Witten mfwitten@MIT.EDU
Tue Jan 29 15:16:00 GMT 2008


On 28 Jan 2008, at 9:29 PM, Matthias Schmidt wrote:

> Am/On Mon, 28 Jan 2008 11:16:57 -0500 schrieb/wrote Michael Witten:
>
>> On 27 Jan 2008, at 10:11 PM, Matthias Schmidt wrote:
>>
>>> What has to be done to complete the installation or update of gcc on
>>> a Mac?
>>
>> What exactly were the errors you got with 4.2.2?
>
> Error 1 and Error 2 the rest I can't remember.

The actual errors are given above those lines and are usually
fairly specific.

> But there are some postings on the web about this issue.
> 4.2.3 compiles without problems.

I'm not entirely sure it is safe to use an unreleased version.

>
> But I would need some more knowledge, how to set that stuff up  
> correctly
> on Leopard and I couldn't find a how to (for dummies ;-)
>
>>
>> I got 4.1.2 built by cross-compiling to Mac OS X 10.4 from 10.5 by
>> doing this
>> first:
>>
>> 	export MACOSX_DEPLOYMENT_TARGET=10.4
>
> actually in this case I need 10.5 only.
> The box is a Leopard Server and I need to compile only stuff like
> Postfix, ClamAV etc.

This is what I mean: Leopard has fundamental changes that aren't
accounted for by any release of GCC. Consequently, GCC can't be
built using Leopard's internals.

Fortunately, Apple has provided a copy of Tiger's internals, so
that software (like GCC), can still be built on Leopard. Leopard
will still run old stuff, but the old stuff can't be compiled
on the new stuff.

To instruct the system to build something against a copy of Tiger's
internals, you can define the environment variable as shown and then
build GCC.

> For development I use XCode sometimes, mainly 4D - no terminal  
> stuff ;-)
> But of course I'd like to know the procedure, so that I could update  
> gcc
> with a newer version on my will.

Why exactly do you want to update the compiler? There's danger in  
switching
compiler versions. Besides, Apple's gcc may have significant  
modifications;
compilation is usually tied closely to the entire system, and Apple  
has some
very non-standard stuff compared to the rest of the GCC world.

>> As for your case, did you replace the Apple binaries with the ones  
>> you
>> just built?
>
> as far as I can tell it did it by itself, but only partly.
> So there are obviously some gotchas, because when I run ./configure  
> for
> ClamAV the new compiler is not recognized.

You really ought to be more careful about this kind of thing. You  
shouldn't
go about replacing parts of a working system unless you know exactly  
what
you want.

>> If not, do you have the new ones on your path? If you're building
>> ClamAV from an XCode project, is there some built environment  
>> variable
>> you can set, like CC?
>
> no I just go to the downloaded source code, run configure with some
> options, make and make install. Nothing special, just the standard  
> procedure.

Then you probably didn't specify --prefix, in which case everything got
installed in /usr/local as per the standard procedure instructions.

You can find out which gcc is being used by running, appropriately:

	which gcc

You can check the version like this:

	`which gcc` --version

In the case that the wrong version is being found, the new GCC is not
on your PATH. Put it on your PATH, as follows:

	export PATH="/path/to/new/gcc/bin/directory:${PATH}"

where the new gcc is in "/path/to/new/gcc/bin/directory". This will
make the system find your new gcc first.

Then start XCode from the same terminal.

A more convenient alternative may be given by the following (I haven't  
tried):

	http://www.astro.washington.edu/owen/AquaEnvVar.html


In any case, I don't think you should be building gcc yourself. The  
compiler
is not something to screw around with unless you know what you're doing.

I would suggest also that you look into something like MacPorts or Fink.

Sincerely,
Michael Witten



More information about the Gcc-help mailing list