How do I make fat binaries?Up to Table of Contents
This FAQ applies to: Any version.
multi-arch binaries (aka "fat" or "universal" binaries) are only possible on OSX.
super simple solution:
- pass the
--enable-fat-binaryflag to Gem's configure. by default, this will create fat binaries for PowerPC (ppc) and MacIntel (i386)
- you can also specify the architectures, e.g.
--enable-fat-binary=x86_64will create a "fat" binary with one architecture (MacIntel 64bit)
using compiler/linker flags:
- add "-arch
" (multiple times, if you need multiple architectures) to your compiler & linker flags; really, the super simple solution does exactly that behind the scenes
- e.g. adding
-arch i386 -arch x86_64to your CXXFLAGS and LDFLAGS will create fat binaries to run on MacIntel 32bit and 64bit
generating fat binaries from non-fat binaries:
- sometimes it is simpler to merge a number of non-fat binaries into a single fat binary
- using lipo for this:
lipo -create <file1> <file2> <...> -output <file>
lipo -create ppc/Gem.pd_darwin i386/Gem.pd_darwin ia64/Gem.pd_darwin -output Gem.d_fat