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
Dynamic libs w/ Ocaml + C code under Mac OS X
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-02-05 (21:54)
From: Alain Frisch <alain@f...>
Subject: Re: [Caml-list] Dynamic libs w/ Ocaml + C code under Mac OS X
Joel Stanley wrote:
> ld -bundle -flat_namespace -undefined suppress -read_only_relocs 
> suppress -o ''  '-L/Users/jstanley/hbin/lib/ocaml' 
> '' 'simple.o' '/Users/jstanley/hbin/lib/ocaml/stdlib.a' 
> 'wrapper.o' '/Users/jstanley/hbin/lib/ocaml/libasmrun.a'
>  > ld: absolute addressing (perhaps -mdynamic-no-pic) used in 

Ok, it makes sense. Now, if you replace ld with ld_classic, does it work?

>  From the experiments that I've been doing, it really looks like PIC 
> needs to be generated for the OS X linker to be happy.  Do you have any 
> assessment as to how much work this is?  Keep in mind that I don't 
> consider myself an x86 assembly hacker by any stretch of the imagination 
> ;)  I'd really like to just run this natively on my main platform, but 
> if I can't, I can't.

Honestly, I don't know how hard it would be. You can look at what had to 
be done for AMD64 
( and at how 
one is supposed to produce PIC for x86 (gcc -fPIC).

Or you can try to convince Apple to restore "-read_only_relocs
suppress" in the new linker (I could find no indication that Apple 
deliberately dropped this feature).

-- Alain