[clangd-dev] Anyone know how to fix the clangd shared libraries crash?

Sam McCall via clangd-dev clangd-dev at lists.llvm.org
Sat Feb 2 01:07:04 PST 2019


(Ilya and Roman, I'm hoping this is an obvious/dumb question you'll just
know the answer to - I'd like shared libs to work well for my laptop when
I'm sitting on a train like today, but I have no idea how they work...)

With cmake -DBUILD_SHARED_LIBS=On, everything builds ok, but I get crashes
in index tests (both lit and unittests, so both binaries affected).
I'm using release clang+lld 7 on debian. We have no bots at all for shared
libs.

e.g.
ninja ClangdTests && tools/clang/tools/extra/unittests/clangd/ClangdTests
--gtest_filter=BackgroundIndexTest.NoCrashOnErrorFile
Segfaults with the first useful frame:
 #5 0x00007fad94321f4c (anonymous
namespace)::IndexASTConsumer::Initialize(clang::ASTContext&)
/home/sammccall/src/llvm/clang/lib/Index/IndexingAction.cpp:59:33

I've narrowed it down to clang/index/IndexAction.cpp:185: the
make_shared<SymbolCollector> call returns nullptr. (I can even print the
pointer, it's null!)
Following it in a debugger, shared_ptr just skips over the constructor call.

I figure it must be a deps issue somehow, but I'm not sure how to work it
out. The callsite and SymbolCollector are defined in the same library
(clangDaemon). I've tried adding dependencies at random (e.g. adding the
whole dependency list of clangDaemon, clangIndex, and ClangdTests to the
other targets) but it doesn't make a difference.

Anyone have ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/clangd-dev/attachments/20190202/2fdd7142/attachment.html>


More information about the clangd-dev mailing list