<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr">The proposal I have has nothing to do with you can build and what you will be. Nothing is changed. Maybe the terminology standalone/full build is misleading.</div><div dir="ltr"><br></div><div dir="ltr">The correct term is probably a full configuration (requires llvm subdirectory) vs standalone configuration (with only project’s own subdirectory). I would like to see them become one to avoid maintenance cost and mistakes.</div><div dir="ltr"><br></div><div dir="ltr">Steven</div><div dir="ltr"><br><blockquote type="cite">On Jun 18, 2020, at 5:22 PM, Manoj Gupta <manojgupta@google.com> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 18, 2020 at 2:41 PM Steven Wu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On Jun 18, 2020, at 2:25 PM, Tom Stellard <<a href="mailto:tstellar@redhat.com" target="_blank">tstellar@redhat.com</a>> wrote:<br>
> <br>
> On 06/18/2020 11:27 AM, Steven Wu via llvm-dev wrote:<br>
>> I like the proposal but I would like to go even further. If we are going to create a top level CMake file, we should just go ahead and eliminate all the standalone build configuration. The standalone build should just be `cmake <monorepo-root> -DLLVM_ENABLE_PROJECTS=standalone-project ...`. That means less build configuration to maintain which is always good.<br>
>> <br>
> <br>
> Eliminating stand-alone builds would be an inconvenience for<br>
> us in Fedora, since this is how we build LLVM packages.<br>
> However, I think we may have different definitions of what a<br>
> stand-alone build is.<br>
> <br>
> Does your proposal mean that<br>
> `cmake <monorepo-root> -DLLVM_ENABLE_PROJECTS=lld ..` would build lld<br>
> only without llvm and be a replacement for what I consider to<br>
> be a stand-alone build, which is `cmake <monorepo-root>/lld ...` </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Let me clear up the terminology here. In current llvm-project, we have a full build and standalone build. Let say for libcxx (using libcxx or other runtime libraries because they can build without anything from llvm subdirectory).<br>
<br>
This is a full build that can produce libcxx dylib:<br>
`cmake <monorepo-root>/llvm -DLLVM_ENABLE_PROJECTS=llvm;libcxx -DLLVM_DISTRIBUTION_COMPONENTS=libcxx.dylib ...`<br>
<br>
This is a standalone build that doesn't pull in anything from llvm directory:<br>
`cmake <monorepo-root>/libcxx -D...`<br>
<br>
Those two cmake configurations are going down different path and can result in different behavior if not careful. The goal is just turning those into one configuration. You can still do a standalone build of runtime library by enabling just that project and it is going to produce the same build configuration as the full build.<br></blockquote><div><br></div><div>Can you clarify what is going to be built with `cmake <monorepo-root> -DLLVM_ENABLE_PROJECTS=libcxx ? </div><div><br></div><div>We need to cross-compile the libraries using the pre-installed clang in SDK and have to use the standalone builds i.e. cmake <monorepo-root>/libcxx. We do not wish to rebuild llvm or clang when cross-compiling the libraries.</div><div>If cmake <monorepo-root> -DLLVM_ENABLE_PROJECTS=libcxx is going to build more than libcxx, it is a *big* no-go for us (Chrome OS). Same for other libraries like libcxxabi/libunwind.</div><div><br></div><div>Also, we do not currently link libc++ with llvm's libunwind as it misses many functionalities provided by libgcc_s/libgcc_eh in particular on ARM32 (related to GCC/GLIBC extensions) and ARM was not willing to invest in that. </div><div>So, whilte it'd be nice to build libc++abi/libc++/libunwind in a single innovation, linking with libunwind should NOT be mandatory.</div><div><br></div><div>Thanks,</div><div>Manoj</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Steven<br>
<br>
> <br>
> -Tom<br>
> <br>
>> That also means that we can refactor some of the cmake modules to put into the top level directories so sub-projects can just reuse them without duping the code worrying they are not available in the standalone build today.<br>
>> <br>
>> Steven<br>
>> <br>
>>> On Jun 18, 2020, at 10:57 AM, Louis Dionne via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a> <mailto:<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>> wrote:<br>
>>> <br>
>>> Hi folks,<br>
>>> <br>
>>> Building any LLVM project currently requires invoking CMake inside <monorepo-root>/llvm, while setting the projects to enable in the LLVM_ENABLE_PROJECTS variable. This has the downside that CMake processing for the LLVM subproject happens even when one doesn't really need or want it. It's also not great from a build hygiene perspective, as LLVM globally sets some flags and subprojects pick them up, when they don't really mean to. For example, see this workaround: <a href="https://github.com/llvm/llvm-project/blob/master/libcxx/CMakeLists.txt#L503-L507" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/blob/master/libcxx/CMakeLists.txt#L503-L507</a>, where we need to account for some flags that might have been set globally by LLVM.<br>
>>> <br>
>>> I'm not sure about other projects, however this is quite problematic for projects part of the C++ runtime (libc++/libc++abi/libunwind). Indeed, we often try to build those projects targetting not widely supported platforms, where the overall LLVM build doesn't work. For example, trying to use the LLVM_ENABLE_PROJECTS approach for building libc++ for Apple's DriverKit environment doesn't work, since it has a few unusual things that the LLVM build chokes on. However, building libc++ standalone works just fine because it has far fewer requirements. It's also not just an issue of working vs not working: because of global flag pollution, building libc++ standalone and as part of the rest of LLVM can result in slightly different flags being used, which could cause important and hard-to-diagnose issues.<br>
>>> <br>
>>> Hence, I think we should introduce a way to build LLVM projects (or at least the runtimes) without going through <monorepo-root>/llvm/CMakeLists.txt. What I suggest is to have a top-level <monorepo-root>/CMakeLists.txt whose sole job is to include subprojects. We could also place basic LLVM-wide things like the check for the minimum CMake version there. More specifically, I would like to be able to do:<br>
>>> <br>
>>> $ cd <monorepo-root><br>
>>> $ mkdir build<br>
>>> $ (cd build && cmake <monorepo-root> -DLLVM_ENABLE_PROJECTS="<projects-to-enable>")<br>
>>> <br>
>>> Pretty much the only difference with today is that you'd use `cmake <monorepo-root>` instead of `cmake <monorepo-root>/llvm`.<br>
>>> <br>
>>> Like I said, this is a problem for the runtime projects, but I'm not sure about other projects. For the runtime projects, another option would be to only allow standalone builds. However, the runtime projects are often built in lockstep, and so running three CMake commands when one would suffice is both annoying and also an easy way to screw things up. Furthermore, the current standalone builds add complexity to the projects, because they require the ability to point to arbitrary headers/libraries from the other projects, when we really always want to point to the just-built ones.<br>
>>> <br>
>>> Relationship with Petr Hosek's "Runtimes" build<br>
>>> ---------------------------------------------------------------<br>
>>> What I'm proposing isn't a replacement for itl. The "Runtimes" build can be seen as a driver that sets up the individual libc++/libc++abi/libunwind builds with the just-built toolchain, and for the provided targets. That's really great, however it is built *on top of* the basic libc++/libc++abi/libunwind builds. So basically, after my proposal, the "Runtimes" build could simply build all elements from the runtime with a single CMake invocation, as opposed to multiple invocations.<br>
>>> <br>
>>> Thoughts?<br>
>>> Louis<br>
>>> <br>
>>> _______________________________________________<br>
>>> LLVM Developers mailing list<br>
>>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a> <mailto:<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
>>> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
>> <br>
>> <br>
>> <br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
>> <br>
> <br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>
</div></blockquote></body></html>