• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/ap/gpl/timemachine/db-4.7.25.NC/docs/ref/build_unix/
1<!--$Id: shlib.so,v 10.19 2006/10/05 01:06:05 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB Reference Guide: Dynamic shared libraries</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<a name="2"><!--meow--></a>
12<table width="100%"><tr valign=top>
13<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Building Berkeley DB for UNIX/POSIX systems</dl></b></td>
14<td align=right><a href="../build_unix/install.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../build_unix/test.html"><img src="../../images/next.gif" alt="Next"></a>
15</td></tr></table>
16<p align=center><b>Dynamic shared libraries</b></p>
17<p><b>Warning</b>: the following information is intended to be generic and
18is likely to be correct for most UNIX systems.  Unfortunately, dynamic
19shared libraries are not standard between UNIX systems, so there may be
20information here that is not correct for your system.  If you have
21problems, consult your compiler and linker manual pages, or your system
22administrator.</p>
23<p>The Berkeley DB dynamic shared libraries are created with the name
24libdb-<b>major</b>.<b>minor</b>.so, where <b>major</b> is
25the major version number and <b>minor</b> is the minor version number.
26Other shared libraries are created if Java and Tcl support are enabled:
27specifically, libdb_java-<b>major</b>.<b>minor</b>.so
28and libdb_tcl-<b>major</b>.<b>minor</b>.so.</p>
29<p>On most UNIX systems, when any shared library is created, the linker
30stamps it with a "SONAME".  In the case of Berkeley DB, the SONAME
31is libdb-<b>major</b>.<b>minor</b>.so.  It is important to
32realize that applications linked against a shared library remember the
33SONAMEs of the libraries they use and not the underlying names in the
34filesystem.</p>
35<p>When the Berkeley DB shared library is installed, links are
36created in the install lib directory so that
37libdb-<b>major</b>.<b>minor</b>.so,
38libdb-<b>major</b>.so, and libdb.so all refer to the
39same library.  This library will have an SONAME of
40libdb-<b>major</b>.<b>minor</b>.so.</p>
41<p>Any previous versions of the Berkeley DB libraries that are
42present in the install directory (such as libdb-2.7.so or
43libdb-2.so) are left unchanged.  (Removing or moving old shared
44libraries is one drastic way to identify applications that have been
45linked against those vintage releases.)</p>
46<p>Once you have installed the Berkeley DB libraries, unless they are
47installed in a directory where the linker normally looks for shared
48libraries, you will need to specify the installation directory as part
49of compiling and linking against Berkeley DB.  Consult your system
50manuals or system administrator for ways to specify a shared library
51directory when compiling and linking applications with the
52Berkeley DB libraries.  Many systems support environment variables
53(for example, LD_LIBRARY_PATH or LD_RUN_PATH), or system configuration
54files (for example, /etc/ld.so.conf) for this purpose.</p>
55<p><b>Warning</b>: some UNIX installations may have an already existing
56<b>/usr/lib/libdb.so</b>, and this library may be an incompatible
57version of Berkeley DB.</p>
58<p>We recommend that applications link against libdb.so (for example,
59using -ldb).  Even though the linker uses the file named
60libdb.so, the executable file for the application remembers the
61library's SONAME (libdb-<b>major</b>.<b>minor</b>.so).  This
62has the effect of marking the applications with the versions they need
63at link time.  Because applications locate their needed SONAMEs when
64they are executed, all previously linked applications will continue to
65run using the library they were linked with, even when a new version of
66Berkeley DB is installed and the file <b>libdb.so</b>
67is replaced with a new version.</p>
68<p>Applications that know they are using features specific to a particular
69Berkeley DB release can be linked to that release.  For example, an
70application wanting to link to Berkeley DB major release "3" can link
71using -ldb-3, and applications that know about a particular
72minor release number can specify both major and minor release numbers;
73for example, -ldb-3.5.</p>
74<p>If you want to link with Berkeley DB before performing library
75installation, the "make" command will have created a shared library
76object in the <b>.libs</b> subdirectory of the build directory, such
77as <b>build_unix/.libs/libdb-major.minor.so</b>.  If you want
78to link a file against this library, with, for example, a major number
79of "3" and a minor number of "5", you should be able to do something
80like the following:</p>
81<blockquote><pre>cc -L BUILD_DIRECTORY/.libs -o testprog testprog.o -ldb-3.5
82env LD_LIBRARY_PATH="BUILD_DIRECTORY/.libs:$LD_LIBRARY_PATH" ./testprog</pre></blockquote>
83<p>where <b>BUILD_DIRECTORY</b> is the full directory path to the directory
84where you built Berkeley DB.</p>
85<p>The libtool program (which is configured in the build directory) can be
86used to set the shared library path and run a program.  For example,
87the following runs the gdb debugger on the db_dump utility after setting
88the appropriate paths:</p>
89<blockquote><pre>libtool gdb db_dump</pre></blockquote>
90<p>Libtool may not know what to do with arbitrary commands (it is hardwired
91to recognize "gdb" and some other commands).  If it complains the mode
92argument will usually resolve the problem:</p>
93<blockquote><pre>libtool --mode=execute my_debugger db_dump</pre></blockquote>
94<p>On most systems, using libtool in this way is exactly equivalent to
95setting the LD_LIBRARY_PATH environment variable and then executing the
96program.  On other systems, using libtool has the virtue of knowing about
97any other details on systems that don't behave in this typical way.</p>
98<table width="100%"><tr><td><br></td><td align=right><a href="../build_unix/install.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../build_unix/test.html"><img src="../../images/next.gif" alt="Next"></a>
99</td></tr></table>
100<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
101</body>
102</html>
103