You are not logged in.

#1 2012-08-31 10:54:11

allencch
Member
Registered: 2011-03-25
Posts: 118

Will Arch Linux going to change the default compiler to Clang?

Recently read a news about building the kernel with LLVM Clang.
I would like to ask will Arch Linux adopt this also soon, or in a plan, or no decision yet?

Offline

#2 2012-08-31 11:02:51

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: Will Arch Linux going to change the default compiler to Clang?

No.

Offline

#3 2012-08-31 12:01:14

hadrons123
Member
From: chennai
Registered: 2011-10-07
Posts: 1,249

Re: Will Arch Linux going to change the default compiler to Clang?

@ OP
LLVM clang is currently not as fast as GCC.


LENOVO Y 580 IVYBRIDGE 660M NVIDIA
Unix is user-friendly. It just isn't promiscuous about which users it's friendly with. - Steven King

Offline

#4 2012-08-31 12:07:01

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: Will Arch Linux going to change the default compiler to Clang?

And if you use -O1 in gcc and -O2 in LLVM - to make the compiled binaries have similar speeds - LLVM does not compile any faster either.

Offline

#5 2012-08-31 12:23:13

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: Will Arch Linux going to change the default compiler to Clang?

Even if it was faster, the kernel does not compile without patches and one of the principles of Arch are vanilla packages, right?


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#6 2012-08-31 16:35:43

andjeng
Member
From: Indonesia
Registered: 2012-08-30
Posts: 148

Re: Will Arch Linux going to change the default compiler to Clang?

does compiling kernel using clang give us any good?
i just wondering. (really)


just looking around. wink

Offline

#7 2012-09-01 13:09:44

allencch
Member
Registered: 2011-03-25
Posts: 118

Re: Will Arch Linux going to change the default compiler to Clang?

No, I just wondering since Clang is targetting to replace GCC, and some distributions will use Clang for compiling kernel, I want to know whether Arch Linux will go for this as well or not.

Offline

#8 2012-09-01 21:48:22

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: Will Arch Linux going to change the default compiler to Clang?

some distributions will use Clang for compiling kernel

[citation needed]

Offline

#9 2012-09-01 23:59:23

bwat47
Member
Registered: 2009-10-07
Posts: 638

Re: Will Arch Linux going to change the default compiler to Clang?

allencch wrote:

No, I just wondering since Clang is targetting to replace GCC, and some distributions will use Clang for compiling kernel, I want to know whether Arch Linux will go for this as well or not.

Maybe if/when clang surpasses gcc in speed and functionality, currently that is not the case so a move to llvm would be pointless.

Offline

#10 2012-09-02 02:35:15

Zancarius
Member
From: NM, USA
Registered: 2012-05-06
Posts: 207

Re: Will Arch Linux going to change the default compiler to Clang?

bangkok_manouel wrote:

some distributions will use Clang for compiling kernel

[citation needed]

AFAIK, only FreeBSD is moving to clang. There's a blurb on Wikipedia that Debian has managed to compile something like 90% of their packages, but I can't seem to find anything else that hints there are Linux distributions planning on making the switch. I think the recent news from FreeBSD may have caused confusion and/or assumptions.


He who has no .plan has small finger.
~Confucius on UNIX.

Offline

#11 2012-09-02 03:45:10

allencch
Member
Registered: 2011-03-25
Posts: 118

Re: Will Arch Linux going to change the default compiler to Clang?

bangkok_manouel wrote:

some distributions will use Clang for compiling kernel

[citation needed]

Sorry, this is my mistake. I thought so because Clang is going to replace the GCC, and FreeBSD (not Linux) is going to use CLang, and Debian has a report mentioned compiling the archive using CLang, and an article said using Clang to build linux kernel.

Offline

#12 2012-10-01 20:01:25

cgarcia
Member
Registered: 2010-08-09
Posts: 39

Re: Will Arch Linux going to change the default compiler to Clang?

In addition, clang is heavily pushed by Apple. In the long term, due to its license (not GNU) such company could potentially fork the project and continue supporting only his private branch, leaving alone the clang community. All the important companies like a lot having their own compiler. This wouldn't be possible at all with gcc. Of course, this conspiration theory is entirely my personal (and probably many others) point of view. The GNU license is much more open-source friendly, and this is essential for a tool building the entire system.

Offline

#13 2012-10-01 20:17:14

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Will Arch Linux going to change the default compiler to Clang?

cgarcia wrote:

company could potentially fork the project and continue supporting only his private branch, leaving alone the clang community.

If a community can't keep a project alive, it's a problem with the community, not the license.

Offline

#14 2012-10-01 21:25:00

Grinch
Member
Registered: 2010-11-07
Posts: 265

Re: Will Arch Linux going to change the default compiler to Clang?

