From: Wojciech Meyer <wojciech.meyer@googlemail.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] ocamlmklib fails with code compiled with ocamlopt -c
Date: Wed, 21 Mar 2012 18:40:25 +0000 [thread overview]
Message-ID: <wffwd1pzl2.fsf@gmail.com> (raw)
In-Reply-To: <20120321180213.GA1063@viper.local> ("Ricardo Catalinas \=\?utf-8\?Q\?Jim\=C3\=A9nez\=22's\?\= message of "Wed, 21 Mar 2012 19:02:13 +0100")
Ricardo Catalinas Jiménez <jimenezrick@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
prev parent reply other threads:[~2012-03-21 18:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-21 18:02 Ricardo Catalinas Jiménez
2012-03-21 18:40 ` Wojciech Meyer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=wffwd1pzl2.fsf@gmail.com \
--to=wojciech.meyer@googlemail.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox