Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Compiling a Universal Binary from Autogen sources System 10.6
You can compile the package for more than one kind of computer at the same time, by placing the objects for each architecture in their own directory. To do this, you can use GNU make. Run cd to go to the directory where you want the object files and executables to wind up and run the configure script. Configure automatically checks for the source code in the directory that configure is in and in ..; this is known as a VPATH build.

With a non-GNU make, it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use make distclean before reconfiguring a new architecture.

On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types (known as fat also universal binaries) by specifying multiple -arch options to the compiler but only a single -arch option to the preprocessor.

Working Example (for most autogen sources):
CC="gcc -arch i386 -arch x86_64" CXX="g++ -arch i386 -arch x86_64" CPP="gcc -E" CXXCPP="g++ -E" ./configure
You can add addition configure script switches, such as: --prefix=/usr/local. 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 lipo tool if you have problems.

The original printing of this hint was found after hours of mangled searches, only to find it right here.

I have tested this many times over the past few days, and have only found a handful that would not compile using this hint, but running the lipo -create commands on a few is a lot better than doing this for everything I need to compile.

[crarko adds: I haven't tested this one.]
  • Currently 3.00 / 5
  You rated: 3 / 5 (4 votes cast)

Compiling a Universal Binary from Autogen sources | 1 comments | Create New Account
Click here to return to the 'Compiling a Universal Binary from Autogen sources' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Compiling a Universal Binary from Autogen sources
Authored by: msteveb on Jul 18, '11 08:20:02PM

An even simpler way is:

./configure CFLAGS="-arch i386 -arch x86_x4 -O2 -g"

[ Reply to This | # ]