12 ms·
OpenMandriva, the first Clang-built Linux distribution
- AngryPenguin 7y agoAmazing news :)
- saagarjha 7y agoIsn't Android built with Clang?
- NullPrefix 7y agoYes.
- saagarjha 7y agoNow that I think about it, I think Chrome OS is as well?
- NullPrefix 7y agoChromeOS is based on Gentoo, is it not?
- saagarjha 7y agoYes, as far as I'm aware they've been using Gentoo for quite a while.
- opencl 7y agoUserland has been built with clang since 7.0. The kernels of some Android devices (Pixel 2/3 for example) are built with clang but seems like most still use GCC.
- robocat 7y agopjmlp said: [clang is] the only choice on Android as of NDK 18 https://news.ycombinator.com/item?id=17617499 https://news.ycombinator.com/item?id=17617499
- Hendrikto 7y agoAlso 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 7y agoArch Linux was able to achieve this years ago.
- Operyl 7y agoArch Linux has a package manager written in C, instead of Python, for example.
- somatic 7y agoAPT 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?
- Operyl 7y agoI wasn't saying there was a disadvantage, I'm just giving a potential look into why it took longer than, say, Arch. Yum is a huge Python project, and it took a while to comb through it all.
- Conan_Kudo 7y agoIt wasn't YUM that held back OpenMandriva's switch (OpenMandriva never used YUM), but some of the build infrastructure tools that wound up being replaced as part of the migration from urpmi to DNF. Those legacy tools never were updated for Python 3 because they had no maintainers or developers. When the distribution switched to DNF, they were able to adopt actively maintained software that replaced those that were ported to Python 3.
- qhwudbebd 7y agoDoesn’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?)
- Conan_Kudo 7y agoThe kernel is not built with clang as that only works with ARM architectures right now (the Android kernel supports it, but the mainline kernel does not).
- ndesaulniers 7y agoFalse! Mainline builds cleanly for most arches with clang.
- Conan_Kudo 7y agoNot with any released version of clang, but yes, it works with snapshots of git master...
- ndesaulniers 7y agoAgain, false! This is highly dependent on: 1. What arch are you targeting. 2. What version of Linux are you trying to build? Mainline, stable, next? 3. What configs are you trying. 4. What version of clang are you using. For example, pixel 2 kernel is arm64, 4.4 stable kernel, limited configs, and clang-4. Things for the most part are pretty green with released versions of clang. There are some long tail configs or combos of the above, but it's pretty minimal and we have a good handle on them.
- Conan_Kudo 7y agoI'm mainly working off our experience in OpenMandriva, so at least for your standard general-purpose Linux distribution, it doesn't work yet.
- 7y ago
- shereadsthenews 7y agoThat’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 7y agoClear Linux?
- celrod 7y agoThey 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-guided-platform-specific-optimizations https://clearlinux.org/blogs-news/boosting-python-profile-gu...
- shereadsthenews 7y agoThat’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.
- canada_dry 7y agoELI5... why is this great news (i.e. why is LLVM/CLANG better than GCC -- speed?)
- StavrosK 7y agoSee, when a daddy loves a mommy very much, they usually get married. However, sometimes the daddy meets another woman, who is faster, uses less memory, with a significantly less complicated code base, and then the daddy decides to compile his Linux with her instead. Does that help?
- canada_dry 7y agoWell, I did say ELI5. So, thanks, um, I guess.
- StavrosK 7y agoI do strive to be age-appropriate!
- deleted 7y ago[deleted]
- nickik 7y agoDaddy is a dick, he and mommy have grown up together. They share their complex internals with each other and were made for each other. They share even their philosophical stance on code freedom. How can you turn your back on that. Why jump to another woman just because she is thinner and more in demand with with researches?
- cat199 7y ago> They share even their philosophical stance on code freedom arguable. BSD and commercial Unices used PCC and PCC derivitives for much of their history; by this token, GCC is the 'other woman', and this is itself ignoring the clear differences in philosophy between MIT/BSD and GPL licening
- haunter 7y agoWhat 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
- deleted 7y ago[deleted]
- nickpsecurity 7y agoThe only benefit I can think of is increased security now or over time. Most people developing compiler-based mitigations work on LLVM. Especially the practical ones. HardenedBSD is an example of a project making use of them. SVA is an example of one that might be applied to Linux: https://github.com/jtcriswell/SVA https://github.com/jtcriswell/SVA
- AsyncAwait 7y agoMore research style projects are indeed based on LLVM, but GCC is extremely serious about security too, (and contains more Linux-specific optimizations & code too). For the end user, it comes down to - do you care about copyleft and what FSF/Stallman are advocating for, or do you just want a free (as in beer) code, (LLVM). I'd argue as a user, the GPL cares more about your freedom, so unless you have a specific reason not to use GCC, go with that over LLVM, (yes, am aware of the exception re binaries compiled with GCC not having to themselves be GPL).
- lone_haxx0r 7y agoI'm a freedom-focused user that prefers BSD licenses.
- meruru 7y agoThis is possibly a silly question but... when it comes to the threat of backdoor vulnerabilities inserted in the compiler itself, which would you say is the safer option? From what I can tell LLVM has a simpler codebase so that's a point in its favor, but I think GCC being a GNU project is less likely to have developers who could be pressured to insert malicious code. Am I crazy in worrying about this? I know initiatives like reproducible builds are supposed to help solve that kind of threat, but it's still not clear to me how it all fits together.
- asb 7y agoI assume glibc is built with gcc still? Is there a listing anywhere of the packages that aren't build with Clang?
- AngryPenguin 7y agoNot 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 7y agoThat list is definitely out of date, because it still references the old ABF instance...
- justinclift 7y agoHmmmm... > 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 7y agoFreeBSD also imports RCs, for example https://github.com/freebsd/freebsd/commit/48cf3d0825d200d26e6a562b91de4f7f2ba11a84 https://github.com/freebsd/freebsd/commit/48cf3d0825d200d26e... Who cares about "really™ final releases"? :D
- raverbashing 7y agoWell, there was the infamous case of gcc 4.0.0 (No, I don't have a white beard)
- protomyth 7y agoshush, 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-released https://news.slashdot.org/story/05/04/21/2125235/gcc-400-rel...
- pepijndevos 7y agoIn addition to the "why does LLVM matter" asked elsewhere, why would I want to use OpenMandriva?
- pbhjpbhj 7y agohttps://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 7y agoWorking 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++.
- matthewbauer 7y agoThey still use libgcc, ld.bfd, and libstdc++ though.
- fluffything 7y agoI was wondering whether they were using `libc++` and `libc++abi` or not. Thank you for clarifying this.
- notaplumber 7y agoIf you're looking for a system that does, OpenBSD adopted libc++ and libc++abi by default.
- fluffything 7y agoI 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 7y agoA bit off-topic, sorry, but I'm curious about what you mean by interfacing with Monitors/TVs wirelessly, how does that work?
- ndesaulniers 7y agoReally 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 7y agoNot 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 7y agoAlso, to be pedantic, apple is a BSD, not a linux.
- meruru 7y agoMac OS is its own operating system with its own kernel. It's neither Linux nor BSD.
- dnautics 7y agooh good point, TIL only the posix and syscall layer is BSD. nonetheless it's not at all a linux.
- pjmlp 7y agoIf 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-ebook/dp/B004Y4UTLI https://www.amazon.com/Mac-OS-Internals-Systems-Approach-ebo... Since then, has macOS become even further away from BSD, with its own Network stack, XPC, SIP and many other architecture changes.
- 7y ago
- Conan_Kudo 7y agoFor 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-Switching_a_Linux_distro.pdf https://llvm.org/devmtg/2019-04/slides/TechTalk-Rosenkranzer...
- BurningCycles 7y agoAm 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 ?
- pfdietz 7y agoClang 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?
- andrekandre 7y agowhat’s the reason gcc wouldn’t support it? [edit] ipad auto correct
- astrange 7y agoBecause zero is not a correct value for all variables, and picking a random behavior over no behavior breaks ubsan. It also adds a data-dependency (zeroing out a stack buffer depends on the length of the buffer) which is insecure.
- ori_b 7y agoThat 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 7y ago> 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.
- kartan 7y agoWhy not use static code analyzers? You run them in compilation time and warn you of uninitialized variables. Initializing values just because seems wasteful. That's why global and static variables are already initialized in this way. For me it would yet make sense that Gcc allows it even if it's not a very good practice it may have its uses.
- notaplumber 7y agoSeveral *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.
- deleted 7y ago[deleted]
- gok 7y agoSurely that distinction must to go to Android and/or ChromeOS?
- rocqua 7y ago> 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 7y agoDebian 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/python3.html https://www.debian.org/doc/packaging-manuals/python-policy/p...
- Conan_Kudo 7y agoThat's basically never, then. Debian "maintains" tons of old, broken software in their repositories.
- stefantalpalaru 7y agohttps://www.phoronix.com/scan.php?page=article&item=gcc-clang-2019&num=1 https://www.phoronix.com/scan.php?page=article&item=gcc-clan... : "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."
- robocat 7y agoBackground HN comments on the compromises between choosing clang or GCC: https://news.ycombinator.com/item?id=17617043 https://news.ycombinator.com/item?id=17617043