1.\" 2.\" Copyright (c) 1993 Paul Kranenburg 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 3. All advertising materials mentioning features or use of this software 14.\" must display the following acknowledgement: 15.\" This product includes software developed by Paul Kranenburg. 16.\" 3. The name of the author may not be used to endorse or promote products 17.\" derived from this software without specific prior written permission 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29.\" 30.\" $Id$ 31.\" 32.Dd October 3, 1993 33.Dt LDCONFIG 8 34.Os FreeBSD 35.Sh NAME 36.Nm ldconfig 37.Nd configure the shared library cache 38.Sh SYNOPSIS 39.Nm ldconfig 40.Op Fl mrsv 41.Op Fl f Ar hints_file 42.Op Ar directory Ar ... 43.Sh DESCRIPTION 44.Nm 45is used to prepare a set of 46.Dq hints 47for use by the run-time linker 48.Xr ld.so 1 49to facilitate quick lookup of shared libraries available in multiple 50directories. It scans a set of built-in system directories and any 51.Ar directories 52specified on the command line (in the given order) looking for shared 53libraries and stores the results in the file 54.Pa /var/run/ld.so.hints 55to forestall the overhead that would otherwise result from the 56directory search operations 57.Xr ld.so 1 58would have to perform to load the required shared libraries. 59.Pp 60The shared libraries so found will be automatically available for loading 61if needed by the program being prepared for execution. This obviates the need 62for storing search paths within the executable. 63.Pp 64The 65.Ev LD_LIBRARY_PATH 66environment variable can be used to override the use of 67directories (or the order thereof) from the cache or to specify additional 68directories where shared libraries might be found. 69.Ev LD_LIBRARY_PATH 70is a 71.Sq \: 72separated list of directory paths which are searched by 73.Xr ld.so 1 74when it needs to load a shared library. It can be viewed as the run-time 75equivalent of the 76.Fl L 77switch of 78.Xr ld 1 . 79.Pp 80.Nm Ldconfig 81is typically run as part of the boot sequence. 82.Pp 83The following options recognized by 84.Nm ldconfig: 85.Bl -tag -width indent 86.It Fl f Ar hints_file 87Read and/or update the specified hints file, instead of 88.Pa /var/run/ld.so.hints . 89This option is provided primarily for testing. 90.It Fl m 91Instead of replacing the contents of the hints file 92with those found in the directories specified, 93.Dq merge 94in new entries. 95Directories recorded in the hints file by previous runs of 96.Nm 97are also rescanned for new shared libraries. 98.It Fl r 99List the current contents of the hints file 100on the standard output. The hints file is not modified. 101.It Fl s 102Do not scan the built-in system directory 103.Pq Dq /usr/lib 104for shared libraries. 105.It Fl v 106Switch on verbose mode. 107.Sh Security 108Special care must be taken when loading shared libraries into the address 109space of 110.Ev set-user-Id 111programs. Whenever such a program is run, 112.Nm ld.so 113will only load shared libraries from the hints 114file. In particular, the 115.Ev LD_LIBRARY_PATH 116is not used to search for libraries. Thus, the role of ldconfig is dual. In 117addition to building a set of hints for quick lookup, it also serves to 118specify the trusted collection of directories from which shared objects can 119be safely loaded. It is presumed that the set of directories specified to 120.Nm ldconfig 121are under control of the system's administrator. 122.Sh FILES 123.Pa /var/run/ld.so.hints 124.Sh SEE ALSO 125.Xr ld 1 , 126.Xr link 5 127.Sh HISTORY 128A 129.Nm 130utility first appeared in SunOS 4.0, it appeared in its current form 131in FreeBSD 1.1. 132