Re: selftests: -e error: missing kernel header files. Please run this and try again

From: Muhammad Usama Anjum
Date: Thu Jun 08 2023 - 04:39:27 EST


On 6/8/23 1:21 PM, Naresh Kamboju wrote:
> The make kselftest-install failed on Linux next 20230608.
>
> make --silent --keep-going --jobs=8
> O=/home/tuxbuild/.cache/tuxmake/builds/1/build
> INSTALL_PATH=/home/tuxbuild/.cache/tuxmake/builds/1/build/kselftest_install
> ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 'HOSTCC=sccache clang'
> 'CC=sccache clang' LLVM=1 LLVM_IAS=1 kselftest-install
Around 6-8 months ago, selftests used to build kernel headers from the
source tree automatically and were using those to build all applications.
But this behavior got changed where user need to build header manually
first before building kselftest because auto header build was in-consistent
in some cases.

So from several months people, who were unaware of this are building
kselftests with installed kernel headers in their distro. This was creating
failure for some newer tests for people. They didn't know that selftests
are supposed to build with kernel headers from source instead from locally
installed headers in distro. So a patch has been introduced which spits
error if kernel headers aren't built already:
https://lore.kernel.org/all/20230606071637.267103-12-jhubbard@xxxxxxxxxx

To fix things for your case, please build kernel headers by `make headers
...` and then build kselftests. The error is trying to say the same thing.

>
> make[3]: Entering directory '/builds/linux/tools/testing/selftests/alsa'
>
> -e error: missing kernel header files.
> Please run this and try again:
>
> cd /builds/linux/tools/testing/selftests/../../..
> make headers
>
> make[3]: Leaving directory '/builds/linux/tools/testing/selftests/alsa'
> make[3]: *** [../lib.mk:77: kernel_header_files] Error 1
>
> Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
>
> Links,
> ===
> https://storage.tuxsuite.com/public/linaro/lkft/builds/2QsWmEgSFF9iwodTUrWsdopV4Qp/
>
> --
> Linaro LKFT
> https://lkft.linaro.org

--
BR,
Muhammad Usama Anjum