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-06 (00:03)
From: Joel Stanley <jstanley@g...>
Subject: Re: [Caml-list] Dynamic libs w/ Ocaml + C code under Mac OS X

On Feb 5, 2008, at 1:49 PM, Alain Frisch wrote:

> 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?

Yes, yes it does, thanks!  I had actually deferred trying this because  
I wanted a solution that would be more suitable going forward.  As you  
pointed out, Apple may not have intended to drop the '- 
read_only_relocs suppress' option, but there's also no telling whether  
or not it'll end up being officially unsupported.

>> 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).

Alright, I might take a crack at it.  Thanks again for your help.