Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Making OS X universal binaries
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-09-12 (10:08)
From: Richard Bornat <richard@b...>
Subject: Making OS X universal binaries
I have a need to build a OS X universal binary of an OCaml program. I  
found out how to do it (apologies if this is already posted, but I  
couldn't find a solution in the archives).

1. Install the PowerPC version of OCaml. Squirrel away /usr/local/bin/ 
ocamlopt and /usr/local/lib/ocaml (I just added ppc to their names).

2. Install the Intel version of OCaml.

3. To make a ppc version of the program, compile with /usr/local/bin/ 
ocamloptppc (no need to add any extra arguments), and link with /usr/ 
local/bin/ocamloptppc -ccopt "-arch ppc" -nostdlib -I /usr/local/lib/ 

That's it. When you've made both versions, merge them with lipo. ppc  
compilation and loading is a bit slow, but that's the only drawback  
I've found.

Sorry again if this is a bit obvious ...

Richard Bornat