Next: , Previous: , Up: Running configure Scripts   [Contents][Index]


16.3 Compiling For Multiple Architectures

You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU make. cd to the directory where you want the object files and executables to go 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 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 -arch options to the compiler but only a single -arch option to the preprocessor. Like this:

./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"

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.