LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 01-07-2023, 09:14 PM   #1
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651
Blog Entries: 135

Rep: Reputation: 188Reputation: 188
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.
 
Old 01-08-2023, 11:18 PM   #2
anak_bawang
Member
 
Registered: Jun 2015
Location: Bandung Indonesia
Distribution: Debian, LFS/BLFS
Posts: 138

Rep: Reputation: 23
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.

Last edited by anak_bawang; 01-08-2023 at 11:23 PM.
 
Old 01-09-2023, 08:04 PM   #3
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651

Original Poster
Blog Entries: 135

Rep: Reputation: 188Reputation: 188
Thank you for the reply. It is good to hear from someone who has tried this.

Quote:
Originally Posted by anak_bawang View Post
Hi,

Maybe it was my old post.
It was actually a post on 4chan, which is part of the reason I suspected its veracity. I am embarrassed that I did not see your post here.

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?

Last edited by jr_bob_dobbs; 01-09-2023 at 08:11 PM. Reason: D'oh!
 
Old 01-09-2023, 09:02 PM   #4
anak_bawang
Member
 
Registered: Jun 2015
Location: Bandung Indonesia
Distribution: Debian, LFS/BLFS
Posts: 138

Rep: Reputation: 23
Quote:
Originally Posted by jr_bob_dobbs View Post
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?
Thanks for the link.

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.
 
Old 01-10-2023, 06:21 AM   #5
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,609
Blog Entries: 19

Rep: Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458
istr reading somewhere that Linus uses clang.
 
1 members found this post helpful.
Old 04-24-2023, 05:00 PM   #6
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651

Original Poster
Blog Entries: 135

Rep: Reputation: 188Reputation: 188
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!
 
Old 04-06-2024, 04:00 AM   #7
HolyFenrir
LQ Newbie
 
Registered: Apr 2024
Posts: 1

Rep: Reputation: 0
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] clang compilation of simple main.c puts both clang and gcc in .comment hoes Linux - Software 2 05-03-2019 05:55 AM
LXer: LLVM Clang 3.3, Early Clang 3.4 Benchmarks LXer Syndicated Linux News 0 06-23-2013 10:00 PM
LXer: LLVM project's 2.7 release out with a Clang LXer Syndicated Linux News 0 04-28-2010 09:31 PM
LXer: Benchmarking LLVM & Clang Against GCC 4.5 LXer Syndicated Linux News 0 04-21-2010 02:30 PM
LXer: LLVM 2.6 Released, Clang Is Now Production Ready LXer Syndicated Linux News 0 10-25-2009 05:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 10:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration