Brainstorming: LLVM vs GCC

I think personally we should go with LLVM as the default :3.

On other notes I do think we should use Mold as a linker and target x86-64-v3 as a baseline for x86.

Slightly off topic, but I do have a pad here that is a wishlist’s/idea page I have.

I said this to you privately, but this is a much better venue to discuss it in. thanks for raising it here.

so basically I think copyleft is more important than technical architecture

I’d like to support both, I’d like to make sure our automated testing pipeline (which does not yet exist) checks both for everything and makes sure our users have a real choice, which can use either

I would like gcc to be the default

I don’t want to guess what you’re thinking or feeling, but to me your suggestion sounds like it’s motivated by a specific cognitive bias that I’ve spent decades grappling with myself, and wrote a short piece about over at technology, community, and idealism -- Leaves Given to the Wind - I won’t reiterate those points here, I think I said it better in the blog post

it is worth noting that, like… LLVM does some really important research-y things that advance the state of the art. gcc made a deliberate choice not to do those things; gcc was written for ideological reasons which were at odds with trying to chase new researchy stuff. I remember reading a thread about that on the gcc mailing list back in the 90s, when LLVM was new. the gcc team refused to explore the cross-platform intermediate representation idea, and a lot of people, including me at the time, were quite angry at them for it - it felt like that was at odds with the excitement and futurism that people felt like they’d been promised.

on the other hand, uh, LLVM was written specifically to be a non-copyleft compiler. like that is why corporations are so eager to fund it, and that is why its team had the resources to outpace gcc. I’m sure the individual team members, if asked, would disagree with me on this and would say that funding sources don’t affect their choices, but I don’t think that changes the reality - I’m describing structural incentives, not the motives of the people actually doing the work. from what I know they’re lovely, idealistic people who believe in what they’re doing, and I admire that.

copyleft is important though, and I will not participate in dismantling it

agree gcc is probably best as default for now , but having llvm as a well supported option would be incredible !

I disagree I think LLVM default with GCC as an option is better, many distros are moving towards this including NixOS, AerynOS for example also uses LLVM by default, Chimera Linux also uses LLVM, very cool stuff that I think its worth looking into and maybe have a wider discussion on it :3

It may help to cover why you believe LLVM would be better as a default than GCC.

1 Like

Let me preface this by saying I genuinely agree with copyleft being very important, and I do not want to drop GCC altogether, despite personal issues with GNU.

That being said, I like LLVM being the default (or at least focusing on it in the beginning), if not for the fact that it has a decent cross story. The fact of the matter is, the research their team has done, means for us not only cleaner API possibility, but also cleaner implementation, and a lot more stuff working out of the box.
We should obviously consider GCC (and down the line others? Letting you provide your own?), but GCC in nixpkgs is already cursed and a half, and nixpkgs fully embraced the GCC cross model.

To be fair, cross story in nixpkgs is truly astonishing. It really works better than it has any right to be, but it’s also a very common source of confusion, it doesn’t work that great in the grand scheme of things, and those who tried venturing into the implementation details of gcc or other compilers didn’t come out unscathed.

I’m sure we’ll need some cursed nix to tame the GCC beast as well, but at least I truly believe starting with a compiler which did a lot of those things right to begin with, will allow us to think about the machinery the “correct” way, and then down the line make GCC play nicely.

(I don’t think cross is the only bad part of GCC, architecturally, but that’s the most obvious one)

I do acknowledge that as an extremely fair point.

I agree that the single-target nature of GCC introduces a fair amount of extra work. Have you taken a look at how Tidepool handles cross compilation? I believe this is less of an issue since we do things differently than Nixpkgs.

I would ideally like to have core support for both to the extent that a single line config would allow all cc builders to be replaced with the choice of clang/gcc (same with alternative linkers). Haven’t had time to implement yet, but right now testing ideas for the shape of a cc builder here #22 - feat: cc builder - auxolotl/labs - Auxolotl Forge

1 Like

I share this ideal :slight_smile: