ports/102034: emulators/linux_base-fc4 library problems with RELENG_6_1

Alexander Leidinger Alexander at Leidinger.net
Wed Aug 23 08:10:51 UTC 2006


Quoting Jim Segrave <jes at 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.

Bye,
Alexander.

-- 
Acid absorbs 47 times its own weight in excess Reality.

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID = 72077137



More information about the freebsd-emulation mailing list