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

[Caml-list] Problem with 64-bit shared libraries?

52 views
Skip to first unread message

Alex Rubinsteyn

unread,
Nov 30, 2011, 4:38:41 PM11/30/11
to Caml List
Hi,

I'd like to package up some OCaml code (along with C bindings) as a shared
library. However, I'm encountering the following linker error:

/usr/bin/ld: /usr/lib/ocaml/libasmrun.a(startup.o): relocation R_X86_64_32
against `.rodata.str1.1' can not be used when making a shared object;
recompile with -fPIC
/usr/lib/ocaml/libasmrun.a: could not read symbols: Bad value

Do I have to recompile OCaml with -fPIC to put the runtime inside a shared
library?

--
Caml-list mailing list. Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Jeff Meister

unread,
Nov 30, 2011, 8:00:43 PM11/30/11
to Alex Rubinsteyn, Caml List
Yes, you should recompile OCaml with -fPIC. I ran into the same problem a
few months ago, and noticed this bit of information in the INSTALL file:

On a Linux x86/64 bits host, to build the run-time system in PIC mode
(enables putting the runtime in a shared library,
at a small performance cost):
./configure -cc "gcc -fPIC" -aspp "gcc -c -fPIC"


On Wed, Nov 30, 2011 at 1:37 PM, Alex Rubinsteyn
<alex.ru...@gmail.com>wrote:

Alex Rubinsteyn

unread,
Dec 1, 2011, 2:00:01 PM12/1/11
to Jeff Meister, Caml List
Thanks, I guess I'll recompile then. I notice, though, that there's a
libcamlrun_shared.so (for the bytecode runtime). Is there any reason we
don't also get libasmrun_shared.so by default?
0 new messages