Re: Building a Linuxulator userland from source

From: Felix Palmen <zirias_at_freebsd.org>
Date: Mon, 21 Aug 2023 07:21:15 UTC
* Tatsuki Makino <tatsuki_makino@hotmail.com> [20230821 15:38]:
> Linux branded ELF is executed by linuxulator no matter where it is
> placed on /, right?

Yes.

> Binaries running on linuxulator have priority access to files in
> /compat/linux.

Well, when they access some file, a path with /compat/linux prepended is
tried first. Only when there's nothing, the original path is tried.
That's it in a nutshell, the exact rules are a bit more complicated.

> What I don't understand is...
> If a linux binary running on linuxulator can't find a linux library,
> but can find a FreeBSD library, can it link and use that FreeBSD
> library?

No.

> Another problem is that linuxulator does not work for the shell script
> shbang.
> The "bash scripts" installed on /compat/linux, such as ldd, try to use
> freebsd bash outside of /compat/linux.

This works perfectly fine when used from within a Linux shell. Example
from testing my new userland:

| [00:00:20] Entering interactive test mode. Type 'exit' when done.
| root@14a-default:~ # /compat/linux/bin/bash
| bash-5.2# ldd /bin/bash
|         linux-vdso.so.1 (0x00007fffffffe000)
|         libreadline.so.8 => /usr/lib64/libreadline.so.8 (0x0000000801154000)
|         libhistory.so.8 => /usr/lib64/libhistory.so.8 (0x00000008011ad000)
|         libncursesw.so.6 => /usr/lib64/libncursesw.so.6 (0x00000008011bb000)
|         libc.so.6 => /usr/lib64/libc.so.6 (0x0000000801400000)
|         /lib64/ld-linux-x86-64.so.2 (0x0000000001021000)
| bash-5.2# 

Cheers, Felix

-- 
 Felix Palmen <zirias@FreeBSD.org>     {private}   felix@palmen-it.de
 -- ports committer --                     {web}  http://palmen-it.de
 {pgp public key}  http://palmen-it.de/pub.txt
 {pgp fingerprint} 6936 13D5 5BBF 4837 B212  3ACC 54AD E006 9879 F231