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