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? 

On Wed, Nov 30, 2011 at 8:00 PM, Jeff Meister <nanaki@gmail.com> wrote:
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.rubinsteyn@gmail.com> wrote:
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?