-
Notifications
You must be signed in to change notification settings - Fork 15k
[llvm][cmake] Add clang if not already present when building lldb #149055
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
Fixes llvm#54555 We could do what flang does and enable clang automatically, but I personally prefer making the user make the choice. Also from a buld requirements perspective, flang is a bigger build than clang. So if you're already set on building flang, clang should be within your budget too. lldb is smaller than clang.
As suggested by @labath #54555 (comment). |
@llvm/pr-subscribers-lldb Author: David Spickett (DavidSpickett) ChangesFixes #54555 We could do what flang does and enable clang automatically, but I personally prefer making the user make the choice. Also from a buld requirements perspective, flang is a bigger build than clang. So if you're already set on building flang, clang should be within your budget too. lldb is smaller than clang. Full diff: https://github.com/llvm/llvm-project/pull/149055.diff 1 Files Affected:
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 3f8201fa426fe..bf52533abe525 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -179,6 +179,12 @@ if ("flang" IN_LIST LLVM_ENABLE_PROJECTS)
endif ()
endif()
+if ("lldb" IN_LIST LLVM_ENABLE_PROJECTS)
+ if (NOT "clang" IN_LIST LLVM_ENABLE_PROJECTS)
+ message(FATAL_ERROR "Clang is not enabled, but is required for lldb.")
+ endif ()
+endif ()
+
if ("libc" IN_LIST LLVM_ENABLE_PROJECTS)
message(WARNING "Using LLVM_ENABLE_PROJECTS=libc is deprecated. Please use "
"-DLLVM_ENABLE_RUNTIMES=libc or see the instructions at "
|
You might wonder what a standalone build does when clang isn't in the base build, I also wonder this because I have not been able to get it to build at all :) So I might do a follow up for standalone if I can work around the problems. |
I would prefer that too, but I think there's also value in consistency. Unless you're really set on this, I think we should do what flang does. |
I've done it the flang way. |
User error on my part, it works fine and because it uses CMake's config mechanism to find clang it does fail in a reasonable way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. IIUC this works for the standalone build because when building LLDB, we point it to llvm-project/lldb
as the CMake root and don't specify LLVM_ENABLE_PROJECTS
I think that's right. I will double check that this doesn't make the "standalone" lldb in fact build clang as well. |
I'm okay with merging this and keeping an eye on https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/lldb-cmake-standalone/ which covers all the standalone scenarios we officially support. |
It does not. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/18/builds/19135 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/198/builds/6231 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/38425 Here is the relevant piece of the build log for the reference
|
Fixes #54555
This follows flang's pattern, it adds clang if you don't have it in LLVM_ENABLE_PROJECTS.