Ricardo Catalinas Jiménez <jimenezr...@gmail.com> writes:

> I found out the next issue when using the native compiler to generate a
> dynamic library from C:
>
>   $ ocamlopt -c foo.c
>   $ ocamlmklib -o foo foo.o
>   /usr/bin/ld: fsync.o: relocation R_X86_64_32 against `.rodata' can not
>   be used when making a shared object; recompile with -fPIC
>   fsync.o: could not read symbols: Bad value
>   collect2: ld returned 1 exit status
>
> But `man ocamlopt' reads:
>   -fPIC Generate position-independent machine code. This is the default.
>
> Anyway, I tried specifying manually `-fPIC' and it gave me the same
> error.
>
> But with `ocamlc -c' everything works as expected. Is this normal?

You have to use `-shared' command line option when compiling with ocamlopt.

- Wojciech


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

Reply via email to