Linux: kselftests try to build with gcc

Created on 21 Feb 2019  路  6Comments  路  Source: ClangBuiltLinux/linux

$ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang HOSTCC=clang -j46 quicktest=1 kselftest
...
make[3]: aarch64-linux-gnu-gcc: Command not found
...
[BUG] linux good first issue hermetic builds low priority

All 6 comments

They should be using $(HOSTCC), assuming it was exported correctly from the top level Makefile.

I plan to give this to my student as a good exercise to touch some build scripts and submit his first kernel patch.

To reproduce the issue, we actually do not need the cross-compile setup. It suffices to run make CC=clang HOSTCC=clang kselftest and observe that gcc is used for compiling.

In particular, the author of the rseq system call mentioned that their kselftests fail to build because they reset KBUILD_CFLAGS, thus dropping -no-integrated-as. They should be using ${CLANG_FLAGS}.

So as part of this issue, it's not just that the kselftests build with GCC, but also that they may fail to build with Clang (and we should fix that, too).

cc @gctucker

Thanks for the heads, up. We're trying to fix all existing build errors we have in our environment with gcc first, then we'll take a look at building kselftests with clang.

Was this page helpful?
0 / 5 - 0 ratings