ports/102474: linux_base-fc-4_8 appears broken, does not allow to run Linux binaries

John E Hein jhein at timing.com
Thu Aug 24 23:10:36 UTC 2006


Boris Samorodov wrote at 02:28 +0400 on Aug 25, 2006:
 > Aha, /compat/linux/usr/bin/ldd is a script. Can't say for sure should
 > it work or not but something strange does exist:
 > -----
 >  24546 ktrace   RET   ktrace 0
 >  24546 ktrace   CALL  execve(0xbfbfe85e,0xbfbfe75c,0xbfbfe768)
 >  24546 ktrace   NAMI  "/compat/linux/usr/bin/ldd"
 >  24546 ktrace   NAMI  "/bin/sh"
 >  24546 ktrace   NAMI  "/libexec/ld-elf.so.1"
 >  24546 sh       RET   execve 0

                         ^^^^ you probably get something different if
                         you use linux_kdump?

As far as ldd goes, it calls ld-linux.so.2 (yes, the lib is
executable) which is a sym link to ld-2.3.6.so

file /compat/linux/lib/ld-2.3.6.so
/compat/linux/lib/ld-2.3.6.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped

Note the improper brandelf if it were to be run as an executable
(should be GNU/Linux, not SYSV).

You could copy ld-2.3.6.so to somewhere else, brandelf -t Linux it (I
wouldn't do that to the real /compat/linux/lib/ld-2.3.6.so), and tell
the ldd script to use that version.

It would probably be best to run the script with bash rather than
FreeBSD's sh.  I suspect there are bash-specific idioms in that
script.

I tried that and ld-2.3.6.so returns funky results (not surprising)...

/tmp/ld-2.3.6.so --verify /compat/linux/bin/bash ; echo $?
1


On a real linux box:

/lib/ld-2.3.6.so --verify /bin/bash ; echo status: $?
6
status: 0


To get /compat/linux/lib/ld-linux.so.2 (and thus
/compat/linux/usr/bin/ldd) working in the emulated environment would
probably take some hacking.  I vaguely recall this being discussed
before?


To the OP, why not just use native FreeBSD ldd?

ldd /compat/linux/bin/bash
/compat/linux/bin/bash:
        libtermcap.so.2 => /lib/libtermcap.so.2 (0x28109000)
        libdl.so.2 => /lib/libdl.so.2 (0x2810e000)
        libc.so.6 => /lib/obsolete/linuxthreads/libc.so.6 (0x28112000)
        /lib/ld-linux.so.2 (0x280e9000)


More information about the freebsd-emulation mailing list