8

Is there a Linux distro compiled with clang/llvm? It looks like as of late 2010 the kernel was working. If not, would it be more likely to be a technical or licensing issue?

migrated from serverfault.com Aug 3 '11 at 12:55

This question came from our site for system and network administrators.

  • I don't know of any that are. I think most Linux distros use GCC, supporting software with common licenses and one built specifically to handle GNU code. Clang is currently being embraced by the BSD community for similar reasons. (The proceeding is a huge simplification of political and technical problems) – Chris S Aug 3 '11 at 12:53
  • 4
    For further information on this related post: Is it possible to compile a full Linux system with Intel's compiler instead of GCC? – Caleb Aug 3 '11 at 13:05
  • 3
    @James Please don't edit the answer into the question; you can post an actual answer below and mark it accepted. Also, if you register on SF you should automatically take ownership of the question here – Michael Mrozek Aug 3 '11 at 16:09
8

The situation with Debian

As a late response to this question, what @jmtd said is exactly what happens periodically in the Debian archive.

Packages are recompiled with newer toolchains (compilers, linkers, etc.) and, when recompilation fails, bugs against the packages that failed to be compiled are filed with the indication of FTBFS ("failed to build from source").

Such bugs are generally an indication of something bad happening and are usually ranked with high severity and given the status of "release critical" bugs, meaning that a new release can't be done with those bugs unsolved.

In particular, Lucas Nussbaum has been recompiling the whole archive of the Debian Project in a grid as a means of some Quality Assessment.

Recently, though, Sylvestre Ledru and some other Debian Developers have mentored students in Google's Summer of Code of 2012 to allow substitution of both GCC by Clang and libstdc++ (GCC's support library for C++) by libc++ (Clang/LLVM's counterpart).

There is a site where the results of compilation of the whole collection of Debian packages were published and further reports were documented by LWN and the program for decoupling the Debian build process from GCC was successfully concluded.

So we may soon see a flavour of Debian compiled with clang/llvm, depending on how much support these successful results can gain.

The newcomer

There is, as of this update (2016-08-16), a new version of a traditional Linux distribution compiled with clang and llvm, OpenMandriva Lx 3.0, now in its final release. According to its notes, it is compiled, as much as possible, not only with clang and llvm, but also with "regular" high optimization levels and also with Link Time Optimization (LTO).

LTO

While the main subject of the question and of this answer is llvm/clang, to be fair, it should be noted GCC also features LTO (more background on LTO).

In theory, LTO, as seen in newer clang/llvm and GCC, has the potential of making not only the resulting binaries faster, but also having smaller memory requirements for the text-section of the programs (and the Linux kernel is one potential benefiter of LTO).

I have not read how much OpenMandriva Lx 3.0 uses LTO across all the programs, but I'm excited that it uses clang/llvm + LTO and I would love to see people doing multiple independent benchmarks comparing and contrasting "regular" GCC-based, non-LTO-optimized distributions to OpenMandriva Lx 3.0.

  • @AleksandrDubinsky, thanks for thanking me, but I'm just doing what I would love to have in SE in general. It's frustrating to come by a question/answer that smells like pure dust (whenever the issue is not transient, of course). – rbrito Oct 7 '16 at 18:25
5

Not yet. According to this currently open bug report it seems even the kernel itself fails to compile.

2

Whilst the end-user binaries are not built with clang/llvm, most of the Debian archive has been built (and rebuilt) with clang/llvm (and binutils-gold and other bits and pieces) by people who want to expose portability bugs in the software suite (and the compilers themselves).

  • Aren't end-user binaries part of the Debian archive? – Tshepang Aug 12 '11 at 7:15
  • 1
    Yes, and those are built with gcc. Separately from the end-user binaries, the source packages are rebuilt as part of multiple continuous-integration processes, some of which use alternative compiler/linker/libc toolchains. – jmtd Aug 30 '11 at 15:23
-1

Recently, OpenSuse - Tumbleweed rolling release is to set LTO on gcc9 for it's builds. http://hubicka.blogspot.com/2019/05/gcc-9-link-time-and-inter-procedural.html

  • This does not seem to be an answer to the question "Is there a Linux distro compiled with clang/llvm?". – Kusalananda Jul 18 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy