From owner-freebsd-questions@FreeBSD.ORG Tue Feb 15 12:15:11 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3F07F16A4CE for ; Tue, 15 Feb 2005 12:15:11 +0000 (GMT) Received: from mail.freebsd-corp-net-guide.com (mail.freebsd-corp-net-guide.com [65.75.192.90]) by mx1.FreeBSD.org (Postfix) with ESMTP id BF0E743D1D for ; Tue, 15 Feb 2005 12:15:10 +0000 (GMT) (envelope-from tedm@toybox.placo.com) Received: from tedwin2k (nat-rtr.freebsd-corp-net-guide.com [65.75.197.130]) j1FCF8j49169; Tue, 15 Feb 2005 04:15:09 -0800 (PST) (envelope-from tedm@toybox.placo.com) From: "Ted Mittelstaedt" To: "Maicon Stihler" , Date: Tue, 15 Feb 2005 04:15:08 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478 In-Reply-To: <67f5afb90502141017bf2e58a@mail.gmail.com> Importance: Normal Subject: RE: problem with GCC search path on FreeBSD5.3 AMD64 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Feb 2005 12:15:11 -0000 > -----Original Message----- > From: owner-freebsd-questions@freebsd.org > [mailto:owner-freebsd-questions@freebsd.org]On Behalf Of Maicon Stihler > Sent: Monday, February 14, 2005 10:18 AM > To: freebsd-questions@freebsd.org > Subject: problem with GCC search path on FreeBSD5.3 AMD64 > > > Hi, > > I installed FreeBSD 5.3 for AMD64 on my computer following the > standard procedure. To my surprise, when I tried to compile new > packages I find out that /usr/local/lib and /usr/local/include wasnt > on gcc's search path. As a workaround I compiled the packages with > CFLAGS="-B /usr/local/lib -I/usr/local/include". > > As far as I know, and the gcc info pages seems to agree, these too > directories should be in the default search path. > this isn't a gcc problem. > Is someone else experiencing this same problem? > Is there a way to add these directories to the default path without > resorting to these env variables or runtime switches? > ldconfig However, most packages use the -R and -L flags to the linker if they are linking to a shared library in /usr/local/lib because not all UNIX systems provide a ldconfig-type utility, and it is more portable to hard code it. Note that if your generating a library, don't use either of these flags. Libraries that depend on other dynamic libraries (such as openssl's libraries that can be linked to zlib) at runtime should confine themselves to only linking to libraries in /usr/lib (or build static) There are pros and cons to using the hints file that ldconfig generates vs compiling in the runtime location of the libraries. Neither is better than the other. Another trick used is to softlink the library from /usr/local/lib to /usr/lib The LD_LIBRARY_PATH variable should never be used except for testing Ted