From: Alain Frisch <alain@frisch.fr>
To: Jonathan Marchand <jonathlela@gmail.com>
Cc: Caml mailing list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Compiling a shared library with amd64
Date: Wed, 23 Jul 2008 10:24:18 +0200 [thread overview]
Message-ID: <4886EAB2.9000101@frisch.fr> (raw)
In-Reply-To: <9a3dee4b0807230117m102363a1ubca8ed069e15db41@mail.gmail.com>
Jonathan Marchand wrote:
> I got rid of the complains with 3.10.2 version (for libasmrun.a only).
> In the CVS version, if I compile by adding -fPIC in *COMOPTS, I still
> have some errors with libasmrun.a:
>
> Here is the complete build trace for rocaml (I use it as an exemple as
> it the same problem with the library I'm making and it is freely
> available):
>
> cc -I. -I/usr/lib/ruby/1.8/x86_64-linux
> -I/usr/lib/ruby/1.8/x86_64-linux -I. -fPIC -fno-strict-aliasing -g
> -g -O2 -fPIC -c foo_rocaml_wrapper.c
> ocamlc -c -I +camlp4 -pp "camlp4orf -loc _loc" pa_rocaml.ml
> ocamlopt.opt -c -pp 'camlp4o -I . pa_rocaml.cmo' rubyOCamlUtil.ml
> ocamlopt.opt -output-obj -o foo_rocaml_runtime.o nums.cmxa
> rubyOCamlUtil.cmx rubyOCamlUtil.o
> cc -shared -o foo.so foo_rocaml_wrapper.o -L. -L/usr/lib -L.
> -rdynamic -Wl,-export-dynamic foo_rocaml_runtime.o
> /usr/local/lib/ocaml/libasmrun.a /usr/local/lib/ocaml/libunix.a
> /usr/local/lib/ocaml/libnums.a -lruby1.8 -lpthread -ldl -lcrypt -lm
> -lc
> /usr/bin/ld: /usr/local/lib/ocaml/libasmrun.a(amd64.o): relocation
> R_X86_64_PC32 against `caml_last_return_address' can not be used when
> making a shared object; recompile with -fPIC
> /usr/bin/ld: final link failed: Bad value
> collect2: ld returned 1 exit status
> make: *** [foo.so] Erreur 1
>
> I don't know how to compile every libraries with -fPIC. I tried to add
> more or less randomly the -fPIC flag in the Makefiles, but they are a
> bit obscure to me.
> The best I achieved is printed above.
Now the error is in code written directly in assembler (asmrun/amd64.S).
Unfortunately, I don't think there is an easy solution here: this code
should be adapted to be position-independent.
-- Alain
prev parent reply other threads:[~2008-07-23 8:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-22 9:08 Jonathan Marchand
2008-07-22 9:16 ` [Caml-list] " Alain Frisch
2008-07-23 7:08 ` Jonathan Marchand
2008-07-23 7:16 ` Alain Frisch
[not found] ` <9a3dee4b0807230117m102363a1ubca8ed069e15db41@mail.gmail.com>
2008-07-23 8:24 ` Alain Frisch [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=4886EAB2.9000101@frisch.fr \
--to=alain@frisch.fr \
--cc=caml-list@yquem.inria.fr \
--cc=jonathlela@gmail.com \
/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