<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br></div><div><br>On Jun 14, 2016, at 10:19 AM, Renato Golin <<a href="mailto:renato.golin@linaro.org">renato.golin@linaro.org</a>> wrote:<br><br></div><blockquote type="cite"><div><span>On 14 June 2016 at 17:40, Chris Bieneman <<a href="mailto:beanz@apple.com">beanz@apple.com</a>> wrote:</span><br><blockquote type="cite"><span>The problem comes from that fact that generally builds are structured as configure -> build. What we actually need is "configure some" -> "build some" -> "configure some more" -> "build some more" -> repeat until done.</span><br></blockquote><span></span><br><span>Well, GCC has been doing this for years, and I have just setup a</span><br><span>simpler version of it here:</span><br><span></span><br><span><a href="http://buildmaster.tcwglab.linaro.org/builders/clang-cmake-aarch64-prototype">http://buildmaster.tcwglab.linaro.org/builders/clang-cmake-aarch64-prototype</a></span><br><span></span><br><span>To avoid the partial configuration problem, you can build in multiple</span><br><span>stages and increment the level of support in each one until you have a</span><br><span>complete toolchain in the end.</span><br></div></blockquote><div><br></div><div>I'm not really familiar with GCC's build, but I assume it isn't too conceptually different from what we need to be doing. The biggest difference is that we're using CMake.</div><div><br></div><blockquote type="cite"><div><span></span><br><span></span><br><blockquote type="cite"><span>For our projects the first step of a bootstrap is building a clang that runs on host supporting the target. After building that clang you need to build the runtime libraries. For sake of simplicity let's assume we're only building compiler-rt's current libraries. After building clang the logical step would be CMake + Ninja for compiler-rt then you're done right? Except, that doesn't work. You can't *configure* the sanitizer build until after you've fully configured and built the builtin libraries.</span><br></blockquote><span></span><br><span>Another reason to move the sanitizers to their own repo.</span><br><span></span><br><span></span><br><blockquote type="cite"><span>If you configure a project before the tools and libraries are available your configuration system may make the wrong decisions. To put it in more normal compiler terminology, it is undefined behavior.</span><br></blockquote><span></span><br><span>So, IIUC, the GCC guys have worked around that problem by defining the</span><br><span>environment with more rigour that we do. It *is* different to build</span><br><span>LLVM with glibc X instead of X+1, and the same is true for all</span><br><span>dependencies.</span><br><span></span><br><span>There isn't a strong reason why we can't do the same, we just don't do</span><br><span>it because people want to build LLVM in very different architectures.</span><br><span></span><br><span>So, a simpler proposal would be to have a long matrix of tools we need</span><br><span>versus OS we build on and mark the accepted range (or single version)</span><br><span>that you need to have to build it on that particular platform.</span><br><span></span><br><span>Different people might have different toolsets, and that's fine. We</span><br><span>can easily have an entry for Ubuntu and another for Suse, or even one</span><br><span>to Ubuntu X and another for Ubuntu X+1.</span><br><span></span><br><span>Other than doing that, you can't rely on your first stage Clang+LLVM</span><br><span>only build if you have no idea which system compiler was used anyway.</span><br><span>Differences will dilute over the later stages, and ultimately, if you</span><br><span>build enough of them, they'll end up virtually identical. But</span><br><span>validation on those terms become very costly.</span><br></div></blockquote><div><br></div><div>We actually have a validation that the second and third clang builds are identical running on a bot (<a href="lab.llvm.org:8011/builders/clang-3stage-ubuntu">lab.llvm.org:8011/builders/clang-3stage-ubuntu</a>).</div><div><br></div><div>Mike Edwards set that up a while back, and it is really great.</div><div><br></div><div>In Apple's release process for clang we always build clang twice to ensure that the compiler we're shipping is effectively built with itself.</div><div><br></div><div>-Chris</div><br><blockquote type="cite"><div><span></span><br><span></span><br><blockquote type="cite"><span>We have viable workarounds for this in our build today. We can extend these workarounds to make bootstrapping simpler. There are some rough edges that are caused by limitations in CMake, but there is no fundamental limitation in CMake that makes this not work.</span><br></blockquote><span></span><br><span>This is good news! :)</span><br><span></span><br><span></span><br><blockquote type="cite"><span>At Apple we workaround this by having some out-of-tree script goop that configures and builds clang, then configures and builds the builtins, then configures and builds the runtimes. Due to complications interfacing with our internal build system, we'll likely always have that script goop, but I'd really like to be able to run clean bootstrap builds against open source without the crazy complications.</span><br></blockquote><span></span><br><span>That'd probably help other downstream users as well.</span><br><span></span><br><span></span><br><blockquote type="cite"><span>I believe that splitting compiler-rt's sanitizer libraries and builtin archives into separate projects will allow the project structure to more clearly represent the way it fits into the project build graph. It is not strictly necessary for anything, so if people generally don't agree I won't fight for it.</span><br></blockquote><span></span><br><span>I think my general feeling of this thread is that most people agree</span><br><span>with the idea. I personally do.</span><br><span></span><br><span>+1 from me.</span><br><span></span><br><span>cheers,</span><br><span>--renato</span><br></div></blockquote></body></html>