Daniel Berlin via llvm-dev
2016-Oct-17 18:44 UTC
[llvm-dev] unable to compile llvm with gcc 4.7.4
On Mon, Oct 17, 2016 at 11:28 AM, Renato Golin via llvm-dev < llvm-dev at lists.llvm.org> wrote:> 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 know renato did not write this, but i'll just answer this here) This is deliberate and necessary if you want to be sure. You can do a single compile build by just "not bootstrapping". The reason boostrapping is 3 stages is to find optimizer bugs. stage 1: Compile new compiler stage 2: Compile self with new compiler // IE detect any obvious bugs in new compiler, like ICE, etc stage 3: Compiler self with stage 2 compiler // IE detect miscompiles caused by new compiler being broken Stage 2 and 3 should be identical, if they aren't, you have a minimum of non-determinism, and more likely, a codegen bug somewhere. Otherwise, stage2 could be very broken and you may not notice, because the compiler has relatively few compile + execute tests (since they are very hard to write) Instead, they rely on the one large execution test they know they can use: the compiler itself. Note that 3 stage bootstraps are a technique that predates gcc :)> 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.This is not correct :) First stage of gcc is the entire compiler, not a subset or a different compoiler. 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 > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161017/7c96ab41/attachment.html>
Renato Golin via llvm-dev
2016-Oct-17 20:41 UTC
[llvm-dev] unable to compile llvm with gcc 4.7.4
On 17 October 2016 at 19:44, Daniel Berlin <dberlin at dberlin.org> wrote:> First stage of gcc is the entire compiler, not a subset or a different > compoiler.I didn't mean a different compiler, just not a full "toolchain". As far as my knowledge of Linaro's process goes, stage 1 uses the system libraries and tools (could be cross), and they use the stage 1 to build the intended versions of the libraries and tools (stage 1.5?), and use that "incomplete" build + new libraries and tools to build stage 2. Stage 3 should be identical, for verification processes. The difference with LLVM is that we don't build the libraries with stage 1's Clang, but the system compiler/tools/libraries as well, making it a simple 2-stage build, as opposed to a 2.5 stage build. When it comes to the C libraries, we don't even build them at all, and use the system libraries even on stage 2. cheers, --renato
Renato Golin via llvm-dev
2016-Oct-17 20:55 UTC
[llvm-dev] unable to compile llvm with gcc 4.7.4
On 17 October 2016 at 21:41, Renato Golin <renato.golin at linaro.org> wrote:> On 17 October 2016 at 19:44, Daniel Berlin <dberlin at dberlin.org> wrote: >> First stage of gcc is the entire compiler, not a subset or a different >> compoiler. > > I didn't mean a different compiler, just not a full "toolchain".Apparently, those constraints only apply to cross-bootstrap, which is the bulk of what we do at Linaro. :) Sorry for the noise. --renato
Daniel Berlin via llvm-dev
2016-Oct-17 21:01 UTC
[llvm-dev] unable to compile llvm with gcc 4.7.4
On Mon, Oct 17, 2016 at 1:41 PM, Renato Golin <renato.golin at linaro.org> wrote:> On 17 October 2016 at 19:44, Daniel Berlin <dberlin at dberlin.org> wrote: > > First stage of gcc is the entire compiler, not a subset or a different > > compoiler. > > I didn't mean a different compiler, just not a full "toolchain". >Ah. You said "GCC has a reduced sub-set of the compiler that works with many old compiler". This is the part i meant is not correct anymore. It does not have a reduced subset. This was kind of true at one point. It used to be that the C compiler even worked with K&R through conversion. Nowadays, even this has fallen by the wayside.> > As far as my knowledge of Linaro's process goes, stage 1 uses the > system libraries and tools (could be cross), and they use the stage 1 > to build the intended versions of the libraries and tools (stage > 1.5?),Yes.> and use that "incomplete" build + new libraries and tools to > build stage 2.I wouldn't call it "incomplete". In most cases, it includes all compilers and languages and libraries :)> Stage 3 should be identical, for verification > processes. >Yes.> > The difference with LLVM is that we don't build the libraries with > stage 1's Clang, but the system compiler/tools/libraries as well, > making it a simple 2-stage build, as opposed to a 2.5 stage build. > When it comes to the C libraries, we don't even build them at all, and > use the system libraries even on stage 2. > > cheers, > --renato >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161017/d7c897ee/attachment.html>