autoconf
[Top][All Lists]
Advanced

[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 17:31:47 -0500
User-agent: Thunderbird 2.0.0.14 (X11/20080501)

Bruno Haible wrote:
> Peter O'Gorman wrote:
>>> +On MacOS X systems, you can create libraries and executables that work
>> For 10.4.x ppc you had to install an SDK and add -isysroot flags.
> 
> ok, please change to doc patch to say "On MacOS X systems, version 10.5
> or newer".
> 
>> For automake using projects --disable-dependency-tracking is also
>> necessary.
> 
> What happens if it is not specified? I just compiled texinfo-4.12 without
> this flag. All compilation commands included
>   DEPDIR=.deps depmode=gcc /bin/sh ../build-aux/depcomp ...
> and there were no errors.
> 
>> 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".
> 
> The latter does not work, because then the preprocessor cannot be run:
> 
>   $ gcc -arch i386 -arch ppc -E foo.c
>   gcc-4.0: -E, -S, -save-temps and -M options are not allowed with multiple 
> -arch flags

./configure CC=gcc CFLAGS='-arch ppc -arch i386 -arch x86_64 -arch ppc64
-O2 -g' CXX='g++' CXXFLAGS='-arch ppc -arch i386 -arch x86_64 -arch
ppc64 -O2 -g'

does not require the setting of CPP, but does require that
--disable-dependency-tracking be added. Oh well. :)

Okay, I am inclined to agree with you, that the -arch flags belong in
the CC/CXX variables.

I would, however, remove the -arch ppc from the CPP and CXXCPP, i.e.
just CPP='gcc -E' CXXCPP='g++ -E' to get the native preprocessor,
whatever that may be.

In the majority of cases there are no problems building universal
binaries in this manner. But there are enough cases where it does not
build, or where it builds but has problems for some architectures at
runtime, that I still think if the instruction is added to install.texi,
a warning be added in the same spot.

Would you agree to something like this?

Peter
-- 
Peter O'Gorman
http://pogma.com
diff --git a/doc/install.texi b/doc/install.texi
index e087629..2978b5b 100644
--- a/doc/install.texi
+++ b/doc/install.texi
@@ -6,7 +6,7 @@
 @unnumbered Installation Instructions
 
 Copyright @copyright{} 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004,
-2005, 2006, 2007 Free Software Foundation, Inc.
+2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This file is free documentation; the Free Software Foundation gives
 unlimited permission to copy, distribute and modify it.
@@ -120,6 +120,22 @@ architecture at a time in the source code directory.  
After you have
 installed the package for one architecture, use @samp{make distclean}
 before reconfiguring for another architecture.
 
+On MacOS X 10.5 and later systems, you can create libraries and
+executables that work 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 -E" CXXCPP="g++ -E"
address@hidden example
+
+This is not guaranteed to produce working output in all cases, you may
+have to build one architecture at a time and combine the results
+using the @command{lipo} tool if you have problems.
+
 @node Installation Names
 @section Installation Names
 

reply via email to

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