On Mar 5, 2011, at 10:17 PM, Cameron Kaiser wrote: >>> Is there an established way of building curl as Universal Binary? >> >> I'm not familiar with the mechanics of making OS X's universal binaries, >> but I assume that the compiler simply makes three passes through each >> source file for each architecture specified on the command-line. > > That's exactly what happens. I haven't tried this, but you could add compiler > flags such as > > -arch ppc -arch i386 > > (yes, two -arch flags), which should cause gcc to try to glue them together > into a fat binary at the end. > > If that fails, you would use lipo to glue two objects together, which always > works.
This works as long as you're building just an only 32 bit or only 64 bit curl, but not a mixed 32/64 bit one. The problem is that curlbuild.h has macros whose value varies between 32 and 64 bit. If you want a true universal binary you need to do what the MacOSX-Framework script does; do a -arch ppc -arch i386 build and then a -arch ppc64 -arch x86_64 build and lipo the result together. Furthermore, you need to rename curlbuild.h from each to something like curlbuild32.h and curlbuild64.h and make new curlbuild.h that does this: #ifdef __LP64__ #include "curl/curlbuild64.h" #else #include "curl/curlbuild32.h" #endif Then it'll work. I recommend looking at the MacOSX-Framework script since it does everything you need. You can skip the framework specific stuff if you just want a regular library. Daniel ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