The main reason FreeBSD is changing to Clang/LLVM was that they were stuck at a very old GCC 4.2 due to them not accepting GPLv3 (GCC 4.2 was the last GPLv2 licenced GCC), a secondary reason would be that Clang/LLVM is permissively licenced like BSD and thus is more in line with their philosphy. In practice the transition has not been easy as it's been in progress for a long time and has required lots of modifications in the FreeBSD source code.

Linux has no problem with GCC being GPLv3 licenced and as such targets the latest and greatest versions, as for the compiler performance difference GCC typically generates 5-15% faster code when we've benchmarked here at work (x86-64), often more when we use PGO (profile-guided-optimizization) which is a optimization Clang/LLVM lacks (although there was a pgo GSOC project for llvm this summer, don't know how it turned out though).

As for compilation speed, Clang/LLVM is indeed faster altough it's gotten slower over time (rather unavoidable as it matures) and the difference is not as evident as it was earlier, and as Allan pointed out, if you don't optimize your code as much then obviously the compilation speeds will be faster.

Error diagnostics however is a place where I think Clang/LLVM is still supreme, however GCC has made great strides here in the 4.7 release and will likely continue to do so during the 4.8 release. Overall I doubt the kernel devs are going to spend any time on Clang/LLVM compability, not ony because they likely think that time is better spent elsewhere but also because I gather the primary problem is that Clang/LLVM lacks support for many of the compiler extensions the kernel devs relies on in order to better control the resulting code and make it as efficient as possible.

So I will go with Allan: no

Offline

#15 2012-10-01 21:35:55

Teho
Member
Registered: 2010-01-30
Posts: 200

Re: Will Arch Linux going to change the default compiler to Clang?

Grinch wrote:

Overall I doubt the kernel devs are going to spend any time on Clang/LLVM compability, not ony because they likely think that time is better spent elsewhere but also because I gather the primary problem is that Clang/LLVM lacks support for many of the compiler extensions the kernel devs relies on in order to better control the resulting code and make it as efficient as possible.

That's not true. There's LLVMLinux project under Linux Foundation that aims to do just that. There's also quite a few talks about the subject, here's one for example. Many mobile / ARM companies are very interested in compiling Linux with LLVM; most notably Google.

Offline

#16 2012-10-01 22:14:49

Grinch
Member
Registered: 2010-11-07
Posts: 265

Re: Will Arch Linux going to change the default compiler to Clang?

Teho wrote:

That's not true. There's LLVMLinux project under Linux Foundation that aims to do just that. There's also quite a few talks about the subject, here's one for example. Many mobile / ARM companies are very interested in compiling Linux with LLVM; most notably Google.

What of what I wrote was not true? Are the kernel developers doing this? No, this is a 'third-party' effort. And while this project currently compiles the kernel it requires both a patched kernel and a patched clang-llvm toolchain to do so, and the resulting kernel is unstable.

Offline

#17 2012-10-02 04:57:06

Teho
Member
Registered: 2010-01-30
Posts: 200

Re: Will Arch Linux going to change the default compiler to Clang?

Grinch wrote:

What of what I wrote was not true? Are the kernel developers doing this? No, this is a 'third-party' effort. And while this project currently compiles the kernel it requires both a patched kernel and a patched clang-llvm toolchain to do so, and the resulting kernel is unstable.

What does that even mean? The idea is to upstream the patches and it's ongoing effort. How do you define what work is done by "kernel developer" or "thrid-party" kernel developers?

Offline

#18 2012-10-02 05:15:01

Grinch
Member
Registered: 2010-11-07
Posts: 265

Re: Will Arch Linux going to change the default compiler to Clang?

Teho wrote:

What does that even mean? The idea is to upstream the patches and it's ongoing effort.

What it means is that it's not an initiative by the main kernel developers, nor do they seem interested. There is ton of code which IS upstreamed and not accepted. This is not the first attempt to have clang-llvm compiler Linux, there have also been other get-linux-to-compile-with-compiler-x projects before clang-llvm like with ICC, none of which have succeeded.

For this project to reach mainline it requires upstream acceptance of patches in both clang/llvm and linux, clang/llvm devs have not been interested in adding many of the the GCC compiler extensions the linux kernel relies on, and the linux kernel developers have shown no interest of relinquishing the use of these compiler extensions as they want the best possible performance, not to mention that in many cases the kernel developers were actually those who requested said compiler extensions to be added to GCC.

So no, I don't think this will lead to Linux officially building with clang/llvm, you will (as is the case now) have to apply patches, likely not only to linux but also on the clang/llvm toolchain.

Offline

#19 2012-10-02 07:40:46

Teho
Member
Registered: 2010-01-30
Posts: 200

Re: Will Arch Linux going to change the default compiler to Clang?

Grinch wrote:

For this project to reach mainline it requires upstream acceptance of patches in both clang/llvm and linux, clang/llvm devs have not been interested in adding many of the the GCC compiler extensions the linux kernel relies on, and the linux kernel developers have shown no interest of relinquishing the use of these compiler extensions as they want the best possible performance, not to mention that in many cases the kernel developers were actually those who requested said compiler extensions to be added to GCC.

