[llvm] [bazel] Fix building lldb without libedit (PR #184535)

Keith Smiley via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 17:57:18 PST 2026


https://github.com/keith created https://github.com/llvm/llvm-project/pull/184535

We were always trying to compile the libedit file even if it wasn't used
because we were missing this conditional from cmake:

https://github.com/llvm/llvm-project/blob/630b9570d199dca19dc85834f583bc8590a21876/lldb/source/Host/CMakeLists.txt#L57-L61


>From 37bde61cc5639c538f9ed2ec70850551de48301b Mon Sep 17 00:00:00 2001
From: Keith Smiley <keithbsmiley at gmail.com>
Date: Tue, 3 Mar 2026 17:56:13 -0800
Subject: [PATCH] [bazel] Fix building lldb without libedit

We were always trying to compile the libedit file even if it wasn't used
because we were missing this conditional from cmake:

https://github.com/llvm/llvm-project/blob/630b9570d199dca19dc85834f583bc8590a21876/lldb/source/Host/CMakeLists.txt#L57-L61
---
 .../llvm-project-overlay/lldb/BUILD.bazel     | 26 ++++++++++++++-----
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel b/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
index 45a700dde3dbd..22e3a8a2afc14 100644
--- a/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
@@ -526,9 +526,12 @@ objc_library(
 
 cc_library(
     name = "Host",
-    srcs = glob([
-        "source/Host/common/**/*.cpp",
-    ]) + select({
+    srcs = glob(
+        [
+            "source/Host/common/**/*.cpp",
+        ],
+        exclude = ["source/Host/common/Editline.cpp"],
+    ) + select({
         "@platforms//os:linux": glob(
             [
                 "source/Host/posix/**/*.cpp",
@@ -542,11 +545,17 @@ cc_library(
                 "source/Host/posix/**/*.cpp",
             ],
         ),
+    }) + select({
+        ":libedit_enabled": ["source/Host/common/Editline.cpp"],
+        "//conditions:default": [],
     }),
-    hdrs = [":ConfigHeader"] + glob([
-        "include/lldb/Host/*.h",
-        "include/lldb/Host/common/*.h",
-    ]) + select({
+    hdrs = [":ConfigHeader"] + glob(
+        [
+            "include/lldb/Host/*.h",
+            "include/lldb/Host/common/*.h",
+        ],
+        exclude = ["include/lldb/Host/Editline.h"],
+    ) + select({
         "@platforms//os:macos": glob([
             "include/lldb/Host/macosx/*.h",
             "include/lldb/Host/posix/*.h",
@@ -555,6 +564,9 @@ cc_library(
             "include/lldb/Host/linux/*.h",
             "include/lldb/Host/posix/*.h",
         ]),
+    }) + select({
+        ":libedit_enabled": ["include/lldb/Host/Editline.h"],
+        "//conditions:default": [],
     }),
     features = ["-layering_check"],  # histedit.h breaks this.
     includes = ["include"],



More information about the llvm-commits mailing list