[clangd] crashed during building preamble
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Version 22.1.4 (35990504507d79e0b9deb809c8ee5e1b34ceef20)
Platform MacOS 14.8.4 x64
Targetting i686-elf / i686-unknown-linux-musl
[sources](https://github.com/neko-para/nyan/tree/aa07a1755a62776b16fec09deab1f085e6b80482)
---
Clang build command
```
cmake -S llvm -B build-clang -G Ninja \
-DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra" \
-DCMAKE_BUILD_TYPE=Release -DLLVM_DEFAULT_TARGET_TRIPLE=i686-unknown-linux \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DLLVM_ENABLE_LLD=ON -DLLVM_ENABLE_LTO=Thin \
-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \
-DCLANG_DEFAULT_LINKER=lld \
-DCLANG_DEFAULT_CXX_STDLIB=libc++ \
-DCLANG_DEFAULT_RTLIB=compiler-rt \
-DCLANG_DEFAULT_UNWINDLIB=libunwind
```
---
Stack trace
[clangd-2026-04-28-181856.ips.txt](https://github.com/user-attachments/files/27161097/clangd-2026-04-28-181856.ips.txt)
```
I[18:18:56.052] Indexing c++20 standard library in the context of /Users/nekosu/Documents/Projects/nyan/kernel/arch/print.hpp
#0 0x0000000114652068 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/llvm-22/lib/libLLVM.dylib+0x1cc068)
#1 0x000000011464f2d3 llvm::sys::RunSignalHandlers() (/opt/llvm-22/lib/libLLVM.dylib+0x1c92d3)
#2 0x00000001146527a1 SignalHandler(int, __siginfo*, void*) (/opt/llvm-22/lib/libLLVM.dylib+0x1cc7a1)
#3 0x00007ff81635dfdd (/usr/lib/system/libsystem_platform.dylib+0x7ff80046afdd)
#4 0x0000000100000002 (/opt/llvm-22/bin/clangd+0xfa558002)
#5 0x0000000105e3d17e clang::clangd::(anonymous namespace)::PreambleThread::build(clang::clangd::(anonymous namespace)::PreambleThread::Request) (/opt/llvm-22/bin/clangd+0x10039517e)
#6 0x0000000105e3c630 void llvm::detail::UniqueFunctionBase::CallImpl(void*) (/opt/llvm-22/bin/clangd+0x100394630)
#7 0x0000000105fcc934 void* llvm::thread::ThreadProxy)::$_1>>(void*) (/opt/llvm-22/bin/clangd+0x100524934)
#8 0x00007ff81632f11f (/usr/lib/system/libsystem_pthread.dylib+0x7ff80043c11f)
#9 0x00007ff81632aac3 (/usr/lib/system/libsystem_pthread.dylib+0x7ff800437ac3)
Signalled while building preamble
Filename: /Users/nekosu/Documents/Projects/nyan/kernel/arch/print.hpp
Directory: /Users/nekosu/Documents/Projects/nyan/build/kernel_build-prefix/src/kernel_build-build
Command Line: /opt/llvm-22/bin/clang++ --driver-mode=g++ --target=i686-elf --sysroot=/Users/nekosu/Documents/Projects/nyan/cmake/../sysroot -D__BUILDING_NYAN__ -isystem /Users/nekosu/Documents/Projects/nyan/kernel/include -ffreestanding -nostdlib -fno-rtti -fno-exceptions -D_GNU_SOURCE -g -Wall -Wextra -Og -c -std=gnu++20 -D_LIBCPP_ENABLE_EXPERIMENTAL -resource-dir=/opt/llvm-22/lib/clang/22 -- /Users/nekosu/Documents/Projects/nyan/kernel/arch/print.hpp
Version: 1
[Error - 6:18:56 PM] Server process exited with signal SIGSEGV.
```
```
Thread 13 Crashed:: PreambleWorker:print.hpp
0 clangd 0x105b86e32 clang::CompilerInvocationBase::~CompilerInvocationBase() + 498
1 clangd 0x105e3d17e clang::clangd::(anonymous namespace)::PreambleThread::build(clang::clangd::(anonymous namespace)::PreambleThread::Request) + 1454
2 clangd 0x105e3c630 void llvm::detail::UniqueFunctionBase::CallImpl(void*) + 1616
3 clangd 0x105fcc934 void* llvm::thread::ThreadProxy)::$_1>>(void*) + 68
4 libsystem_pthread.dylib 0x7ff81632f11f _pthread_start + 99
5 libsystem_pthread.dylib 0x7ff81632aac3 thread_start + 15
```
---
Another kind of crash, may be related
[clangd-2026-04-28-181854.0003.ips.txt](https://github.com/user-attachments/files/27161127/clangd-2026-04-28-181854.0003.ips.txt)
```
Thread 12 Crashed:: ASTWorker:print.hpp
0 libsystem_platform.dylib 0x7ff816362334 _os_unfair_lock_recursive_abort + 23
1 libsystem_platform.dylib 0x7ff81635c4f8 _os_unfair_lock_lock_slow + 275
2 libsystem_malloc.dylib 0x7ff81614e359 tiny_malloc_should_clear + 123
3 libsystem_malloc.dylib 0x7ff81614d22a szone_malloc_should_clear + 65
4 libc++abi.dylib 0x7ff8162e934a operator new(unsigned long) + 26
5 libLLVM.dylib 0x11ac4e1bd llvm::sys::findProgramByName(llvm::StringRef, llvm::ArrayRef) + 669
6 libLLVM.dylib 0x11ac50b04 getLLVMSymbolizerPath(llvm::StringRef) + 276
7 libLLVM.dylib 0x11ac50cb0 printSymbolizedStackTrace(llvm::StringRef, void**, int, llvm::raw_ostream&) + 192
8 libLLVM.dylib 0x11ac520ad llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 109
9 libLLVM.dylib 0x11ac4f2d3 llvm::sys::RunSignalHandlers() + 131
10 libLLVM.dylib 0x11ac527a1 SignalHandler(int, __siginfo*, void*) + 273
11 libsystem_platform.dylib 0x7ff81635dfdd _sigtramp + 29
12 ??? 0x0 ???
13 libsystem_c.dylib 0x7ff816254a69 abort + 126
14 libsystem_malloc.dylib 0x7ff8161593a9 malloc_vreport + 857
15 libsystem_malloc.dylib 0x7ff81617cc5b malloc_zone_error + 183
16 libsystem_malloc.dylib 0x7ff81617c975 _tiny_check_and_zero_inline_meta_from_freelist + 247
17 libsystem_malloc.dylib 0x7ff81614ed3a tiny_malloc_from_free_list + 714
18 libsystem_malloc.dylib 0x7ff81614e42f tiny_malloc_should_clear + 337
19 libsystem_malloc.dylib 0x7ff81614d22a szone_malloc_should_clear + 65
20 libc++abi.dylib 0x7ff8162e934a operator new(unsigned long) + 26
21 libclang-cpp.dylib 0x1143633de clang::CompilerInvocationBase::deep_copy_assign(clang::CompilerInvocationBase const&) + 254
22 clangd 0x10c436f41 void llvm::detail::UniqueFunctionBase::CallImpl(void*) + 3473
23 clangd 0x10c4301be clang::clangd::(anonymous namespace)::ASTWorker::runTask(llvm::StringRef, llvm::function_ref) + 654
24 clangd 0x10c42e19e void llvm::detail::UniqueFunctionBase::CallImpl(void*) + 3342
25 clangd 0x10c5c1934 void* llvm::thread::ThreadProxy)::$_1>>(void*) + 68
26 libsystem_pthread.dylib 0x7ff81632f11f _pthread_start + 99
27 libsystem_pthread.dylib 0x7ff81632aac3 thread_start + 15
```
Contributor guide
Assessment
This issue has not been assessed yet.