From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id CAA15833; Tue, 23 Apr 2002 02:43:49 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id CAA15909 for ; Tue, 23 Apr 2002 02:43:48 +0200 (MET DST) Received: from favie.faith.gr.jp (favie.faith.gr.jp [61.127.175.250]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g3N0hkj05569 for ; Tue, 23 Apr 2002 02:43:47 +0200 (MET DST) Received: from localhost (dhcp7.faith.gr.jp [192.168.1.17]) by favie.faith.gr.jp (8.9.3/8.9.3) with ESMTP id JAA30615; Tue, 23 Apr 2002 09:43:32 +0900 To: skaller@ozemail.com.au Cc: rnyberg@it.su.se, caml-list@inria.fr Subject: Re: [Caml-list] shared libraries [pcre-ocaml] In-Reply-To: <3CC472A7.5070901@ozemail.com.au> References: <20020422103046.B21430@gromit.it.su.se> <3CC472A7.5070901@ozemail.com.au> X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20020423094308M.garrigue@kurims.kyoto-u.ac.jp> Date: Tue, 23 Apr 2002 09:43:08 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: John Max Skaller > Richard Nyberg wrote: > > >Hello I've some problems with ocaml and shared libraries. I'm running > >a recent FreeBSD-4-STABLE and have ocaml 3.04 installed from ports. > > > >pcre-ocaml is built with shared libraries and is installed in > >/usr/local/lib/ocaml/site-lib/pcre > > > >If I use ocamlopt to compile everything is fine but when I use ocamlc > >the following error occurs. > > > >----------compiling > ># ocamlc -o myprog -I +site-lib/netstring -I +site-lib/pcre \ > > unix.cma pcre.cma netstring.cma myprog.ml > > > >Error on dynamically loaded library: Shared object "libpcre.so.0" not found > >---------- > > > >I ran truss to see the syscalls made by ocamlc (relevant bit below) and > >to me it seems as if it finds dllpcre.so but not libpcre.so.0 on which > >dllpcre.so depends. However if I run ldconfig to include pcre-ocaml's > >installation directory everything works just fine. > > > >So, should I have to use ldconfig or is there something wrong? > > Argg... crappy unix hackery. The dynamic loader typically searches for > relative filenames in the ldconfig'd search path, augmented by LD_PATH > environment variable. Absolute filenames just get opened directly. > > You can see below that ocaml is manually stat'ing dllpcre.so in places > it knows about before doing a dlopen on an absolute filename. > Unfortunately, it depends on another shared lib, and ld is > searching for that by itself. > > It doesn't find it, since /usr/local/ocaml/site-lib/pcre isn't on the > ldconfig path. > This suggests the binding to dllpcre.so.0 installed in dllpcre.so is a > relative > filename. So does the ld.conf file above .. and if you run ldconfig on that, > of course now the load works. > > Running ldconfig on the ld.conf file will work. > Another solution is simply to install dllpcre.so.0 in /usr/local/lib. > Another is to put a symbolic link there. None of these solutions is > very good .. Almost correct answer: the problem is of course with libpcre.so.0, not dllpcre.so. So if you put libpcre.so.0 in any place where the system loader can find it (like /usr/local/lib, but also any directory in LD_LIBRARY_PATH), things will work smooth. More basically, I would say that pcre-ocaml is not packaged correctly: for this kind of use, either the code of libpcre.so should be included in dllcpre.so (not too hard), or libcpre.so.0 should be installed to a public directory. Unfortunately the system loader does not provide any interface to change the load path cleanly. Best regards, Jacques Garrigue ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners