[Top][All Lists]

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

Re: can libtool do universal binary

From: Peter O'Gorman
Subject: Re: can libtool do universal binary
Date: Fri, 11 May 2007 10:10:54 -0500

On May 11, 2007, at 4:45 AM, Perrog wrote:


Has anyone been using libtool for universal binary builds on Mach-O/ Mac OS X? Are there any other platform that have similar requirements? In summary, an "universal build" is a Mach-O object or binary file format containing both PowerPC and Intel architectures, in an architecture independend file format. Basically, you run gcc two times and build it for ppc, then for i386. Lastly you use a magic tool, in this case "lipo", that combines the two architectures into a single binary file.

Are there other platforms having parallells to universal builds? What would this really require from libtool? Or should universal builds be handled by other methods?

If you look at the libtool script you'll see that it uses lipo if it sees a universal static library that it needs to extract. You'll also see that it takes the -arch and -isysroot flags (libtool-1.5.22 and later). And if you actually try it, you'll see that it passes its testsuite with multiple -arch flags in CFLAGS and CXXFLAGS.

That being said, multi-arch builds with autoconf based projects require more than just adding a few -arch flags. You must inspect the configure and m4 files and the code to see if there is anywhere that needs to test endianness, sizes of pointers etc etc, because configure will only run the tests with the native arch. You might have to #ifdef a few places in the project.

Peter O'Gorman

reply via email to

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