-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[Flang] Implicitly add clang if flang enabled. #123964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I would like this but I think some downstreams don't depend on the clang-based driver so might have objections. The difference between this/flang-rt and e.g. clang not adding other things is that clang can use alternatives for all of its dependencies, and does by default on most platforms. There's no alternative runtime to |
If some downstreams don't need Clang, how do they build Flang? CMake currently aborts with FATAL_ERROR. If you try a standalone build, you get:
|
Not sure; I'm not involved personally in any downstream that doesn't use the clang-based driver. I just remember this as the justification previously that we add |
You may still compile the runtime separately, using a standalone build, or you don't even need it for the host platform, only for the target platform (cross-compile). In either case, you need a workaround to not add "flang-rt" implicitly. There isn't one for "clang" and it seems nobody requested one. The position
feels inconsistent to me. |
I agree. I personally think it should all be added implicitly, with flags for not doing so. |
That or the cmake should be fixed so that we don't need clang to be in ENABLE_PROJECTS. We don't actually need all of clang, just specific driver stuff that could be built as dependencies in the cmake without requiring clang in its entirety. |
How does this work when using a pre-built clang (say for a matching version and/or commit)? We need a way to build flang independently of clang, not least because of resource constraints. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/14954 Here is the relevant piece of the build log for the reference
|
This has already been discussed in this thread. If you don't add |
Remove the FLANG_INCLUDE_RUNTIME option which was replaced by LLVM_ENABLE_RUNTIMES=flang-rt. The FLANG_INCLUDE_RUNTIME option was added in #122336 which disables the non-runtimes build instructions for the Flang runtime so they do not conflict with the LLVM_ENABLE_RUNTIMES=flang-rt option added in #110217. In order to not maintain multiple build instructions for the same thing, this PR completely removes the old build instructions (effectively forcing FLANG_INCLUDE_RUNTIME=OFF). As per discussion in https://discourse.llvm.org/t/buildbot-changes-with-llvm-enable-runtimes-flang-rt/83571/2 we now implicitly add LLVM_ENABLE_RUNTIMES=flang-rt whenever Flang is compiled in a bootstrapping (non-standalone) build. Because it is possible to build Flang-RT separately, this behavior can be disabled using `-DFLANG_ENABLE_FLANG_RT=OFF`. Also see the discussion an implicitly adding runtimes/projects in #123964.
This reverts commit 27539c3. Retry with new buildbot configuration after master restart. Original message: Remove the FLANG_INCLUDE_RUNTIME option which was replaced by LLVM_ENABLE_RUNTIMES=flang-rt. The FLANG_INCLUDE_RUNTIME option was added in #122336 which disables the non-runtimes build instructions for the Flang runtime so they do not conflict with the LLVM_ENABLE_RUNTIMES=flang-rt option added in #110217. In order to not maintain multiple build instructions for the same thing, this PR completely removes the old build instructions (effectively forcing FLANG_INCLUDE_RUNTIME=OFF). As per discussion in https://discourse.llvm.org/t/buildbot-changes-with-llvm-enable-runtimes-flang-rt/83571/2 we now implicitly add LLVM_ENABLE_RUNTIMES=flang-rt whenever Flang is compiled in a bootstrapping (non-standalone) build. Because it is possible to build Flang-RT separately, this behavior can be disabled using `-DFLANG_ENABLE_FLANG_RT=OFF`. Also see the discussion an implicitly adding runtimes/projects in #123964.
This reverts commit 27539c3. Retry with new buildbot configuration after master restart. Original message: Remove the FLANG_INCLUDE_RUNTIME option which was replaced by LLVM_ENABLE_RUNTIMES=flang-rt. The FLANG_INCLUDE_RUNTIME option was added in llvm#122336 which disables the non-runtimes build instructions for the Flang runtime so they do not conflict with the LLVM_ENABLE_RUNTIMES=flang-rt option added in llvm#110217. In order to not maintain multiple build instructions for the same thing, this PR completely removes the old build instructions (effectively forcing FLANG_INCLUDE_RUNTIME=OFF). As per discussion in https://discourse.llvm.org/t/buildbot-changes-with-llvm-enable-runtimes-flang-rt/83571/2 we now implicitly add LLVM_ENABLE_RUNTIMES=flang-rt whenever Flang is compiled in a bootstrapping (non-standalone) build. Because it is possible to build Flang-RT separately, this behavior can be disabled using `-DFLANG_ENABLE_FLANG_RT=OFF`. Also see the discussion an implicitly adding runtimes/projects in llvm#123964.
This reverts commit 27539c3. Retry with new buildbot configuration after master restart. Original message: Remove the FLANG_INCLUDE_RUNTIME option which was replaced by LLVM_ENABLE_RUNTIMES=flang-rt. The FLANG_INCLUDE_RUNTIME option was added in llvm#122336 which disables the non-runtimes build instructions for the Flang runtime so they do not conflict with the LLVM_ENABLE_RUNTIMES=flang-rt option added in llvm#110217. In order to not maintain multiple build instructions for the same thing, this PR completely removes the old build instructions (effectively forcing FLANG_INCLUDE_RUNTIME=OFF). As per discussion in https://discourse.llvm.org/t/buildbot-changes-with-llvm-enable-runtimes-flang-rt/83571/2 we now implicitly add LLVM_ENABLE_RUNTIMES=flang-rt whenever Flang is compiled in a bootstrapping (non-standalone) build. Because it is possible to build Flang-RT separately, this behavior can be disabled using `-DFLANG_ENABLE_FLANG_RT=OFF`. Also see the discussion an implicitly adding runtimes/projects in llvm#123964.
This reverts commit 27539c3. Retry with new buildbot configuration after master restart. Original message: Remove the FLANG_INCLUDE_RUNTIME option which was replaced by LLVM_ENABLE_RUNTIMES=flang-rt. The FLANG_INCLUDE_RUNTIME option was added in llvm#122336 which disables the non-runtimes build instructions for the Flang runtime so they do not conflict with the LLVM_ENABLE_RUNTIMES=flang-rt option added in llvm#110217. In order to not maintain multiple build instructions for the same thing, this PR completely removes the old build instructions (effectively forcing FLANG_INCLUDE_RUNTIME=OFF). As per discussion in https://discourse.llvm.org/t/buildbot-changes-with-llvm-enable-runtimes-flang-rt/83571/2 we now implicitly add LLVM_ENABLE_RUNTIMES=flang-rt whenever Flang is compiled in a bootstrapping (non-standalone) build. Because it is possible to build Flang-RT separately, this behavior can be disabled using `-DFLANG_ENABLE_FLANG_RT=OFF`. Also see the discussion an implicitly adding runtimes/projects in llvm#123964.
This reverts commit 27539c3. Retry with new buildbot configuration after master restart. Original message: Remove the FLANG_INCLUDE_RUNTIME option which was replaced by LLVM_ENABLE_RUNTIMES=flang-rt. The FLANG_INCLUDE_RUNTIME option was added in llvm#122336 which disables the non-runtimes build instructions for the Flang runtime so they do not conflict with the LLVM_ENABLE_RUNTIMES=flang-rt option added in llvm#110217. In order to not maintain multiple build instructions for the same thing, this PR completely removes the old build instructions (effectively forcing FLANG_INCLUDE_RUNTIME=OFF). As per discussion in https://discourse.llvm.org/t/buildbot-changes-with-llvm-enable-runtimes-flang-rt/83571/2 we now implicitly add LLVM_ENABLE_RUNTIMES=flang-rt whenever Flang is compiled in a bootstrapping (non-standalone) build. Because it is possible to build Flang-RT separately, this behavior can be disabled using `-DFLANG_ENABLE_FLANG_RT=OFF`. Also see the discussion an implicitly adding runtimes/projects in llvm#123964.
This reverts commit 27539c3. Retry with new buildbot configuration after master restart. Original message: Remove the FLANG_INCLUDE_RUNTIME option which was replaced by LLVM_ENABLE_RUNTIMES=flang-rt. The FLANG_INCLUDE_RUNTIME option was added in llvm#122336 which disables the non-runtimes build instructions for the Flang runtime so they do not conflict with the LLVM_ENABLE_RUNTIMES=flang-rt option added in llvm#110217. In order to not maintain multiple build instructions for the same thing, this PR completely removes the old build instructions (effectively forcing FLANG_INCLUDE_RUNTIME=OFF). As per discussion in https://discourse.llvm.org/t/buildbot-changes-with-llvm-enable-runtimes-flang-rt/83571/2 we now implicitly add LLVM_ENABLE_RUNTIMES=flang-rt whenever Flang is compiled in a bootstrapping (non-standalone) build. Because it is possible to build Flang-RT separately, this behavior can be disabled using `-DFLANG_ENABLE_FLANG_RT=OFF`. Also see the discussion an implicitly adding runtimes/projects in llvm#123964.
Clang is required to compile Flang. Instead of erroring-out if Clang is enabled, for convinience implicitly add it to
LLVM_ENABLE_PROJECTS
, consistent with how the MLIR dependency is handled.This is mainly intended as a discussion about whether
LLVM_ENABLE_RUNTIMES=flang-rt
(#110217) is to be enabled implicitly as well (https://discourse.llvm.org/t/buildbot-changes-with-llvm-enable-runtimes-flang-rt/83571/2). If yes, not implicitly enabling Clang would be inconsistent with how the MLIR and flang-rt dependency are enforced.I'd prefer to not do so implicitly:
LLVM_ENABLE_PROJECTS and LLVM_ENABLE_RUNTIMES are user-controlled. Overwriting them takes away from their decision. I would expect to have only those projects/runtimes to be built that I have specified.
The global variable LLVM_ENABLE_PROJECTS and the CMakeCache.txt entry for LLVM_ENABLE_PROJECTS are different entities. How it is implemented, the global LLVM_ENABLE_PROJECTS shadows the cache entry, so they have two different values. This adds to confusion. Overwriting the cache value with
FORCE
option would cause CMake to re-run a second time. Better get it right the first time.The buildbots use the settings
depends_on_projects=[..]
(which the values ofLLVM_ENABLE_PROJECTS
andLLVM_ENABLE_RUNTIMES
is derived from). Ifclang
,mlir
, orflang-rt
is not specified there, the buildbot will not trigger a rebuild if files in those directories have been changed.For
LLVM_ENABLE_RUNTIMES
, including flang-rt, it is possible to build the runtime separately/out-of-tree/standalone, or not for the default target for whatever reason, in which case the implicit addition ofLLVM_ENABLE_RUNTIMES=flang-rt
must be again disabled somehow. This adds to the complexity to the build system.LLVM_ENABLE_PROJECTS=clang
also does not implicitly add any project/runtime that is technically required for a complete toolchain, such aslld
,compiler-rt
,libc
,libcxx
,libcxxabi
,unwind
.