English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Debugging C and OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-03-02 (07:42)
From: Mark Shinwell <mshinwell@j...>
Subject: Re: [Caml-list] Debugging C and OCaml
On Mon, Mar 01, 2010 at 07:48:56PM -0500, Jianzhou Zhao wrote:
> On Mon, Mar 1, 2010 at 10:19 AM, Mark Shinwell <mshinwell@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.


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