1 |
Dear everyone, |
2 |
|
3 |
A few months ago, I had embarked on a quest to find (or create!) a |
4 |
reasonable linux distribution that was completely based on clang, with no |
5 |
dependence on gcc whatsoever. My search turned up empty, but there were the |
6 |
seeds of hope in Gentoo. Previous developers had brought native clang |
7 |
support to gentoo, and there were ways to make clang the native toolchain, |
8 |
thanks to the clang native GSoC. |
9 |
|
10 |
The problem is that despite all this, gentoo's support for a clang-native |
11 |
toolchain in currently distributed stages is still very bad. It is |
12 |
impossible to change the toolchain to a clang based one without some major |
13 |
hacking and bootstrapping, which is something that I'm sure no one wants to |
14 |
do. This is because is not possible to compile a self-hosting clang |
15 |
toolchain with gcc, which means that an average gentoo user could never use |
16 |
clang as system default without still depending on gcc. |
17 |
|
18 |
As a consequence, if a gentoo user wanted to use clang native, they would |
19 |
have to stumble across a reddit post, made either by me or stalmannen, |
20 |
distributing experimental stages. |
21 |
|
22 |
Over these past few months, I have spent much time troubleshooting and |
23 |
bug-fixing to create a fully clang-native gentoo stageball, based on a |
24 |
clang/LLVM/musl/lld toolchain. I have gotten it to the point where I |
25 |
believe it can now be officially supported by gentoo, at least as an |
26 |
"experimental stage". |
27 |
|
28 |
- It is self hosting, via a bootstrap.sh script I have made. I am hoping |
29 |
to eventually change this into a GRS script, but I am still working on it. |
30 |
- I use my own profiles, which are located in /usr/portage/profiles, and |
31 |
inherit from amd64/default/musl. They remove gcc, binutils, and others from |
32 |
the system set, and replace them with llvm/clang/lld, etc. I'm hoping they |
33 |
can be moved into the main portage tree eventually. |
34 |
- There is really no "hacking" neccessary to make the stage work. Out of |
35 |
the box, it can compile stuff, and otherwise behave exactly like a regular |
36 |
musl stage. |
37 |
- The whole system set compiles except for 2 packages: sandbox and |
38 |
pambase. The sandbox bug is trivial (#643740), and is just a problem in a |
39 |
configure script detecting libc path. The pambase bug is less trivial (no |
40 |
open bug), and I have no idea how to fix it. |
41 |
- There are some "hacks" in /etc/portage, such PIE/SSP patches for |
42 |
clang, and symlinks from nm -> llvm-nm, ar -> llvm-ar, |
43 |
/usr/lib/clang/libclang_rt.a -> /usr/lib/libcompiler_rt.a, but all of these |
44 |
hacks will go away with some more bug fixing and upstream changes. |
45 |
|
46 |
The biggest reason I propose native clang stages to be hosted by gentoo is |
47 |
so it can gain more publicity, and attract the attension of more |
48 |
developers. I really want clang linux to become a reality, but I am only |
49 |
one guy, and can torture myself over so many bugs. |
50 |
|
51 |
Link to my reddit post for details: |
52 |
https://www.reddit.com/r/Gentoo/comments/7qdrun/update_to_clangmusl_experimental_stage4/ |
53 |
|
54 |
Link to GSoC by zlei: |
55 |
https://blogs.gentoo.org/gsoc2016-native-clang/ |
56 |
|
57 |
Here's a link to a google drive folder containing a few stages and the |
58 |
bootstrap script. |
59 |
https://drive.google.com/drive/folders/1Hv8obFaiKf9iNOFqLhOcFh69nEWRFMWJ?usp=sharing |
60 |
|
61 |
Here's a link to the bootstrap script. |
62 |
https://drive.google.com/file/d/1jV0D4W-pB7cV2Q1yztL5ysRt8rzqzaxe/view?usp=sharing |
63 |
|
64 |
Here's a link to my latest build (Jan 28): |
65 |
https://drive.google.com/file/d/1RyB1sLgeBsfc8_RwsJJ0V29bAq34frbJ/view?usp=sharing |
66 |
|
67 |
SHA512 for latest build (Jan 28): |
68 |
51a3ca5547f221b7ceea7691d4f4a3d20ba6aa50fac3c95bb67fd2e5aeb331d2d50fce173e579b5e |
69 |
cfa05aa4b410f22e9b6fa4cd7edeefefb0c697f5128d61e1 |
70 |
|
71 |
-- |
72 |
Thanks a ton, |
73 |
Bjorn Pagen |