From owner-freebsd-questions@FreeBSD.ORG Sat Feb 19 08:06:23 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 20E1716A4CE for ; Sat, 19 Feb 2005 08:06:23 +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 9604D43D53 for ; Sat, 19 Feb 2005 08:06:22 +0000 (GMT) (envelope-from tedm@toybox.placo.com) Received: from tedwin2k (nat-rtr.freebsd-corp-net-guide.com [65.75.197.130]) j1J86Jj68243; Sat, 19 Feb 2005 00:06:20 -0800 (PST) (envelope-from tedm@toybox.placo.com) From: "Ted Mittelstaedt" To: "Kris Kennaway" , "Maicon Stihler" Date: Sat, 19 Feb 2005 00:06:19 -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: <20050215213049.GA11287@xor.obsecurity.org> Importance: Normal cc: freebsd-questions@freebsd.org 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: Sat, 19 Feb 2005 08:06:23 -0000 > -----Original Message----- > From: owner-freebsd-questions@freebsd.org > [mailto:owner-freebsd-questions@freebsd.org]On Behalf Of Kris Kennaway > Sent: Tuesday, February 15, 2005 1:31 PM > To: Maicon Stihler > Cc: freebsd-questions@freebsd.org; Ted Mittelstaedt > Subject: Re: problem with GCC search path on FreeBSD5.3 AMD64 > > > On Tue, Feb 15, 2005 at 03:55:00PM -0300, Maicon Stihler wrote: > > > this isn't a gcc problem. > > Hm, maybe I used the wrong terms to define the situation. I > agree that > > its not gcc's fault, its some kind of (mis)configuration issue. > > Didn't you ask this question a few weeks ago? I certainly answered it > then. > > > > ldconfig > > > > I used ldconfig to generete te hints file, and then when I do a > > "ldconfig -r" all the libs I need appears there... the strange thing > > is that if I try to include them in my own programs it doesnt work. > > ldconfig is for the runtime linker, it's not used by gcc when linking > object files. > > > Im using the CFLAGS="-B /usr/local/lib -L/usr/local/include" as a > > workaround, but im searching for a more elegant way to solve this > > issue. > > Those flags look completely wrong. You want "-L /usr/local/lib -I > /usr/local/include" - either in CFLAGS, or otherwise passed into your > gcc commandline. > > This is the correct way to address the issue. > Kris, a lot of systems don't like the spaces, the more portable way to set those flags should be: "-L/usr/local/lib -I/usr/local/include" And this only sets it up for linking the binary, not runtime linking. He still needs to specify either "-R/usr/local/lib" to the linker (ld,) to get a binary that finds it's libraries, or use one of the other tricks (ldconfig, softlinks, etc.) gcc -B/usr/local/lib as near as I can tell makes gcc look for the linker in /usr/local/lib which as you observe is completely wrong. Ted