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

From: Masahiro Yamada
Date: Sat Sep 29 2018 - 12:53:03 EST


2018å9æ29æ(å) 4:38 Arnd Bergmann <arnd@xxxxxxxx>:
>
> 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.


I just read Makefiles under samples/, and
all that require -I$(objtree)/usr/include
are listed in hostprogs-y,
so they are built for host architectures.

If this is different from our intent,
we need to fix this first.




--
Best Regards
Masahiro Yamada