Anyone know how to fix the clangd shared libraries crash?

(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.

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 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?

I failed to reproduce at head, building in Release mode, with assertions, clang+lld (8), r351319 to be precise.
All tests successfully build and pass (i.e. ninja check-clangd).