Version française
Home     About     Download     Resources     Contact us    
Browse thread
On Building 64-bit shared libraries
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eric Hielscher <hielscher@g...>
Subject: On Building 64-bit shared libraries
A while back I asked the list about building 64-bit shared libraries.
My co-worker and I found a solution that seems to work.  I'm not sure
exactly where to insert -fPIC, so I do it in two places.  The steps
for getting it to work on an apt-enabled Linux for us are:

1) sudo apt-get remove ocaml

2)Get dependencies: sudo apt-get build-dep ocaml

3) Some misc. tools I think you need to build .deb files: sudo apt-get
install devscripts

4) sudo apt-get source ocaml

5) cd ocaml-3.11.1
6) cd asmrun
7) edit Makefile, adding "-fPIC" to CFLAGS
8) CFLAGS_APPEND=-fPIC
9) cd ..
10) sudo dpkg-buildpackage -uc -us -b
11) cd ..
12) Install new ocaml: sudo dpkg -i *.deb

13) ocamlopt -output-obj -o a.o A.ml
14) ocamlopt -ccopt -fPIC -o B.o B.c
15) ocamlopt -ccopt -shared -ccopt -Wl,-Bsymbolic B.o A.cmx -o libC.so

Now you have a shared library libC.so to which you can link your programs.

Hope that helps someone,
-- 
Eric Hielscher

"Het zal me worst wezen."

http://ehielscher.org