Date: Thu, 1 Apr 2004 15:34:01 +1000 From: Edwin Groothuis <edwin@mavetju.org> To: Richard Bradley <rtb27@cam.ac.uk> Cc: freebsd-hackers@freebsd.org Subject: Re: ld can't find libraries Message-ID: <20040401053401.GA2166@k7.mavetju> In-Reply-To: <200403312312.23601.rtb27@cam.ac.uk> References: <200403312312.23601.rtb27@cam.ac.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 31, 2004 at 10:12:23PM +0000, Richard Bradley wrote: > I can't get ld to recognise some "so" libraries without using the -L option: Ldconfig is used for run-time loading of shared libraries. What you are doing here is the compilation (linking...) of the source to a executable. gcc (ld...) searches by default only for a couple of standard system directories (/usr/lib for example) and that's all. If it would search through other directories by default (for example /usr/local/lib), and your program was trying to link to a newer version of a library which is in a non-standard directory with an old one which was in /usr/local/lib, the program would never be able to get linked to the right one. Therefor, at compile (link...) time you have to specify explicitely in which order to search through which directories. For run-time loading you can use ldconfig or LD_LIBRARY_PATH to specify where your libraries are. Edwin -- Edwin Groothuis | Personal website: http://www.mavetju.org edwin@mavetju.org | Weblog: http://weblog.barnet.com.au/edwin/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040401053401.GA2166>