Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] Building OSX Universal Binaries

29 views
Skip to first unread message

Nicolas Cannasse

unread,
Jan 6, 2007, 7:27:19 PM1/6/07
to caml...@yquem.inria.fr
Hello,

I'm regularly making OSX releases of the haXe compiler (http://haxe.org)
which is written in OCaml, but since I only have a Mac Intel, I didn't
find a way to produce a PPC version of the compiler.

I would be interested in building OSX Universal Binaries using ocamlopt.
Did anybody found a way to do that ?

Best,
Nicolas

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Daniel Bünzli

unread,
Jan 7, 2007, 7:33:44 AM1/7/07
to caml...@yquem.inria.fr

Le 7 janv. 07 à 01:25, Nicolas Cannasse a écrit :

> I would be interested in building OSX Universal Binaries using
> ocamlopt.
> Did anybody found a way to do that ?

The only way I see is to have access to both a ppc and intel machine
an join the executables with the command line tool lipo.
Maybe a wish to directly produce universal binaries should go in the
bugtracker.

Best,

Daniel

Corey O'Connor

unread,
Jan 15, 2007, 4:37:42 PM1/15/07
to caml...@yquem.inria.fr
On 1/7/07, Daniel Bünzli <daniel....@epfl.ch> wrote:
>
>
> Le 7 janv. 07 ŕ 01:25, Nicolas Cannasse a écrit :

>
> > I would be interested in building OSX Universal Binaries using
> > ocamlopt.
> > Did anybody found a way to do that ?
>
> The only way I see is to have access to both a ppc and intel machine
> an join the executables with the command line tool lipo.
> Maybe a wish to directly produce universal binaries should go in the
> bugtracker.

I don't think you need access to both a ppc and intel machine: Just an intel
machine would suffice. Two separate installs of ocaml, One PPC and one
Intel, then using some appropriate PATH variable magic to switch between
compiling with one vs the other. Then lipo at the end. Should work OK.

--
-Corey O'Connor

Daniel Bünzli

unread,
Jan 15, 2007, 5:16:36 PM1/15/07
to caml...@yquem.inria.fr

Le 15 janv. 07 ą 22:33, Corey O'Connor a écrit :

> I don't think you need access to both a ppc and intel machine: Just
> an intel machine would suffice. Two separate installs of ocaml, One
> PPC and one Intel, then using some appropriate PATH variable magic
> to switch between compiling with one vs the other. Then lipo at
> the end. Should work OK.

Maybe, then I guess a ppc machine would also be enough. Do you happen
to know how to trick caml's ./configure ?

Note that I still think caml should, in the end, generate universal
binaries directly, even though I have no real idea about what it
means with respect to cmxa and friends and how much ocaml compiler
surgery you'd need. Maybe it is not worth the effort.

Corey O'Connor

unread,
Jan 15, 2007, 8:28:18 PM1/15/07
to Daniel Bünzli
On 1/15/07, Daniel Bünzli <daniel....@epfl.ch> wrote:
>
>
> Le 15 janv. 07 ŕ 22:33, Corey O'Connor a écrit :

>
> > I don't think you need access to both a ppc and intel machine: Just
> > an intel machine would suffice. Two separate installs of ocaml, One
> > PPC and one Intel, then using some appropriate PATH variable magic
> > to switch between compiling with one vs the other. Then lipo at
> > the end. Should work OK.
>
> Maybe, then I guess a ppc machine would also be enough. Do you happen
> to know how to trick caml's ./configure ?


I don't think a ppc machine would be enough since a ppc mac cannot run x86
programs but a x86 mac can run both ppc and x86 programs.
Not sure how to trick configure either. I've done this process before with
Haskell programs, but in that case used pre-built binaries of the compiler
for each platform.

--
-Corey O'Connor

Philippe Wang

unread,
Jan 16, 2007, 3:05:57 AM1/16/07
to Corey O'Connor

On 16 janv. 07, at 02:24, Corey O'Connor wrote:

>
>
> On 1/15/07, Daniel Bünzli <daniel....@epfl.ch> wrote:
>

> Le 15 janv. 07 à 22:33, Corey O'Connor a écrit :


>
> > I don't think you need access to both a ppc and intel machine: Just
> > an intel machine would suffice. Two separate installs of ocaml, One
> > PPC and one Intel, then using some appropriate PATH variable magic
> > to switch between compiling with one vs the other. Then lipo at
> > the end. Should work OK.
>
> Maybe, then I guess a ppc machine would also be enough. Do you happen
> to know how to trick caml's ./configure ?
>
> I don't think a ppc machine would be enough since a ppc mac cannot
> run x86 programs but a x86 mac can run both ppc and x86 programs.
> Not sure how to trick configure either. I've done this process
> before with Haskell programs, but in that case used pre-built
> binaries of the compiler for each platform.

However, ocamlopt can be configured to produce x86 asm on a PPC,
can't it ?
And XCode can build universal binaries on both ppc and x86...
So I guess you just need to call gcc with the right parameters...

(I'll try when I have time...)

--
Philippe Wang

Corey O'Connor

unread,
Jan 16, 2007, 12:54:10 PM1/16/07
to caml...@inria.fr


Actually, I have no idea. That'd be great if it did.

--
-Corey O'Connor

James Woodyatt

unread,
Jan 29, 2007, 6:03:59 PM1/29/07
to Corey O'Connor, caml...@inria.fr
On Jan 16, 2007, at 09:48, Corey O'Connor wrote:

> On 1/15/07, Philippe Wang <li...@philippewang.info> wrote:
>>
>> However, ocamlopt can be configured to produce x86 asm on a PPC,
>> can't it ?
>> And XCode can build universal binaries on both ppc and x86...
>> So I guess you just need to call gcc with the right parameters...
>
> Actually, I have no idea. That'd be great if it did.

I haven't seen any easy way to configure OCaml as a crosstool. The
trick you would use here is to run the native PPC version of the
OCaml compilers on x86 under Rosetta. I don't know if this works,
but I would expect it to work. Be a pain in the neck, but it should
work.


--
james woodyatt <j...@apple.com>
member of technical staff
apple computer, inc.

Philippe Wang

unread,
Jan 30, 2007, 1:47:45 PM1/30/07
to caml...@inria.fr
James Woodyatt wrote:
> On Jan 16, 2007, at 09:48, Corey O'Connor wrote:
>> On 1/15/07, Philippe Wang <li...@philippewang.info> wrote:
>>>
>>> However, ocamlopt can be configured to produce x86 asm on a PPC,
>>> can't it ?
>>> And XCode can build universal binaries on both ppc and x86...
>>> So I guess you just need to call gcc with the right parameters...
>>
>> Actually, I have no idea. That'd be great if it did.
>
> I haven't seen any easy way to configure OCaml as a crosstool. The
> trick you would use here is to run the native PPC version of the OCaml
> compilers on x86 under Rosetta. I don't know if this works, but I
> would expect it to work. Be a pain in the neck, but it should work.
>
>
> --james woodyatt <j...@apple.com>

> member of technical staff
> apple computer, inc.
well, the one more trick to use should be to give the right option to
gcc, which is called by ocamlopt...

Daniel Bünzli

unread,
Jan 30, 2007, 2:00:59 PM1/30/07
to Philippe Wang

Le 30 janv. 07 à 19:40, Philippe Wang a écrit :

> well, the one more trick to use should be to give the right option
> to gcc, which is called by ocamlopt...

IIRC, gcc is used by ocamlopt to eat assembly language so you won't
be able to trick it just by specifying some option.

Daniel

0 new messages