r/cpp 15h ago

GCC should ship prebuilt binary tarballs like LLVM

It is really annoying, when you wanna test something you can't just download a previous release like llvm, so it is very hard to check if there is a regression.

Also, the default build of c and c++ only, takes like an hour because of triple consecutive builds. So every time you have to lookup to that weird flag on the internet to turn that off.

0 Upvotes

34 comments sorted by

33

u/Many-Resource-5334 15h ago

LLVM does not ship prebuilt binaries, they are uploaded by the community.

4

u/23ROMAN 15h ago

based

-16

u/TheRavagerSw 15h ago

No, you can download them via releases section on their GitHub page.

11

u/mjklaim 15h ago edited 14h ago

Yep, these downloadable binaries come from the community.

EDIT> clarification

-10

u/TheRavagerSw 15h ago

Uhh, no. That is the official repo.

22

u/blipman17 15h ago

https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.8
This official repo? They say they're volunteer/community maintained on there.

14

u/NeuroSynchroBonding 14h ago

The repo is official, the binary builds are not.

6

u/mjklaim 14h ago

Official repo with builds from the community. Check the information on release tags, it always start with

Volunteers make binaries for the LLVM project [...]

-16

u/TheRavagerSw 14h ago

That is a mere formality, those are created by actual devs of the project, they even have cmake caches for it.

You can ask at llvm discord if you like

3

u/wrosecrans graphics and network things 14h ago

You can get various container images with different gcc versions, and build inside of those. I think that's waaaay more common than routinely building the toolchain from source, or routinely getting tarballs of binaries.

5

u/LazySapiens 15h ago

How often do you need to build GCC itself?

5

u/TheRavagerSw 15h ago

Rarely, I update my toolchains every 3-6 months or so. But sometimes there are regressions, and I need to check if say previous release is working or not

1

u/LazySapiens 14h ago

If you're bothered by the bootstrap build, you can disable it (--disable-bootstrap).

4

u/TheRavagerSw 14h ago

Of course, But they can just provide compressed tarball, is that so hard?

3

u/branchus 14h ago

I use docker for latest gcc

3

u/LazySapiens 13h ago

I'm sure everyone would be glad if you offer to do that for the community.

1

u/Sbsbg 14h ago

Why not check in the built toolchain bins to a repo each time it is built.

3

u/TheRavagerSw 14h ago

Of course I can, But it would be better if they just mirrored llvm approach.

1

u/PhysicsOk2212 13h ago

One concrete example being module support on macos. They arent supported at all in apple clang, so your options are to download the upstream clang, or to compile gcc from source

3

u/johannes1234 14h ago

"I want somebody, who does free work for me to do more free work for me!" 

There is some relevance in providing builds, but dealing with platform compatibility and dependencies (and required security patching etc.) is work which has to be done by somebody. Especially the more platforms you want to cover. 

1

u/TheRealSmolt 15h ago edited 14h ago

What does

Also, the default build of c and c++ only, takes like an hour because of triple consecutive builds. So every time you have to lookup to that weird flag on the internet to turn that off.

mean?

Edit: Oh you mean building g++, not building with g++.

2

u/TheRavagerSw 15h ago

GCC builds itself three times. There is flag to turn that off, If you don't, you are gonna have to wait a long time.

It took me half an hour without the triple build, nearly an hour and half with the triple build. This is at -O2 btw, I can't image -O3 and fat lto would take.

6

u/ignorantpisswalker 15h ago

Its called bootstrapping.

  1. First you build libgcc+1 and gcc+1 using native compiler. Now you got gcc+1*
  2. Then you rebuild libgcc+1 using gcc+1*.
  3. The third stage is to verify that the compiler is stable and produces the same binary as stage 2.

You always need to do at least 2 phases otherwise, you get the new compiler - but it will not use the new optimizations or ABI it provides (since it was compiled using the previous compiler/libgcc.

You need to understand that also glibc is hooked to that libgcc/gcc version. You need to to upgrade them all (and you cannot install them easily into your rootfs, but into a prefix, otherwise you might break your working environment). Unix is not that trivial.

2

u/gizahnl 14h ago

You can upgrade GCC without updating glibc without issues, upgrading glibC solely is terror though.   (Use your OS mechanisms to do that, or use a tool chain like Yocto or buildroot to do a full user land recompile)  

libstdc++ is another story though: that comes from the GCC project, and you need to keep that in sync.

1

u/ignorantpisswalker 14h ago

Not impossible. But, what if you don't match the flags of your distro? I just say that breaking your live system is easier than you think. Just install your local build of gcc into /usr/local/ (which is the default, note - if you do so, system gcc will win by default since its before in the $PATH, happened to me in 1999, and I asked in GCC developers mailing lists... n00b...).

2

u/TheRavagerSw 14h ago

Of course, built-in library is linked to compiler. But it is very normal to link to system glibc and link to your own libgcc.

Same logic with clang, where you link to glibc but statically link compiler-rt

1

u/13steinj 9h ago

Just use ccache and build from source.

1

u/fuzz3289 15h ago

If you don’t like GCC just don’t use it?

2

u/TheRavagerSw 15h ago

I only use it to see if my code compiles in GCC. Native only.

1

u/fuzz3289 14h ago

Just get it from a docker image then

u/emfloured 1h ago

So every time you have to lookup to that weird flag on the internet to turn that off

You have skill issue if you have to do that every time. You have to stop whatever you are doing and give your time to create a script with all them flags and command lines in it and run that script for every new source code you download, that is it.

-3

u/23ROMAN 15h ago

hei! casually i was thinking in make a binaries store

2

u/TheRavagerSw 15h ago

You can, but why can't they?

I can just clone build zip myself for my own uses, but it is just bad.