From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 31 21:34:06 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8FFCA16A4CE for ; Wed, 31 Mar 2004 21:34:06 -0800 (PST) Received: from mailout2.barnet.com.au (mailout2.barnet.com.au [218.185.88.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 559CB43D1D for ; Wed, 31 Mar 2004 21:34:06 -0800 (PST) (envelope-from edwin@mavetju.org) Received: by mailout2.barnet.com.au (Postfix, from userid 27) id 756D8AA6259; Thu, 1 Apr 2004 15:34:03 +1000 (EST) X-Viruscan-Id: <406BA9CA00007347AE1187@BarNet> Received: from mail2-auth.barnet.com.au (localhost [127.0.0.1]) by mail2.barnet.com.au (Postfix) with ESMTP id 149D4B29D19; Thu, 1 Apr 2004 15:34:02 +1000 (EST) Received: from k7.mavetju (unknown [10.10.12.2]) by mail2-auth.barnet.com.au (Postfix) with ESMTP id D8AEA1930A; Thu, 1 Apr 2004 15:34:01 +1000 (EST) Received: by k7.mavetju (Postfix, from userid 1001) id 612A261D1; Thu, 1 Apr 2004 15:34:01 +1000 (EST) Date: Thu, 1 Apr 2004 15:34:01 +1000 From: Edwin Groothuis To: Richard Bradley Message-ID: <20040401053401.GA2166@k7.mavetju> Mail-Followup-To: Edwin Groothuis , Richard Bradley , freebsd-hackers@freebsd.org References: <200403312312.23601.rtb27@cam.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200403312312.23601.rtb27@cam.ac.uk> User-Agent: Mutt/1.4.2.1i cc: freebsd-hackers@freebsd.org Subject: Re: ld can't find libraries X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2004 05:34:06 -0000 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/