Re: headers_install builds break on a lot of targets?

From: Rich Felker
Date: Wed Jun 03 2020 - 13:04:05 EST


On Wed, Jun 03, 2020 at 08:49:54AM -0500, Rob Landley wrote:
> The headers_install_all target got removed last year (commit f3c8d4c7a728 and
> would someone like to update Documentation/kbuild/headers_install.txt which
> still describes it?)
>
> The musl-libc maintainer is using a forked hand-hacked kernel header package in
> his toolchain build project (https://github.com/richfelker/musl-cross-make), and
> he said the reason for it is:

These are provided by sabotage-linux, and are not entirely hand-hacked
but have a documented and at least partly scripted process by which
they're built:

https://github.com/sabotage-linux/kernel-headers

There's no obligation to use them, but using them makes things easier.

Note that, at the time the default was switched, there were no
upstream kernel headers compatible with a time64 userspace yet, so
whichever source you wanted to use required patching anyway.

As of 5.6 I believe everything is upstream and we could add stock 5.6
(or later) headers as a supported choice.

> http://lists.landley.net/pipermail/toybox-landley.net/2020-March/011536.html
>
> Because downloading 100 MB of kernel source and extracting it to a far
> larger tree just to get the headers isn't really fun.
>
> And I thought "that's why headers_install_all existed", and noticed the target
> being removed, so I tried my hand at a small shell script vesion:
>
> for i in $(echo arch/*/ | sed 's@arch/\([^/]*\)/@\1@g')
> do
> echo $i
> X="$PWD/fruitbasket/$i"
> mkdir -p "$X"
> make ARCH=$i distclean defconfig headers_install \
> INSTALL_HDR_PATH="$PWD/fruitbasket/$i" > /dev/null
> done
>
> On the bright side, the resulting fruitbasket.tar.xz is 1.5 megabytes. The
> downside is I have no idea how broken the resulting header files are after this
> error-fest:
>
> alpha
> arc
> gcc: error: unrecognized command line option â-mmedium-callsâ
> gcc: error: unrecognized command line option â-mno-sdataâ; did you mean
> â-fno-statsâ?
> gcc: error: unrecognized command line option â-mmedium-callsâ
> gcc: error: unrecognized command line option â-mno-sdataâ; did you mean
> â-fno-statsâ?
> [...]

Uhg. Surely there should be some fix for whatever mistaken dep is
behind this? Headers shouldn't actually depend on any config/compiler
output, should they?? Or is that machinery somehow involved in
generating the syscall lists and similar?

Rich