From owner-freebsd-emulation@FreeBSD.ORG Wed Aug 23 18:31:55 2006 Return-Path: X-Original-To: freebsd-emulation@FreeBSD.org Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 78BBE16A4E5 for ; Wed, 23 Aug 2006 18:31:55 +0000 (UTC) (envelope-from jes@jes-2.demon.nl) Received: from post-23.mail.nl.demon.net (post-23.mail.nl.demon.net [194.159.73.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 98BAA43D7D for ; Wed, 23 Aug 2006 18:31:47 +0000 (GMT) (envelope-from jes@jes-2.demon.nl) Received: from jes-1.demon.nl ([83.160.144.201]:12937 helo=jes-2.demon.nl) by post-23.mail.nl.demon.net with esmtp (Exim 4.51) id 1GFxVz-000O3C-3L; Wed, 23 Aug 2006 18:31:47 +0000 Received: from jes by jes-2.demon.nl with local (Exim 4.34 (FreeBSD)) id 1GFxVy-0009GL-RX; Wed, 23 Aug 2006 20:31:46 +0200 Date: Wed, 23 Aug 2006 20:31:46 +0200 From: Jim Segrave To: Alexander Leidinger Message-ID: <20060823183146.GD14759@jes-2.demon.nl> References: <200608220730.k7M7UMbm036179@freefall.freebsd.org> <68219662@bsam.ru> <20060822155206.wnofa44ha8s0sok0@netchild.homeip.net> <59246999@serv3.int.kfs.ru> <20060822180941.h3kwmrrdycwwwswo@netchild.homeip.net> <20060822214853.GA83595@jes-2.demon.nl> <20060823101053.xhmqal89c8wk408c@netchild.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060823101053.xhmqal89c8wk408c@netchild.homeip.net> User-Agent: Mutt/1.4.2.2i Organisation: Demon Netherlands Cc: freebsd-emulation@FreeBSD.org Subject: Re: ports/102034: emulators/linux_base-fc4 library problems with RELENG_6_1 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: jes@jes-2.demon.nl List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2006 18:31:55 -0000 On Wed 23 Aug 2006 (10:10 +0200), Alexander Leidinger wrote: > Quoting Jim Segrave (from Tue, 22 Aug 2006 > 23:48:54 +0200): > > >As it happens, nothing was referring to /usr/lib/libpthread.so.0, so I > >deleted it and now linux ports behave normally, for which I am most > >appreciative. > > > >I am puzzled though - /usr/compat/linux/lib/libpthread.0 is installed > >as part of linux_base-fc4 and is symlinked to > >/usr/compat/linux/lib/libpthread-2.3.6.so > > > >I thought that the linux emulation, barring abuse of LD_PATH or > >LD_PRELOAD would always try to resolve out of /compat/linux/lib or > >/compat/linux/usr/lib, so the existence of a FreeBSD libptread.0 would > >not have any effect. Why would a linux app ever even see the FreeBSD > >library of the same name? > > Because it doesn't abuse LD_* stuff. :-) > > If the kernel detects a Linux-brand (man brandelf) of an ELF > executable, it uses the linux-compatibility syscall table instead of > the FreeBSD native syscall table. The linux syscalls which do access > files first prefix the absolute path of files with /compat/linux. If > this lookup is successful, everything is ok. If not, the file without > a /compat/linux prefix is looked up (most probably a FreeBSD native > one). For looking up libs, you also have to take the search order of > library directories into account. libpthread is in /lib for FC4 and in > /usr/lib for FreeBSD. It seems FC4 (or our port) is searching in > /usr/lib before searching in /lib. So it first finds the old FreeBSD > native one, instead of the linux one. That sounds like this sort of problem is going to recur with other libraries in the future. I think you have to look in all the /compat/linux hiding places for libraries before looking in the rest of the world or you've got an accident waiting to happen :) -- Jim Segrave jes@jes-2.demon.nl