Skip to content

Commit 1b53ea0

Browse files
committed
clang: Disable building dexp in clang-native
Building dexp (native) on Debian 11 causes intermittent failure[0]. This tools in not used in clang except in tests (that we don't run). So, disable building this tool by encapsulating its build in a cmake option and then in a PACKAGECONFIG. Users sure of not using Debian 11 (or the impacted g++ compiler) can turn this config on safely. Only the -native* variants change. Dexp is still enabled by default for target. [0]: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15803 Signed-off-by: Yoann Congal <[email protected]>
1 parent 65da70e commit 1b53ea0

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
From 66011b9d3b8ef4fce5d70f11a381e7cc83dff4c8 Mon Sep 17 00:00:00 2001
2+
From: Yoann Congal <[email protected]>
3+
Date: Tue, 25 Mar 2025 22:25:55 +0100
4+
Subject: [PATCH] clangd: Add a build option to disable building dexp
5+
6+
Building dexp on Debian 11 currently causes intermittent failure[0][1].
7+
8+
Adding the CLANGD_BUILD_DEXP option to disable dexp from the build
9+
allows Debian 11 users to build clang (albeit without the dexp tool).
10+
11+
This option is set to "Build Dexp" by default so, no change is expected
12+
without manual setting.
13+
14+
[0]: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15803
15+
[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1101322
16+
17+
Upstream-Status: Submitted [https://github.com/llvm/llvm-project/pull/133124]
18+
Signed-off-by: Yoann Congal <[email protected]>
19+
---
20+
clang-tools-extra/clangd/CMakeLists.txt | 6 +++++-
21+
clang-tools-extra/clangd/test/CMakeLists.txt | 7 +++++--
22+
clang-tools-extra/clangd/test/lit.site.cfg.py.in | 1 +
23+
.../gn/secondary/clang-tools-extra/clangd/test/BUILD.gn | 6 +++++-
24+
4 files changed, 16 insertions(+), 4 deletions(-)
25+
26+
diff --git a/clang-tools-extra/clangd/CMakeLists.txt b/clang-tools-extra/clangd/CMakeLists.txt
27+
index 6f10afe4a..279515d63 100644
28+
--- a/clang-tools-extra/clangd/CMakeLists.txt
29+
+++ b/clang-tools-extra/clangd/CMakeLists.txt
30+
@@ -220,4 +220,8 @@ option(CLANGD_ENABLE_REMOTE "Use gRPC library to enable remote index support for
31+
set(GRPC_INSTALL_PATH "" CACHE PATH "Path to gRPC library manual installation.")
32+
33+
add_subdirectory(index/remote)
34+
-add_subdirectory(index/dex/dexp)
35+
+
36+
+option(CLANGD_BUILD_DEXP "Build the dexp tool as part of Clangd" ON)
37+
+if(CLANGD_BUILD_DEXP)
38+
+ add_subdirectory(index/dex/dexp)
39+
+endif()
40+
diff --git a/clang-tools-extra/clangd/test/CMakeLists.txt b/clang-tools-extra/clangd/test/CMakeLists.txt
41+
index b51f461a4..42fc35066 100644
42+
--- a/clang-tools-extra/clangd/test/CMakeLists.txt
43+
+++ b/clang-tools-extra/clangd/test/CMakeLists.txt
44+
@@ -3,8 +3,6 @@ set(CLANGD_TEST_DEPS
45+
ClangdTests
46+
clangd-indexer
47+
split-file
48+
- # No tests for it, but we should still make sure they build.
49+
- dexp
50+
)
51+
52+
if(CLANGD_BUILD_XPC)
53+
@@ -12,6 +10,11 @@ if(CLANGD_BUILD_XPC)
54+
list(APPEND CLANGD_TEST_DEPS ClangdXpcUnitTests)
55+
endif()
56+
57+
+if(CLANGD_BUILD_DEXP)
58+
+ # No tests for it, but we should still make sure they build.
59+
+ list(APPEND CLANGD_TEST_DEPS dexp)
60+
+endif()
61+
+
62+
if(CLANGD_ENABLE_REMOTE)
63+
list(APPEND CLANGD_TEST_DEPS clangd-index-server clangd-index-server-monitor)
64+
endif()
65+
diff --git a/clang-tools-extra/clangd/test/lit.site.cfg.py.in b/clang-tools-extra/clangd/test/lit.site.cfg.py.in
66+
index 1fe7c8d0f..a0bb3561e 100644
67+
--- a/clang-tools-extra/clangd/test/lit.site.cfg.py.in
68+
+++ b/clang-tools-extra/clangd/test/lit.site.cfg.py.in
69+
@@ -15,6 +15,7 @@ config.llvm_shlib_dir = "@SHLIBDIR@"
70+
config.clangd_source_dir = "@CMAKE_CURRENT_SOURCE_DIR@/.."
71+
config.clangd_binary_dir = "@CMAKE_CURRENT_BINARY_DIR@/.."
72+
config.clangd_build_xpc = @CLANGD_BUILD_XPC@
73+
+config.clangd_build_dexp = @CLANGD_BUILD_DEXP@
74+
config.clangd_enable_remote = @CLANGD_ENABLE_REMOTE@
75+
config.clangd_tidy_checks = @CLANGD_TIDY_CHECKS@
76+
config.have_zlib = @LLVM_ENABLE_ZLIB@
77+
diff --git a/llvm/utils/gn/secondary/clang-tools-extra/clangd/test/BUILD.gn b/llvm/utils/gn/secondary/clang-tools-extra/clangd/test/BUILD.gn
78+
index 9d42409f1..8bfcb1282 100644
79+
--- a/llvm/utils/gn/secondary/clang-tools-extra/clangd/test/BUILD.gn
80+
+++ b/llvm/utils/gn/secondary/clang-tools-extra/clangd/test/BUILD.gn
81+
@@ -77,7 +77,6 @@ group("test") {
82+
deps = [
83+
":lit_site_cfg",
84+
":lit_unit_site_cfg",
85+
- "//clang-tools-extra/clangd/index/dex/dexp",
86+
"//clang-tools-extra/clangd/indexer:clangd-indexer",
87+
"//clang-tools-extra/clangd/tool:clangd",
88+
"//clang-tools-extra/clangd/unittests:ClangdTests",
89+
@@ -92,6 +91,11 @@ group("test") {
90+
"//clang-tools-extra/clangd/xpc/test-client:clangd-xpc-test-client",
91+
]
92+
}
93+
+ if (clangd_build_dexp) {
94+
+ deps += [
95+
+ "//clang-tools-extra/clangd/index/dex/dexp",
96+
+ ]
97+
+ }
98+
testonly = true
99+
}
100+

recipes-devtools/clang/clang_git.bb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ PACKAGECONFIG:class-nativesdk = "clangd \
7878
PACKAGECONFIG[bootstrap] = "-DCLANG_ENABLE_BOOTSTRAP=On -DCLANG_BOOTSTRAP_PASSTHROUGH='${PASSTHROUGH}' -DBOOTSTRAP_LLVM_ENABLE_LTO=Thin -DBOOTSTRAP_LLVM_ENABLE_LLD=ON,,,"
7979
PACKAGECONFIG[build-id] = "-DENABLE_LINKER_BUILD_ID=ON,-DENABLE_LINKER_BUILD_ID=OFF,,"
8080
PACKAGECONFIG[clangd] = "-DCLANG_ENABLE_CLANGD=ON,-DCLANG_ENABLE_CLANGD=OFF,,"
81+
82+
# Activate to build the dexp tool in clangd
83+
# Disabled by default for -native since it is known to trigger compiler failure on Debian 11
84+
# See: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15803
85+
PACKAGECONFIG[clangd-dexp] = "-DCLANGD_BUILD_DEXP=ON,-DCLANGD_BUILD_DEXP=OFF,,"
86+
8187
PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,,"
8288
PACKAGECONFIG[eh] = "-DLLVM_ENABLE_EH=ON,-DLLVM_ENABLE_EH=OFF,,"
8389
PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,,"

recipes-devtools/clang/common.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ SRC_URI = "\
5555
file://0034-scan-build-py-respect-LLVM_LIBDIR_SUFFIX-like-other-.patch \
5656
file://0035-compiler-rt-Do-not-pass-target-to-clang-compiler.patch \
5757
file://0036-Fix-build-on-ppc64-musl.patch \
58+
file://0037-clangd-Add-a-build-option-to-disable-building-dexp.patch \
5859
"
5960
# Fallback to no-PIE if not set
6061
GCCPIE ??= ""

0 commit comments

Comments
 (0)