On Mon, Mar 01, 2010 at 07:48:56PM -0500, Jianzhou Zhao wrote:
> On Mon, Mar 1, 2010 at 10:19 AM, Mark Shinwell <mshinw...@janestreet.com> 
> wrote:
> I compiled OCaml code into *.o by 'ocamlc -custom -output-obj...',
> and then linked it with *.o from C and C++ code.
> I think this isnt a native compilation.

Agreed.

> My main C++ program is eventually compiled into a shared library.
> If I do 'ocamlopt', ld reports:
> /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld:
> /mnt/eclipse/acg/users/jianzhou/tools/ocaml-3.11.2//lib/ocaml/libasmrun.a(amd64.o):
> relocation R_X86_64_PC32 against symbol `caml_last_return_address' can
> not be used when making a shared object; recompile with -fPIC

You need to build the runtime as position-independent code.  Unfortunately
this is non-trivial.  I suggest you try looking at this thread which may
help you:

http://caml.inria.fr/pub/ml-archives/caml-list/2010/01/9894615c02692ca5b86e2a891d8cf324.en.html

Mark

_______________________________________________
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

Reply via email to