LFS with clang / LLVM
Years ago I read about someone building an LFS system using LLVM / clang instead of gcc. I assumed at the time that it was BS.
Recently I was trying out OpenBSD and typed "ls -l $(which cc)" and to my surprise, cc was a link to clang, not to gcc. Surprise! Maybe that compiler is now polished enough. LLVM is mentioned in the BLFS book, but so far as I was able to find, only so much as to describe how to compile LLVM. It would be interesting to build an LFS system without gcc at all, just to see if it is possible. Has anyone done this already? Thank you. |
Hi,
Maybe it was my old post. Just Sharing: LFS + BLFS compiled mostly with clang https://www.linuxquestions.org/quest...ng-4175619942/ As title said, mostly using clang. Can not compile kernel using clang. Still using gcc. Maybe you can try compile BSD kernel using clang, but it will be BSD From Scratch. Notes : 1. When I posted it, it was LFS 8.0 & 8.1 2. Never used this method for LFS 9 and 10 3. Many errors when trying this method for LFS 11, so I put it off for a while. |
Thank you for the reply. It is good to hear from someone who has tried this.
Quote:
EDIT: I am even more embarrassed, because I saw that I'd posted reply on your thread back in 2017 and then entirely forgot. I am an idiot. An update: I found a page on compiling the Linux kernel with LLVM, on the actual kernel.org web site. Whoa. Here is the ink. It seems a bit terse, though? Maybe it *is* possible now? |
Quote:
I guess it will only work for latest kernel. Version 6 and later. I've tried compile kernel version 5 with clang, but it did not work. But I will try it later, because I'm very busy right now. |
istr reading somewhere that Linus uses clang.
|
So I ended up using regular GCC for my LFS 11.2 install. It had been long enough since 8.1 that I wanted to refresh my memory before going to new territory, compiler-wise.
When I progressed to BLFS 11.2, I discovered that several (many?) packages now can only be compiled with clang, indicating to me that it is most likely feature complete? Neat! |
Linux Kernel
The Linux kernel can be built now with Clang. This should clear away any major hurdle to building a modern LFS system with it.
https://docs.kernel.org/kbuild/llvm.html |
All times are GMT -5. The time now is 01:35 AM. |