Date: Wed, 23 Aug 2006 20:31:46 +0200 From: Jim Segrave <jes@jes-2.demon.nl> To: Alexander Leidinger <Alexander@Leidinger.net> Cc: freebsd-emulation@FreeBSD.org Subject: Re: ports/102034: emulators/linux_base-fc4 library problems with RELENG_6_1 Message-ID: <20060823183146.GD14759@jes-2.demon.nl> In-Reply-To: <20060823101053.xhmqal89c8wk408c@netchild.homeip.net> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed 23 Aug 2006 (10:10 +0200), Alexander Leidinger wrote: > Quoting Jim Segrave <jes@jes-2.demon.nl> (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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060823183146.GD14759>