Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Having problems with '-rpath' or '-rpath-link' to ocamlopt
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Narayanan Krishnamurthy <Narayanan.Krishnamurthy@m...>
Subject: [Caml-list] Having problems with '-rpath' or '-rpath-link' to ocamlopt

All the following discussions pertain to SunOS 5.8
the gnu linker 'ld 2.9.1', the gcc compiler 'gcc 2.95.2' and
ocaml 3.06.

I have two versions of the PCRE "C"
libraries. Let us say that the locations
of the "C" libraries are as follows.

a) v1.0 : /usr/local/lib/
b) v2.0 : /mylocal/

I've built the ocaml pcre package (5.02: pcre.cmxa and pcre.cma) 
using the "C" v2.0 shared library /mylocal/
I have pcre.cmxa in my current working directory.

With my LD_LIBRARY_PATH set as
LD_LIBRARY_PATH = /lib:/usr/lib:/usr/local/lib
I now run
a) ocamlopt -o myexec pcre.cmxa myexec.o \
     -cclib -rpath/mylocal -cclib -lpcre

and find that 'myexec' has the /usr/local/lib/
as the run-time shared library instead of
/mylocal/ (I use 'ldd' on 'myexec')

I tried the following as well and am unable to get
ocamlopt to link in the run-time library /mylocal/

b) ocamlopt -o myexec pcre.cmxa myexec.o \
     -cclib -R/mylocal -cclib -lpcre
c) ocamlopt -o myexec pcre.cmxa myexec.o \
     -cclib -rpath-link/mylocal -cclib -lpcre

If I unset my LD_LIBRARY_PATH, everything works fine
and the correct library is linked in (I tried
'strings pcre.cmxa' and see the path /mylocal hard-coded
in there).
it works fine.

It seems like I am unable to override the LD_LIBRARY_PATH
environment variable using '-rpath' for the linker.
So, what am I doing wrong with the '-rpath' or '-rpath-link'
commands that I'm passing through 'ocamlopt'?
Any information would be greatly appreciated.

Narayanan Krishnamurthy (Nari)

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: