It's not a work-around
These are points of view, for me, as much as I am forced to do for work-related things exactly what you are talking about, having to resort to frozen "ecosystems" ... is a clear sign that there is something wrong in the IT industry

I mean, I don't want to appear arrogant, but you are talking to a person who created his own C-like compiler, and I didn't write it so badly that I had to force my future self to have to freeze the rootfs in which it was compiled, and chroot into in order to recompile it again.
It was a project objective right from the start, which cost me more time, but was of vital importance, and I can compile myC on a 2005 stage4 (Gentoo Beta-1!!!), the one I still have on my old laptop, just as I can compile on a 2024 stage4, and there is no problem, since it doesn't even use any tricks that are "compiler-dependent" or "ecosystem-dependent".
With gcc...it's not possible. I understand that it is an immensely more complex and larger project than myC, but I also wonder... what reason should there be to persist in wanting to omit a flag that enables or disables the automatic generation of documentation? It was reported several times by several people from several GNU/Linux distro that is problematic as that part, talking about Gentoo, it causes compilation to fail, which in turn causes emerge to fail, and people wasted months of time breaking ebuilds in a vague attempt to find temporary fixes, until the sad decision to make a patch to forcibly remove it!
... patch that has always been despised because it shouldn't remove any doc-gen (like man1, man2, ...)
Gcc is a great compiler, but it sucks as project for how it is written and organized, and it sucks not only on GNU/Linux, but it sucks even more on BeOS{x86, ppc} and zOS{x86}, where you necessarily have to use old versions v2.95 and v3.1. On Haiku{x86, arm, riscv}, modern BeOS, things are a little better, but the compatibility patches obscenely break between gcc v9 and later. And it's a recurring pattern that repeats itself. Over and over.
the only professional thing to do to ensure you can support and enhance or bugfix old software years or decades later is to archive the entire original environment it was built in, including not only compilers etc but also the OS.
Yup. Compiling the linux kernel has the same problem as compiling gcc: both are "
highly ecosystem dependent", so what you described is exactly what Windriver does: they VMs or miniroots of the various compilers { Gcc, Diab, ...}, including the whole ecosystem.
For very old projects, like
Tornado (decomissioned), they only provide a VM, simply because it is more convenient and quicker for those who have to take up very old projects again. We're talking about things before 2001, with all the tools (especially ICEs, profilers, etc) and configuration already ready.
Also, due to the terrible nature of
Eclipse, another project that sucks, Windriver prefers to release VMs containing the VxWorks sources along with the toolchains { Gcc, Diab, ...} with their native ecosystem. All ready, all configured, whoever receives the DVDROM or USB stick doesn't have to waste a minute.
Usually, there is a table that shows, for each target, which VMs support it, organized by the semester of release.
E.g. 2004-1 covers everything up to July, while 2004-2 covers everything up to December.
Nice idea! Their archives range from 2010 to 2024, and from 1997 to 2009 for older stuff.
You choose the VM, start it, and you are faced with a graphical environment with the IDE and everything else.
-
However, on Gentoo
you can't do that without breaking the underlying philosophy. And in the end, for what I needed, it took me only 3 months, with an excellent result: everything integrated, I can emerge and integrate it on any future stage4, at least until 2027
Yes, but that is trying to shovel excrement uphill. You might with a lot of time and effort be able to make it work, but it's 1) very likely not worth it, and 2) may be simply too hard to make work at all, and 3) will not result in being able to generate the same artefacts again.
Umm, it's as if I soaked the gcc sources in *bleach* for a long time. Bleach... cleans and disinfects but cooks the fabrics to the point that clean cuts are needed to save what can be saved.
In fact, how will I get to you in a bit... the cuts were deep and very little was saved ...
C3750 mybuilder-2023 # ./mybuild info all
BC success: m6811-elf, binutils v2.34, gcc v3.3.6-s12x, mini mode
BC success: m68k-elf, binutils v2.34, gcc v9.3.0, mini mode
BC success: m88k-coff, binutils v2.16.1, gcc v3.1.1, mini mode
BC success: mips-elf, binutils v2.24, gcc v9.3.0, mini mode
BC success: mipsel-elf, binutils v2.34, gcc v4.7.0, mini mode
BC success: mips64-elf, binutils v2.24, gcc v9.3.0, mini mode
BC success: powerpc-elf, binutils v2.24, gcc v9.3.0, mini mode
BC success: powerpc-eabi, binutils v2.24, gcc v9.3.0, mini mode
BC success: arm-eabi, binutils v2.24, gcc v9.3.0, mini mode
BC success: arm-thumb-elf, binutils v2.24, gcc v4.7.0, mini mode
BC success: sh2-elf, binutils v2.24, gcc v9.3.0, mini mode
BC success: sh4-elf, binutils v2.24, gcc v9.3.0, mini mode
BC success: riscv32-elf, binutils v2.39, gcc v9.3.0, mini mode
BC success: hppa-elf, binutils v2.24, gcc v9.3.0, mini mode
BC success: mcore-elf, binutils v2.24, gcc v9.3.0, mini mode
BC success: i960-coff, binutils v2.16.1, gcc v3.1.1, mini mode
BC success: msp430-elf, binutils v2.39, gcc v9.3.0, mini mode
(we are talking about these targets, and these specific versions ... and note ... m88k and i960 are not even elf)
It took me several years to fix the sources, which I not only cleaned, but also hacked in depth to better adapt them to my personal philosophy, e.g. I want gcc to be "position independent" with respect to where you install the binaries, and about 3 months to create the builder (Bash + Lua scripts + C utils) and test the compilers.
Wasn't it worth it? well... also consider that the goals here are
- have all those compilers on HPPA and on MIPS, where you generally don't find any old versions
- have all those compilers integrated into the current rootfs, no need for VM or chroot to miniroot
- being able to compile them in much less time, about 1/20 of the time required by the vanilla versions
- compile and install only the minimum that is really needed to compile c files
Goals achived, but you are absolutely right: there is a
salt price to pay!

Not only your time and effort, but ... as you can see the builder reports "gcc0", which, given how the gcc project is organized, means that it compiles a version of cc1 with a minimal collector.
In short, it won't work out of the box, and it will never work with anything except c/89.
Forget { Ada, Fortran, objC, ... } and other cores ...
And it also means that you then have to write your own "gcc" which passes "gcc0" (which in turns call cc1) the right parameters and also manages the preprocessor; so I wrote a collector, which works about the same as gcc's, but is much simpler.
This, in addition to brutally discontinuing all support for the libC library, which matters little to me, since I have my own.