Re: Building a Linuxulator userland from source

From: Felix Palmen <>
Date: Sun, 20 Aug 2023 10:35:41 UTC
* Felix Palmen <> [20230818 08:23]:
> I just reached a state where I can build a working Linux-native GNU
> toolchain (binutils, glibc, gcc) for C and C++ on aarch64, amd64 and
> i386. From here on, it should be simpler, there are already two ports in
> my branch (archivers/linux-bzip2 and archivers/linux-xz) using that
> native toolchain for building.

Just a little update on this, I *did* start building some "base"
userland now. What seems to work so far is GNU bash and coreutils,
including quite some libs used (gmp, acl, attr, libcap, openssl,
ncurses, readline).

I already had two metaports in my branch, linux_base-dirs (which will
just create and own the absolute minimum directory structure in
${LINUXBASE}) and linux-toolchain (which pulls in everything needed to
compile C and C++).

Now, I added a third metaport: "linux_base". This is incomplete of
course, it's where I want to collect all the bits and pieces for a
"base" Linuxulator userland as RUN_DEPENDS.

If anyone would like to already do some testing at this stage, please be
aware that I not only rebase my feature branch, but also rewrite it
while rebasing (to fix issues I encounter), and of course there won't be
any PORTREVISION bumps. Therefore, the safest thing to do is to remove
all linux*.pkg files from your poudriere repositories before trying a
newer version of the branch. The lxcross*.pkg packages can probably be
kept, I don't expect having to fix anything there.

Finally, I managed to sort out at least one of the open issues:

> - Building the final linux-gcc ports, I get weird error messages
>   directly to poudriere's terminal (they do NOT appear in the build
>   log!) like this:
>     ELF interpreter /usr/lib/ not found, error 2
>   I have no idea where this comes from, so far I couldn't identify any
>   negative effect though.

I still don't know how/why it happened, but I now did what most Linux
distributions seem to do nowadays ... add symlinks in linux_base-dirs:

| /bin -> usr/bin
| /sbin -> usr/sbin
| /lib -> usr/lib
| /lib64 -> usr/lib64

There's just some "convincing" needed for glibc to install *all* files
below /usr, but all other packages now seem to "just work". So I assume
it's the only sane approach packaging some GNU/Linux userland. It
certainly makes sure the program interpreter is now also found below

Cheers, Felix

 Felix Palmen <>     {private}
 -- ports committer --                     {web}
 {pgp public key}
 {pgp fingerprint} 6936 13D5 5BBF 4837 B212  3ACC 54AD E006 9879 F231