
OpenMandriva, the first Clang-built Linux distribution - Conan_Kudo
https://www.openmandriva.org/en/news/article/the-best-until-openmandriva-does-better-released-omlx-4-0
======
haunter
What difference does that make for an end user? You have two copies of the
same OS on the 2 PCs (same hardware) but one compiled on gcc, the other on
LLVM/clang. How will this affect me? What differences I will notice? Better
performance? Like real world performance

~~~
koyote
You could theoretically see better real-world performance. As someone who is
currently working on very high-performance C++, I have noticed Clang being
much more 'confident' in optimising code than its counterparts (especially
compared to MSVC++).

That being said, in the grand scheme of things any performance improvement
would probably only show up on benchmarks.

~~~
agumonkey
Might inspire new implementations if people realize there are some spots that
can run faster elsewhere.

------
notaplumber
Several *BSD projects have been using the Clang toolchain by default for many
years, and have been a massive driving force in getting these fixes upstreamed
so that other systems, incl. Linux distributions can benefit from greater
choice of compilers.

FreeBSD since 10.x on i386/amd64, not sure about the status on other
platforms.

OpenBSD since 6.1 for arm64, 6.2 for i386/amd64. This is both default for the
base system, meaning kernel and userland. And also the ports tree, for
compiling 3rd party packages, very few ports still depend on gcc.

And also, while not the default system compiler yet, LLVM/clang is compiled
and installed on macppc/sparc64 and mips64 systems.

------
shereadsthenews
That’s neat but the large differentiation seems to be PGO+LTO. As pointed out
below both of Google’s distributions of Linux are optimized that way (actually
with AutoFDO/SamplePGO+ThinLTO), but I don’t think there is a community
distribution that is properly optimized. It could be significantly better.

~~~
pkulak
Clear Linux?

~~~
celrod
They do for at least some libraries. For example, here is a blog post about
how they build Python and a few math libraries with PGO:
[https://clearlinux.org/blogs-news/boosting-python-profile-
gu...](https://clearlinux.org/blogs-news/boosting-python-profile-guided-
platform-specific-optimizations)

~~~
shereadsthenews
That’s interesting but kinda highlights the difficulty of shipping an entire
OS with profile-guided optimizations. What they need is very broad sample
coverage and SamplePGO instead of instrumented FDO. This is what ChromeOS does
with Quipper: they collect perf data samples from the entire fleet of customer
devices and they build the distribution with AutoFDO/SamplePGO.

------
ndesaulniers
Really great work by the OpenMandriva team. I've spoken to some of their
contributors before and even looked into one of the bugs they reported. Now
that I think about it, I need to send that patch for fixing asm goto detection
in glib.

Android and ChromeOS are also built with Clang. I'm curious about the
distinction of "first." Does anyone know the timelines here?

~~~
oneplane
Not sure how wide Apple has adopted it or how much of a 'distro' you could
call their operating systems, but much is built using LLVM with clang where
publicly visible.

~~~
dnautics
Also, to be pedantic, apple is a BSD, not a linux.

~~~
meruru
Mac OS is its own operating system with its own kernel. It's neither Linux nor
BSD.

~~~
dnautics
oh good point, TIL only the posix and syscall layer is BSD. nonetheless it's
not at all a linux.

~~~
pjmlp
If you want to see how much different they are, have a look at

"Mac OS X Internals: A Systems Approach"

[https://www.amazon.com/Mac-OS-Internals-Systems-Approach-
ebo...](https://www.amazon.com/Mac-OS-Internals-Systems-Approach-
ebook/dp/B004Y4UTLI)

Since then, has macOS become even further away from BSD, with its own Network
stack, XPC, SIP and many other architecture changes.

------
rocqua
> Python has been updated to 3.7.3, and we have successfully removed
> dependencies on Python 2.x from the main install image (for now, Python 2
> continues to be available in the repositories for people who need legacy
> applications);

This is cool. I wish ubuntu/debian would move towards this.

~~~
kilburn
Debian is moving towards this [1], just at its own speed (i.e.: slowly to try
and avoid breakages as much as possible).

[1] [https://www.debian.org/doc/packaging-manuals/python-
policy/p...](https://www.debian.org/doc/packaging-manuals/python-
policy/python3.html)

~~~
Conan_Kudo
That's basically never, then. Debian "maintains" tons of old, broken software
in their repositories.

------
pfdietz
Clang has added a command line option for automatic initialization of auto
variables to zero, hasn't it?

That by itself would be enough to make me choose clang over a compiler that
didn't have that option. Gcc deliberately doesn't support that, right?

~~~
ori_b
That seems like a mistake to turn on, given that clang also has options to
error on uses of potentially uninitialized variables. Zero is often just as
wrong as any other value, so this flag will hide real bugs.

