autoconf
[Top][All Lists]
Advanced

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

document how to create universal binaries


From: Bruno Haible
Subject: document how to create universal binaries
Date: Sun, 17 Aug 2008 11:46:43 +0200
User-agent: KMail/1.5.4

Hi,

On MacOS X 10.5, most system-provided binaries and libraries are "fat" or
"universal": they can be executed on all architectures of MacOS X 10.5.

Given the section "Compiling For Multiple Architectures" from the INSTALL
file of so many GNU packages, I was under the impression that it was hard
to build universal binaries for packages that use autoconf. But this is
actually not the case. Among the 4 packages I tested (libiconv, libsigsegv,
gettext, gperf), all but one can be built as universal binaries out of the box,
given the appropriate instructions, and the one that did not work (libsigsegv)
could be made to work in 20 minutes.

This is clearly not optimally documented. The location where it should be
documented, IMO, is the INSTALL file. Here is a patch which adds a third
paragraph to the section "Compiling For Multiple Architectures":

     On MacOS X systems, you can create libraries and executables that work
  on multiple system types - known as "fat" or "universal" binaries - by
  specifying multiple '-arch' options to the compiler but only a single
  '-arch' option to the preprocessor.  Like this:

       env 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" \
           ./configure

Here's the proposed patch.


2008-08-17  Bruno Haible  <address@hidden>

        * doc/install.texi (Compiling For Multiple Architectures): Explain how
        to create universal binaries on MacOS X.

--- doc/install.texi.bak        2008-03-14 01:46:05.000000000 +0100
+++ doc/install.texi    2008-08-17 11:33:19.000000000 +0200
@@ -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,19 @@
 installed the package for one architecture, use @samp{make distclean}
 before reconfiguring for another architecture.
 
+On MacOS X 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
+env 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" \
+    ./configure
address@hidden example
+
 @node Installation Names
 @section Installation Names
 





reply via email to

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