From owner-freebsd-questions@FreeBSD.ORG Fri Oct 24 01:03:56 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D1391065673 for ; Fri, 24 Oct 2008 01:03:56 +0000 (UTC) (envelope-from pisymbol@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.235]) by mx1.freebsd.org (Postfix) with ESMTP id E518B8FC12 for ; Fri, 24 Oct 2008 01:03:55 +0000 (UTC) (envelope-from pisymbol@gmail.com) Received: by rv-out-0506.google.com with SMTP id g9so1929237rvb.3 for ; Thu, 23 Oct 2008 18:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:mime-version:content-type:content-transfer-encoding :content-disposition; bh=Wk8aKVHIT6khd1hZv3rf0FVv14ACMOTvPFJkDtxWyKI=; b=KERq/yjuM1Y4UNuDG5uSu6RfdNwXvvsZVwOggkFOJ/WHB2Z6Mr3udv8ZKHNOAbDTyU pCqwyviLrO/Gol0MxneO/mb5uryu4rOkPBR9vQOTkT2f0jqLrDCFs9azEGiUAJap/CFa FIV5eBwr65+sgK/BE0ZuK1WNTyTIKRyKwpGo8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:mime-version:content-type :content-transfer-encoding:content-disposition; b=Ydr9QUYLGnGy+cL9qrPlpV1EmyICgh3zl63D6knQGUdUyY7HZdz/DD2oORe4GAwBCw ODa/Mltrv5Trdnjh9nJPjxxGjfh7z2bi/jt7hzo/B+ta7Y2Hr4UJfW/ujnc4jSNc613B 5znS49fNyKkFCj2BJmjQv2qH1NrK9pA631wlo= Received: by 10.140.172.20 with SMTP id u20mr782729rve.16.1224808266032; Thu, 23 Oct 2008 17:31:06 -0700 (PDT) Received: by 10.141.43.14 with HTTP; Thu, 23 Oct 2008 17:31:05 -0700 (PDT) Message-ID: <3c0b01820810231731s1b4d4659j7d1df8bf4abb229c@mail.gmail.com> Date: Thu, 23 Oct 2008 20:31:05 -0400 From: "Alexander Sack" To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Cc: FreeBSD Hackers Subject: Why does adding /usr/lib32 to LD_LIBRARY_PATH break 64-bit binaries? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2008 01:03:56 -0000 Hello: I have some weird behavior I'm trying to figure out and was wondering if someone can point me in the right direction. I'm running a FreeBSD 6.1-RELEASE-amd64 machine. If I add /usr/lib32 to my LD_LIBRARY_PATH it breaks all of my binaries on my 64-bit machine. For example: [root@hagen ~]# file /bin/ls /bin/ls: ELF 64-bit LSB executable, AMD x86-64, version 1 (FreeBSD), dynamically linked (uses shared libs), stripped [root@hagen ~]# ldd /bin/ls /bin/ls: libutil.so.5 => /lib/libutil.so.5 (0x800630000) libncurses.so.6 => /lib/libncurses.so.6 (0x80073d000) libc.so.6 => /lib/libc.so.6 (0x800896000) [root@hagen ~]# ls -l /libexec/ total 306 -r-xr-xr-x 1 root wheel 163864 Aug 21 2007 ld-elf.so.1 -r-xr-xr-x 1 root wheel 146420 Aug 21 2007 ld-elf32.so.1 [root@hagen ~]# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/bin:/usr/lib:/usr/lib32:/usr/lib64 [root@hagen ~]# ls /libexec/ld-elf.so.1: /usr/lib32/libutil.so.5: unsupported file layout [root@hagen ~]# unset LD_LIBRARY_PATH [root@hagen ~]# ls (normal ls output) [root@hagen ~]# ls -l /usr/lib/libut* -r--r--r-- 1 root wheel 100518 Aug 21 2007 /usr/lib/libutil.a lrwxrwxrwx 1 root wheel 17 Sep 11 11:44 /usr/lib/libutil.so -> /lib/libutil.so.5 -r--r--r-- 1 root wheel 103846 Aug 21 2007 /usr/lib/libutil_p.a [root@hagen ~]# file /lib/libutil.so.5 /lib/libutil.so.5: ELF 64-bit LSB shared object, AMD x86-64, version 1 (FreeBSD), stripped I would ASSUME that rtld would look at my LD_LIBRARY_PATH and use /usr/lib to find libraries, not /usr/lib32. Why does it insist on picking /usr/lib32 when "/bin/ls" is CLEARLY a 64-bit binary? This doesn't make complete sense to me just yet. Someone I'm sure is going "don't do that" and I agree. The issue is I'm porting a library/framework (boost) and it creates a runtime LD_LIBRARY_PATH for its gcc toolchain with the above which breaks the build ROYALLY on FreeBSD 64-bit machine. I'm trying to come up with the right heuristic here. Any help would be much appreciated! Thanks! -aps