In fact, I'd rather have a flag that clobbers values with random data, to make
sure that uses of uninitialized values are caught as soon as possible.

~~~
kjeetgill
> error on uses of potentially uninitialized variables.

This is absolutely the best option. That said,

> I'd rather have a flag that clobbers values with random data.

That's roughly what happens in practice as is, doesn't it? Barring the first
option I'd rather have an option that fails predictably and reproducibly. An
arbitrary but deterministic garbage number maybe? Like --set-
uninitialized=0xdeadbeef. That might be getting too elaborate, haha.

------
Conan_Kudo
For those interested, there's a presentation about OpenMandriva's usage of
LLVM from EuroLLVM 2019:

* Video: [https://www.youtube.com/watch?v=QinoajSKQ1k](https://www.youtube.com/watch?v=QinoajSKQ1k)

* Slide deck (PDF): [https://llvm.org/devmtg/2019-04/slides/TechTalk-Rosenkranzer...](https://llvm.org/devmtg/2019-04/slides/TechTalk-Rosenkranzer-Switching_a_Linux_distro.pdf)

~~~
BurningCycles
Am I correct in assuming you are connected to the project ? If so I was
wondering what the packages are where you employ PGO, Firefox, Chromium and
x64 are examples of applications with built in compile-support, are you using
PGO on other packages as well ?

------
saagarjha
Isn't Android built with Clang?

~~~
NullPrefix
Yes.

~~~
saagarjha
Now that I think about it, I think Chrome OS is as well?

~~~
NullPrefix
ChromeOS is based on Gentoo, is it not?

~~~
saagarjha
Yes, as far as I'm aware they've been using Gentoo for quite a while.

------
Hendrikto
Also this:

> Python has been updated to 3.7.3, and we have successfully removed
> dependencies on Python 2.x from the main install image (for now, Python 2
> continues to be available in the repositories for people who need legacy
> applications);

~~~
frutiger
Arch Linux was able to achieve this years ago.

~~~
Operyl
Arch Linux has a package manager written in C, instead of Python, for example.

~~~
somatic
APT is written in C++ and YUM is written in Python.

Besides the Python2->3 thing, are there actually any practical advantages to
using a lower-level language for managing packages?

~~~
pletnes
Pacman is, subjectively, the fastest package manager I’ve ever used. Not sure
if it’s C vs python though, apt is also much slower on many tasks.

~~~
massysett
This could easily be simply because Pacman doesn’t do as much as apt. For
instance apt tracks symbols exported by shared libraries. Pacman doesn't.

~~~
viraptor
I've never heard of that. In what situations is that tracking used?

~~~
Conan_Kudo
As far as I know, only RPM-based package managers do symbol tracking at
dependency resolution time. Neither Debian nor Arch package managers do this.

------
canada_dry
ELI5... why is this great news (i.e. why is LLVM/CLANG better than GCC --
speed?)

~~~
IloveHN84
They want to get rid of Stallmann's GNU concepts

~~~
pjmlp
Which is always ironic, given that without Stallmann's GNU concepts, Linux
would never have happened.

And most likely, given the BSD state back then, it would mean we would just
keep using either commercial UNIXes, or Windows would have won the UNIX wars.

But lets get rid of Stallmann's GNU concepts.

~~~
cat199
> given the BSD state back then

you mean being persecuted by over-bearing commercial unices? (e.g. SVr4 and
ATT)?

lets not mis-confuse the issues to our personal ends - the argument is just as
valid that without BSD UNIX, stallman would also not have a system to base a
clone on..

GNU attempts to redefine the existing cultural status quo of open-source
software dating from the dawn of computing to its own personal ends

~~~
pjmlp
Sure they had a system, commercial UNIXes would been kept being used.

GCC only got manpower when Sun changed the way UNIX SDK used to be given to
customers.

And who knows, maybe companies would have been more willing to dedicate
manpower to HURD.

------
justinclift
Hmmmm...

> LLVM/clang 8.0.1

Guess they have a time machine, as LLVM 8.0.1 isn't released.

There's an rc2 available (3 days ago), but that's not really a release:

[https://github.com/llvm/llvm-project/releases](https://github.com/llvm/llvm-
project/releases)

Jumping the gun a bit maybe? ;)

~~~
floatboth
FreeBSD also imports RCs, for example

[https://github.com/freebsd/freebsd/commit/48cf3d0825d200d26e...](https://github.com/freebsd/freebsd/commit/48cf3d0825d200d26e6a562b91de4f7f2ba11a84)

Who cares about "really™ final releases"? :D

~~~
raverbashing
Well, there was the infamous case of gcc 4.0.0 (No, I don't have a white
beard)

~~~
protomyth
shush, you'll scare the children. The GCC 4.0.0 release thread on slashdot is
all of slashdot in one thread
[https://news.slashdot.org/story/05/04/21/2125235/gcc-400-rel...](https://news.slashdot.org/story/05/04/21/2125235/gcc-400-released)

------
pepijndevos
In addition to the "why does LLVM matter" asked elsewhere, why would I want to
use OpenMandriva?

~~~
pbhjpbhj
[https://wiki.openmandriva.org/en/4.0/RC/Release_Notes](https://wiki.openmandriva.org/en/4.0/RC/Release_Notes)

but I'm not really sure. I guess if you want a recent kernel, KDE Plasma based
distro and you work with LLVM/clang.

I really don't know where it fits with Mageia/PCLinuxOS and other Mandrake
descendants.

History IIRC -- Mandrake was RH Linux with KDE; Mandriva was a continuation of
that which split; OpenMandriva were devs from that split that took ROSA Linux
(still doing KDE4 I think) and then continued their project from that base.

~~~
johncolanduoni
Working with LLVM/clang is pretty much the same on a distorted compiled with
clang as one compiled with gcc. Even the C++ ABIs are largely compatible if
you use libstdc++ instead of libc++.

------
robocat
Background HN comments on the compromises between choosing clang or GCC:

[https://news.ycombinator.com/item?id=17617043](https://news.ycombinator.com/item?id=17617043)

------
qhwudbebd
Doesn’t mention if the kernel built fine with clang, that would be interesting
if so as that used to be tricky. (I’m probably out of date; maybe it’s fine
nowadays?)

~~~
ndesaulniers
Good question! This is my day job! Builds are looking pretty green!

[https://clangbuiltlinux.github.io/](https://clangbuiltlinux.github.io/)

X86_64 required the implementation of ASM goto, which we just shipped. You'll
need to build clang from source, but the feature will be in clang-9.0 release.
Other arches should build with clang-8 (technically x86_64 will build pre 4.19
kernels) but we shipped pixel 2 kernels w/ clang-4.0 so older Clang's may work
depending on your target arch/tree/configs.

~~~
qhwudbebd
Ah, that's really interesting, many thanks. I'd be building from source
anyway, so I'll have to try clang HEAD with Linus' tree and see how it goes.

~~~
ndesaulniers
Great! Please report any bugs you find via our issue tracker on the site
linked above (if we haven't already spotted them).

------
matthewbauer
They still use libgcc, ld.bfd, and libstdc++ though.

~~~
fluffything
I was wondering whether they were using `libc++` and `libc++abi` or not. Thank
you for clarifying this.

~~~
notaplumber
If you're looking for a system that does, OpenBSD adopted libc++ and libc++abi
by default.

~~~
fluffything
I have OpenBSD in a VM, sadly, I have many monitors and TVs I need to
interface with wirelessly to do presentations, and OpenBSD does not really
support that.

~~~
notaplumber
A bit off-topic, sorry, but I'm curious about what you mean by interfacing
with Monitors/TVs wirelessly, how does that work?

------
gok
Surely that distinction must to go to Android and/or ChromeOS?

------
asb
I assume glibc is built with gcc still? Is there a listing anywhere of the
packages that aren't build with Clang?

~~~
AngryPenguin
Not sure if this is updated recently but here is a list
[https://wiki.openmandriva.org/en/Packages_forcing_gcc_use](https://wiki.openmandriva.org/en/Packages_forcing_gcc_use)

~~~
Conan_Kudo
That list is definitely out of date, because it still references the old ABF
instance...

------
stefantalpalaru
[https://www.phoronix.com/scan.php?page=article&item=gcc-
clan...](https://www.phoronix.com/scan.php?page=article&item=gcc-
clang-2019&num=1) :

"On the AMD side, the Clang vs. GCC performance has reached the stage that in
many instances they now deliver similar performance... But in select
instances, GCC still was faster: GCC was about 2% faster on the FX-8370E
system and just a hair faster on the Threadripper 2990WX but with Clang 8.0
and GCC 9.0 coming just shy of their stable predecessors. These new compiler
releases didn't offer any breakthrough performance changes overall for the AMD
Bulldozer to Zen processors benchmarked.

On the Intel side, the Core i5 2500K interestingly had slightly better
performance on Clang over GCC. With Haswell and Ivy Bridge era systems the GCC
vs. Clang performance was the same. With the newer Intel CPUs like the Xeon
Silver 4108, Core i7 8700K, and Core i9 7980XE, these newer Intel CPUs were
siding with the GCC 8/9 compilers over Clang for a few percent better
performance."

------
AngryPenguin
Amazing news :)

