[mkroot] [landley/mkroot] Smoke test the correct compiler (#6)

Rob Landley rob at landley.net
Tue Jun 13 15:06:45 PDT 2017


On 06/12/2017 09:32 AM, Sam Thursfield wrote:
> Maybe I'm missing something, but I doubt the intention here was to call
> the host's native compiler.

No, the check is intended to be on the native compiler, even back in
Aboriginal Linux
(https://github.com/landley/aboriginal/commit/ab2d8cd098c3). If you
supply a broken cross compiler that's pilot error.

Back in the aboriginal linux days, populating the airlock directory was
done with static binaries (same as on the target) and that build failed
on Fedora where Ulrich Drepper's insanity poisoned the distro to the
point where libc.a was a separate package not installed by default.
(These days they've switched insanity providers to the systemd guys
instead.)

Mkroot checked the host compiler for a few other reasons:

1) You may not have a host compiler installed at all. (It's not part of
the default install on some distros.)

2) The test is right after the airlock install, so if we screwed up the
compiler doing that it figures it out early. Distros have had all SORTS
of funky wrappers, from distcc and ccache to Ubuntu making "gcc" a perl
script that called "gcc.real" (YES REALLY, see
https://github.com/landley/aboriginal/commit/988d9dc7b501f) so _that_
had to be in the wrapped $PATH...

3) If you build without cross compiling, it's going to try to use the
host compiler to produce static binaries anyway.

That said, the toybox airlock build we do is dynamic linking (or at
least leaving it to the host toolchain to determine how to link the
binaries), so I don't strictly have to _require_ static linking. I can
either move this check into the "native compiling" if/else, change it to
just check that it can build a runnable hello world program, or remove
it entirely.

Rob


More information about the mkroot mailing list