caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Compiling a shared library on AMD64
@ 2005-12-13 22:10 Erik Bourget
  2005-12-13 22:34 ` [Caml-list] " Stefano Zacchiroli
  2005-12-14 16:45 ` Xavier Leroy
  0 siblings, 2 replies; 5+ messages in thread
From: Erik Bourget @ 2005-12-13 22:10 UTC (permalink / raw)
  To: caml-list


I'm having trouble building a shared library using components from the ocaml
standard library on my x86_64 box.  I built ocaml 3.09.0 with:
BYTECCCOMPOPTS=-fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC
NATIVECCCOMPOPTS=-Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC
NATIVECCPROFOPTS=-Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC
SUPPORTS_SHARED_LIBRARIES=true
BNG_ARCH=amd64

, but the standard library seems to still have some R_X86_64_32S relocations
in it.

I don't understand ELF very well so I'm kind of lost :) Can anyone give any
pointers?

- Erik

Story in transcript:

$ ocamlopt -ccopt "-fPIC -D_FILE_OFFSET_BITS=64 -D_REENTRANT" -fPIC -I /usr/lib/ocaml/site-packages/pcre -I /usr/local/lib/ocaml/site-lib/pcre -output-obj -fPIC -o camlcode.o unix.cmxa pcre.cmxa range_utils.cmx parser.cmx lexer.cmx memoize.cmx tinydns.cmx netmask.cmx admins.cmx netblocks.cmx evaluate.cmx range.cmx

$ ld -shared --whole-archive -o librange.so camlcode.o librange.o /usr/local/lib/ocaml/libunix.a /usr/local/lib/ocaml/libasmrun.a /usr/local/lib/ocaml/site-lib/pcre/libpcre_stubs.a /usr/lib64/libm.a /usr/lib64/libpcre.a /usr/lib64/libdl.a

ld: camlcode.o: relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC

$ objdump -r camlcode.o | grep R_X86_64_32S

000000000000377d R_X86_64_32S      .rodata
0000000000003be6 R_X86_64_32S      .rodata+0x000000000000008
... (20 more .rodata, but only .rodata, nothing else)

erik:~/src/packages/ocaml/ocaml-3.09.0/stdlib$ objdump -r scanf.o | grep 64_32
00000000000021de R_X86_64_32S      .rodata
0000000000002a53 R_X86_64_32S      .rodata+0x00000000000003e0
... ( more .rodata)

The pcre.o used to build pcre.cmxa also has some rodata's in it.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-12-14 18:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-13 22:10 Compiling a shared library on AMD64 Erik Bourget
2005-12-13 22:34 ` [Caml-list] " Stefano Zacchiroli
2005-12-13 23:45   ` Erik Bourget
2005-12-14 16:45 ` Xavier Leroy
2005-12-14 17:56   ` Erik Bourget

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).