I have a particular itch that I want to scratch…Compiling the Linux Kernel with just LLVM toolchain on Alpine Linux.
I use Alpine Linux on top of WSL2 for majority of my work except when it comes to compiling Linux.
WSL2 has its own documentation for building the kernel which works fine on Ubuntu/Debian.
But when I use Alpine Linux as my base distro with only LLVM toolchain as documented by main linux docs I get the following error:
$ make LLVM=1 V=1 KCONFIG_CONFIG=Microsoft/config-wsl
clang -Wp,-MMD,scripts/basic/.fixdep.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -o scripts/basic/fixdep scripts/basic/fixdep.c
clang-13: error: unable to execute command: Executable "ld" doesn't exist!
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
.....
I tried compiling the vanilla kernel in the same Alpine environment and got the same error message, so I guess Microsoft’s custom configs aren’t to be blamed for this error.
Anyone has any idea what I am doing wrong here? Why is clang
calling ld
when I have lld
already installed.
The LLVM=1 flag automatically uses lld
as the linker according to the docs
I am pretty new to C compiler flags, so any help or hint would be greatly appreciated. The goal here is to just build Linux without any GNU components (except libgcc and libstdc++ maybe)
Thank you!