Re: Multiarch on kFreeBSD?
(note i am not subscribed to debian-bsd at the moment, please CC me.)
On 2 September 2013 12:09, Steven Chamberlain <firstname.lastname@example.org> wrote:
> On 02 September, 2013 09:03AM, Dmitrijs Ledkovs wrote:
>> Given the excellent multiarch implementation on Debian and sophisticated Linux Emulation Layer on FreeBSD kernel, I was half expecting the following to work:
>> on kFreeBSD enable linux i386/amd64 repository
>> apt-get install hello:i386
>> $ hello
>> But unfortunately this confused kFreeBSD, since it didn't find ELF tags and linker didn't seem to load the right libraries any more =( Not sure if this issue has been raised before, but I think it would be awesome if FreeBSD Linux Emulation Layer worked transparently on Debian/kFreeBSD multiarch system.
> Probably you are the first to try this. I had slight success just now
> with mksh-static built for linux-i386:
> # brandelf util from package freebsd-buildutils
> bash-4.2$ freebsd-brandelf -t Linux mksh-static
> bash-4.2$ ./mksh-static
> $ echo hello
> $ exit
Interesting. Ideally on kFreeBSD thought we shouldn't require branding
the ELFs, as there should be other fields available to distinguish
between linux & kFreeBSD debian ELF's. Given the significant amount of
3rd party software for Debian like linux port, requiring branding the
ELF is not the best solution for Debian, instead we should do best
attempt at detecting kFreeBSD binaries and fallback to debian/linux
binaries. Linking against libc.so.6 is one crude giveaway ;-) since on
kFreeBSD it's libc.so.0.1. But we should come up with something better
than that detection. Even if that means patching kFreeBSD kernel to
support debian style Linux ELFs.
> Although, the shell seems buggy as it will hang after launching any
> executables (anything other than built-in functions).
> To run a dynamically-linked mksh, ld needs to be found at
> /compat/linux/lib/ld-linux.so.2. Maybe it is possible to create a full
> set of (sym)links inside /compat/linux/ to suit the paths used by multiarch?
Sounds ugly. We already have proper, non-colliding locations for i386
& amd64 ld-linux.so under /lib/$(DEB_HOST_MULTIARCH)/ it should be
possible to use those. I don't want to re-create multiarch libraries
in /compat/, instead a Debian system should correctly load libraries
from multi-arch locations.
> But the ld which ships with squeeze and wheezy fails with "FATAL: kernel
> too old" (we are emulating 2.6.16 syscalls). Probably a special one is
> needed, perhaps from the FreeBSD linux_base port?
Hm... =( no idea. Maybe we will need a recompile of ld for kfreebsd platforms =/
> If someone can get this working, it should be quite impressive how many
> things work, and with near-native performance (or better!) :