Re: [PATCH] samples: run headers_install for host arch instead of target arch

From: Arnd Bergmann
Date: Fri Sep 28 2018 - 15:36:33 EST


On Fri, Sep 28, 2018 at 8:51 AM Masahiro Yamada
<yamada.masahiro@xxxxxxxxxxxxx> wrote:
>
> Some samples search headers in $(objtree)/usr/include, which is made
> available by "make headers_install". It is not kernel-space code but
> host programs that need this header search path.
>
> Commit 3fca1700c4c3 ("kbuild: make samples really depend on
> headers_install") is wrong because it installs headers of the target
> architecture. Besides, UML fails to build with CONFIG_SAMPLES=y
> because UML does not support headers_install.
>
> Invoke "make headers_install" for the _host_ architecture in the
> prepare stage. Introduce CONFIG_HOST_HEADERS_INSTALL so that this
> happens only for samples that need it.
>
> I also removed 'Documentation/: headers_install', which I guess is
> stale code.
>
> Fixes: 3fca1700c4c3 ("kbuild: make samples really depend on headers_install")
> Signed-off-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
> Cc: David Howells <dhowells@xxxxxxxxxx>

I don't understand this one. Why would we want to build the samples for
the host architecture rather than the target architecture?

I would think that the bug is that we try to build them using
HOSTCC, and they end up being unusable on the target as
a consequence.

Arnd