Tips for building with LLVM_LINK_LLVM_DYLIB=ON

Hi,

We've been having trouble with some strange lldb failures when building lldb
with -DLLVM_LINK_LLVM_DYLIB=ON. For example, this command segfaults
with -DLLVM_LINK_LLVM_DYLIB=ON but not if we omit that option:

echo "int main(void) { return 0; }" | gcc -x c -g - && \
   lldb -b a.out -o 'b main' -o 'r' -o 'expr printf("hello")'

Does anyone have a working LLVM_LINK_LLVM_DYLIB=ON build and if so,
could you share the cmake flags you are using?

These are the flags that I used:

-DBUILD_SHARED_LIBS:BOOL=OFF
-DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_ASSERTIONS=ON
-DLLVM_BUILD_LLVM_DYLIB=ON
-DLLVM_LINK_LLVM_DYLIB=ON

Thanks,
Tom

Hi everyone,

I've filed https://bugs.llvm.org/show_bug.cgi?id=34194 with a script
that produces an LLDB build in the failing configuration and uses it
to run a simple test case. Assuming all dependencies for
Clang/LLVM/LLDB are installed, reproducing the bug should be as simple
as executing the build script.

This seems like a fairly nasty bug (it looks some sort of memory
corruption) that effectively breaks the -DLLVM_LINK_LLVM_DYLIB=ON
build on Linux.

Any help/hints/ideas welcome :slight_smile:

Regards,

Tilmann