[llvm-dev] unable to compile llvm with gcc 4.7.4

Renato Golin via llvm-dev llvm-dev at lists.llvm.org
Mon Oct 17 11:28:24 PDT 2016


On 17 October 2016 at 19:09, Flamedoge via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Just for the interest of discussion, I find it completely weird and
> interesting that GCC needs to build itself 3 times to fully bootstrap. Has
> there been any interest in looking at a single compile build? I don't
> exactly know the limitations, but my naive thinking is that C++14 compiler
> source parsed by C++14 capable compiler and codegen'd to C99 (or older)
> source should make it compilable by older compilers. Is this just a delusion
> or an actually useful idea?

Far from being an expert, my understanding is that this is largely due
to the libraries and tools.

GCC has a reduced sub-set of the compiler that works with many old
compilers, and they build that one first, then use that one to build
the required libraries, tools, and the complete compiler, than use the
complete compiler to bootstrap. You can also have cross-bootstrap, or
Canadian cross, which increase the complexity of the builds by a
reasonable margin.

LLVM doesn't do that because we rely on the system's libraries, which
honestly is a bad habit. This bad habit made the edges between RT,
libc++ and LLVM a bit rough, especially when cross compiling and
re-using those tools to bootstrap. It also makes it very hard to have
stable tests, especially in between "package upgrades".

It should be possible to bootstrap Clang in only two stages, but that
requires a lot of CMake magic if we want to get *all* components
built, including RT, libc++ and lld.

However, none of that mentions the C library, which is a whole new
problem if Clang can't compile it. I believe we still can't compile
the GNU C library, but we can compile Musl (at least for some
targets), so we could include Musl on such a two-stage magical
bootstrap...

But that's a lot of work... :)

cheers,
--renato


More information about the llvm-dev mailing list