Skip to content

Commit 891a9d8

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 891a9d8

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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+
Upstream-Status: Pending
7+
Signed-off-by: Yoann Congal <[email protected]>
8+
---
9+
clang-tools-extra/clangd/CMakeLists.txt | 6 +++++-
10+
clang-tools-extra/clangd/test/CMakeLists.txt | 7 +++++--
11+
clang-tools-extra/clangd/test/lit.site.cfg.py.in | 1 +
12+
.../gn/secondary/clang-tools-extra/clangd/test/BUILD.gn | 6 +++++-
13+
4 files changed, 16 insertions(+), 4 deletions(-)
14+
15+
diff --git a/clang-tools-extra/clangd/CMakeLists.txt b/clang-tools-extra/clangd/CMakeLists.txt
16+
index 6f10afe4a..279515d63 100644
17+
--- a/clang-tools-extra/clangd/CMakeLists.txt
18+
+++ b/clang-tools-extra/clangd/CMakeLists.txt
19+
@@ -220,4 +220,8 @@ option(CLANGD_ENABLE_REMOTE "Use gRPC library to enable remote index support for
20+
set(GRPC_INSTALL_PATH "" CACHE PATH "Path to gRPC library manual installation.")
21+
22+
add_subdirectory(index/remote)
23+
-add_subdirectory(index/dex/dexp)
24+
+
25+
+option(CLANGD_BUILD_DEXP "Build the dexp tool as part of Clangd" ON)
26+
+if(CLANGD_BUILD_DEXP)
27+
+ add_subdirectory(index/dex/dexp)
28+
+endif()
29+
diff --git a/clang-tools-extra/clangd/test/CMakeLists.txt b/clang-tools-extra/clangd/test/CMakeLists.txt
30+
index b51f461a4..42fc35066 100644
31+
--- a/clang-tools-extra/clangd/test/CMakeLists.txt
32+
+++ b/clang-tools-extra/clangd/test/CMakeLists.txt
33+
@@ -3,8 +3,6 @@ set(CLANGD_TEST_DEPS
34+
ClangdTests
35+
clangd-indexer
36+
split-file
37+
- # No tests for it, but we should still make sure they build.
38+
- dexp
39+
)
40+
41+
if(CLANGD_BUILD_XPC)
42+
@@ -12,6 +10,11 @@ if(CLANGD_BUILD_XPC)
43+
list(APPEND CLANGD_TEST_DEPS ClangdXpcUnitTests)
44+
endif()
45+
46+
+if(CLANGD_BUILD_DEXP)
47+
+ # No tests for it, but we should still make sure they build.
48+
+ list(APPEND CLANGD_TEST_DEPS dexp)
49+
+endif()
50+
+
51+
if(CLANGD_ENABLE_REMOTE)
52+
list(APPEND CLANGD_TEST_DEPS clangd-index-server clangd-index-server-monitor)
53+
endif()
54+
diff --git a/clang-tools-extra/clangd/test/lit.site.cfg.py.in b/clang-tools-extra/clangd/test/lit.site.cfg.py.in
55+
index 1fe7c8d0f..a0bb3561e 100644
56+
--- a/clang-tools-extra/clangd/test/lit.site.cfg.py.in
57+
+++ b/clang-tools-extra/clangd/test/lit.site.cfg.py.in
58+
@@ -15,6 +15,7 @@ config.llvm_shlib_dir = "@SHLIBDIR@"
59+
config.clangd_source_dir = "@CMAKE_CURRENT_SOURCE_DIR@/.."
60+
config.clangd_binary_dir = "@CMAKE_CURRENT_BINARY_DIR@/.."
61+
config.clangd_build_xpc = @CLANGD_BUILD_XPC@
62+
+config.clangd_build_dexp = @CLANGD_BUILD_DEXP@
63+
config.clangd_enable_remote = @CLANGD_ENABLE_REMOTE@
64+
config.clangd_tidy_checks = @CLANGD_TIDY_CHECKS@
65+
config.have_zlib = @LLVM_ENABLE_ZLIB@
66+
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
67+
index 9d42409f1..8bfcb1282 100644
68+
--- a/llvm/utils/gn/secondary/clang-tools-extra/clangd/test/BUILD.gn
69+
+++ b/llvm/utils/gn/secondary/clang-tools-extra/clangd/test/BUILD.gn
70+
@@ -77,7 +77,6 @@ group("test") {
71+
deps = [
72+
":lit_site_cfg",
73+
":lit_unit_site_cfg",
74+
- "//clang-tools-extra/clangd/index/dex/dexp",
75+
"//clang-tools-extra/clangd/indexer:clangd-indexer",
76+
"//clang-tools-extra/clangd/tool:clangd",
77+
"//clang-tools-extra/clangd/unittests:ClangdTests",
78+
@@ -92,6 +91,11 @@ group("test") {
79+
"//clang-tools-extra/clangd/xpc/test-client:clangd-xpc-test-client",
80+
]
81+
}
82+
+ if (clangd_build_dexp) {
83+
+ deps += [
84+
+ "//clang-tools-extra/clangd/index/dex/dexp",
85+
+ ]
86+
+ }
87+
testonly = true
88+
}
89+

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)