From owner-freebsd-amd64@FreeBSD.ORG Fri Aug 1 23:13:55 2008 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D7E1106567D for ; Fri, 1 Aug 2008 23:13:55 +0000 (UTC) (envelope-from brucec@muon.cran.org.uk) Received: from muon.cran.org.uk (muon.cran.org.uk [IPv6:2001:41c8:1:548a::2]) by mx1.freebsd.org (Postfix) with ESMTP id 2D6D18FC16 for ; Fri, 1 Aug 2008 23:13:55 +0000 (UTC) (envelope-from brucec@muon.cran.org.uk) Received: by muon.cran.org.uk (Postfix, from userid 1000) id 5489630114; Sat, 2 Aug 2008 00:13:53 +0100 (BST) Date: Sat, 2 Aug 2008 00:13:53 +0100 From: bruce@cran.org.uk To: Nate Eldredge Message-ID: <20080801231352.GA4352@muon.cran.org.uk> References: <4891F3F3.8090608@telenix.org> <20080731195527.GT1359@server.vk2pj.dyndns.org> <489243B0.80307@telenix.org> <20080731234107.GA99946@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) Cc: freebsd-amd64@freebsd.org Subject: Re: app programming on freebsd amd64 X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2008 23:13:55 -0000 On Thu, Jul 31, 2008 at 05:17:14PM -0700, Nate Eldredge wrote: > It's not really missing completely though. Just that gcc isn't set up to > look for it in the right place. > > [...] > > So it's still looking for things in /usr/lib when it should use > /usr/lib32. We can call ld directly and give it the right things: > > nate@vulcan:/tmp$ /usr/bin/ld --eh-frame-hdr -m elf_i386_fbsd -V > -dynamic-linker /libexec/ld-elf32.so.1 -o h /usr/lib32/crt1.o > /usr/lib32/crti.o /usr/lib32/crtbegin.o -L/usr/lib32 h.o -lgcc --as-needed > -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed > /usr/lib32/crtend.o /usr/lib32/crtn.o > GNU ld version 2.15 [FreeBSD] 2004-05-23 > Supported emulations: > elf_i386_fbsd > elf_x86_64_fbsd > nate@vulcan:/tmp$ file ./h > ./h: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), for > FreeBSD 7.0 (700055), dynamically linked (uses shared libs), > FreeBSD-style, not stripped > nate@vulcan:/tmp$ ./h > Hello world! > > It might be that there is some set of options to gcc itself that would > make the right thing happen here without calling ld directly. More likely > someone would have to write a new specs file. But that's a relatively > minor issue; the guts are there. > I don't know if it works for more complex programs, but passing -B/usr/lib32 to gcc certainly works for simple apps - it searches there for the libraries before falling back to the standard locations if it can't find them there. -- Bruce Cran