[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: document how to create universal binaries

From: Peter O'Gorman
Subject: Re: document how to create universal binaries
Date: Sun, 17 Aug 2008 09:01:07 -0500
User-agent: Thunderbird (X11/20080501)

Bruno Haible wrote:

> +On MacOS X systems, you can create libraries and executables that work

Only Mac OS X 10.5, on 10.4.x only x86 had fat libraries in /, it may be
best to specify that. For 10.4.x ppc you had to install an SDK and add
-isysroot flags.

> +on multiple system types -- known as "fat" or "universal" binaries --
> +by specifying multiple @option{-arch} options to the compiler but only
> +a single @option{-arch} option to the preprocessor.  Like this:
> +
> address@hidden
> +./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
> +            CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
> +            CPP="gcc -arch ppc -E" \
> +            CXXCPP="g++ -arch ppc -E"
> address@hidden example

For automake using projects --disable-dependency-tracking is also
necessary. Also, I am not sure if putting the -arch flags in CC/CXX and
having to specify the preprocessor, or putting them in CFLAGS/CXXFLAGS
and not specifying the preprocessor is "better".

> +
>  @node Installation Names
>  @section Installation Names

Because ppc and x86 are differently endian, and because 64bit and 32bit
have different sizeof(long) etc, it may be best to mention that just
because it builds does not mean that it will work. Also, I believe that
there are cases autoconf will discover different symbols/libraries when
building on i386 than when building on ppc, that can result in link
errors for one architecture.

There are a number of "gotchas" when building fat binaries, I'm not sure
it is best to put this in the INSTALL document without any warnings or

Apple recommends building once per architecture (on a machine that can
do so natively) and using lipo to create a universal binary. That way
most of the problems are avoided.

Peter O'Gorman

reply via email to

[Prev in Thread] Current Thread [Next in Thread]