Why -O and -g in universal variants?

Cédric Luthi cedric.luthi at gmail.com
Sun Feb 25 02:50:59 PST 2007


On 2/25/07, Ryan Schmidt <ryandesign at macports.org> wrote:

> My understanding is that -g turns on some kind of debugging code, and
> -O is an optimization level.

Absolutely.

>Neither of those seem to me to have any
> bearing on a universal binary. That is: if -g or -O are useful, then
> they would be useful for all ports at all times, and not just in the
> +universal variants of some ports.

You are absolutely right about the whole thing. I don't understand why
"-g -O" are used in the example. They could as well have added
"-funroll-loop -fanother-option etc." and hundreds other gcc flags
that are irrelevant to a universal build to confuse readers even more.

> I don't see why that would be so. The universal 10.4 SDK is there to
> provide you with universal versions of system libraries regardless of
> what platform you're building on. It should always be safe and
> correct to use the universal SDK.

I don't see why either. I just said that if I remember correclty,
specifying isysroot on Intel Mac would lead the build to fail. I may
be wrong however, I tested this several months ago and I don't
remember the details.

> I do not believe your assessment is correct here either. I believe
> using...
>
> env CFLAGS="-arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc" ./
> configure
>
> ...would produce a universal binary on an Intel Mac,

That's what I was trying to say also. I said using isysroot on Intel
would fail, I did not say not using it would fail. I try once again:

env CFLAGS="-arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc" ./configure ...
on ppc: fail because system libs are not universal
on i386: ok because system libs are universal

env CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch
ppc" LDFLAGS="-arch i386 -arch ppc" ./configure ...
on ppc: ok because univeral libs must be used
on i386: fail because of an unknown reason. I may be wrong on this
point, I may have tested with an older version of gcc. I will test
again as soon as I'm on my Intel Mac.

I hope this is clearer this time ;-)



More information about the macports-dev mailing list