Would you mind sharing some sources? There seems to be quite a bit of work going on making upstream Clang/LLVM to compile Linux kernel and one of its most active developers is Google that internally compiles Linux with LLVM. Here's a a master bug for tracking the process. To my understanding the patches applied to Linux are also relatively small and non-intrusive. There's obviously a lot of community intrest considering that it was worth setting up the LLVMLinux project under Linux Foundation (to reduce dublicated work); Debian also seems to have plans to compile their entire repository with Clang. Not to mention that LLVM itself is very popular nowadays being installed on almost every Linux system.

Offline

#20 2012-10-02 07:57:44

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: Will Arch Linux going to change the default compiler to Clang?

Teho wrote:

Not to mention that LLVM itself is very popular nowadays being installed on almost every Linux system.

Um, what? To the best of my knowledge, it's installed on very few linux systems.

Offline

#21 2012-10-02 08:25:20

Teho
Member
Registered: 2010-01-30
Posts: 200

Re: Will Arch Linux going to change the default compiler to Clang?

Scimmia wrote:

Um, what? To the best of my knowledge, it's installed on very few linux systems.

It's used quite a bit by MESA/Gallium3D: It's hard dependecy on compile time, it's needed by the LLVMPipe  software rasterizer, it's used as a shader compiler by Radeon Gallium drivers and Intel plans to use it in the future too. The propietary NVIDIA driver uses LLVM for both CUDA and OpenCL (as do the Gallium and Intel drivers). Every Android phone has LLVM installed because it's used for RenderScript. I though it was always installed with MESA but it seems I was mistaken.

Offline

#22 2012-10-02 23:26:19

Grinch
Member
Registered: 2010-11-07
Posts: 265

Re: Will Arch Linux going to change the default compiler to Clang?

Teho wrote:

Would you mind sharing some sources? There seems to be quite a bit of work going on making upstream Clang/LLVM to compile Linux kernel

Same as you (I suppose) I've been following these attempts by looking at overall progress, mailing lists and some of the bug reports, like I said this is not the first attempt to get llvm/clang to compile Linux (afaik this latest one is a consolidation of previous efforts together with some new blood(?) which makes it more likely that it will atleast be able to compile a stable kernel, albeit requiring patches).

Teho wrote:

Debian also seems to have plans to compile their entire repository with Clang. Not to mention that LLVM itself is very popular nowadays being installed on almost every Linux system.

Are you referring to that one Debian developer who has compiled the repository with Clang to see how well it went? Is that the basis of your 'Debian also seems to have plans to compile their entire repository with Clang' claim?. AFAIK developers of distros have tried pretty much all the compilers under the sun on their repos and have reported the results, doesn't mean they plan to use that compiler for their official builds.

Teho wrote:

To my understanding the patches applied to Linux are also relatively small and non-intrusive.

I don't know what the state is now but the previous patches I recall where not unintrusive, of course there are two targets of problems here, you can pretty much leave Linux alone if you can have clang-llvm accept lots of patches, and vice versa. If the current crop of patches needed were relatively small and non-intrusive they would likely have made in into some testing branches in the trees of their upstream targets by know, the changes needed for FreeBSD to compile using Clang/LLVM were quite substantial as I recall and it was like a 4-5 year period necessary for the transition despite being a very focused effort which will finally reach it's culmination with the upcoming FreeBSD 10 release.

Teho wrote:

There's obviously a lot of community intrest considering that it was worth setting up the LLVMLinux project under Linux Foundation (to reduce dublicated work);

Well I don't judge a project's success or community interest by a webpage, I judge it by progress. Currently it seems to be where it was last I checked, patches needing to be applied to both Linux and Clang/LLVM with a unstable kernel as a result.

Teho wrote:

Not to mention that LLVM itself is very popular nowadays being installed on almost every Linux system.

Well yes LLVM is pretty much ubiquitous as a JIT-framework which is used in lots of projects but LLVM as a an actual installed package?

Like I said, I would be surprised (as in I don't think it will happen) if upstream linux and clang/llvm took in the patches necessary for compiling linux 'out-of-the-box' based upon past and current progress. I guess we'll have to see.

Offline

#23 2014-01-08 08:44:51

enihcam
Member
From: Internet
Registered: 2009-12-20
Posts: 220

Re: Will Arch Linux going to change the default compiler to Clang?

Sorry I bring this up again, but I think Clang is mature now. Any thoughts?

Offline

#24 2014-01-08 09:29:04

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: Will Arch Linux going to change the default compiler to Clang?

enihcam wrote:

Sorry I bring this up again, but I think Clang is mature now. Any thoughts?

Do you have any real information to add besides "I think"?


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#25 2014-01-08 11:42:43

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: Will Arch Linux going to change the default compiler to Clang?

No.

Offline

Board footer

Powered by FluxBB