lldb fails to compile on Linux x86-64

Hi,

For the last week or so my combined llvm+clang+lldb build fails while linking lldb-gdbserver:

lib/liblldbHost.a(Host.cpp.o): In function lldb_private::Host::RunShellCommand(char const*, char const*, int*, int*, std:: __1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, unsigned int, bool)': /home/abuild/rpmbuild/BUILD/llvm/stage2/../tools/lldb/source/Host/common/Host.cpp:578: warning: the use of mktemp’ is dang
erous, better use mkstemp' lib/liblldbExpression.a(ClangExpressionParser.cpp.o): In function ClangExpressionParser’:
/home/abuild/rpmbuild/BUILD/llvm/stage2/…/tools/lldb/source/Expression/ClangExpressionParser.cpp:127: undefined reference
to llvm::sys::getDefaultTargetTriple()' lib/liblldbExpression.a(ClangExpressionParser.cpp.o): In function lldb_private::ClangExpressionParser::Parse(lldb_private:
:Stream&)’:
/home/abuild/rpmbuild/BUILD/llvm/stage2/…/tools/lldb/source/Expression/ClangExpressionParser.cpp:315: undefined reference
to llvm::sys::fs::createTemporaryFile(llvm::Twine const&, llvm::StringRef, int&, llvm::SmallVectorImpl<char>&)' /home/abuild/rpmbuild/BUILD/llvm/stage2/../tools/lldb/source/Expression/ClangExpressionParser.cpp:311: undefined reference to llvm::sys::fs::createUniqueFile(llvm::Twine const&, int&, llvm::SmallVectorImpl&, unsigned int)’
/home/abuild/rpmbuild/BUILD/llvm/stage2/…/tools/lldb/source/Expression/ClangExpressionParser.cpp:339: undefined reference
to llvm::MemoryBuffer::getMemBufferCopy(llvm::StringRef, llvm::Twine const&)' tools/lldb/tools/lldb-gdbserver/CMakeFiles/lldb-gdbserver.dir/__/__/source/lldb.cpp.o: In function lldb_private::Initializ
e()’:
/home/abuild/rpmbuild/BUILD/llvm/stage2/…/tools/lldb/source/lldb.cpp:130: undefined reference to `llvm::install_fatal_erro
r_handler(void ()(void, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, bool), void*
)’

[lots of similar errors]

This seems to be due to failing to link to LLVMSupport library which could be fixed by

— lldb/cmake/LLDBDependencies.cmake
+++ lldb/cmake/LLDBDependencies.cmake
@@ -161,6 +161,7 @@ set( LLVM_LINK_COMPONENTS

mcdisassembler
executionengine
option

  • support
    )

but then I hit more undefined symbols elsewhere. So I am wondering if I am the only one hitting this error.

Regards,
ismail

The debian buildbot and many others are able to build. What is your exact build process?

Have you tried doing a clean checkout/build?

This is from the openSUSE buildbot so its always a clean build. lldb is placed under tools along with clang (libcxx, libcxxabi is enabled too fwiw). Exact compile line is:

cmake -G “Ninja”
-DBUILD_SHARED_LIBS=ON \

-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_INSTALL_PREFIX=%{_prefix} \

-DLLVM_LIBDIR_SUFFIX=64 \

-DLLVM_REQUIRES_RTTI=ON \

-DLLVM_ENABLE_TIMESTAMPS=OFF
-DLLVM_ENABLE_ASSERTIONS=ON
-DLLVM_ENABLE_PIC=ON
-DLLVM_BINUTILS_INCDIR=/usr/include \

-DLLVM_TARGETS_TO_BUILD=all
-DLLVM_ENABLE_FFI=ON
-DLLVM_INCLUDE_TESTS=OFF
-DLLVM_ENABLE_LIBCXX=ON \

Thanks.

Looks to me like its not linking llvmsupport.a. Not sure why though. Can you try removing

-DBUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE=RelWithDebInfo \

Hi,

If you want to dig in and try to figure out why it’s not working right, patches would be welcome.

AFAIK this is broken by r221570 but sadly I don’t have time to debug this.

Can you file a bug at http://llvm.org/bugs/ and Cc the author of the patch?

Reported as http://llvm.org/bugs/show_bug.cgi?id=21670

I haven’t really done this before. Now that I have a fix attached to the bug and verified what is the next step to get it upstream’d? Do I send the patch to lldb-commit?

That is one option. Phabricator (http://reviews.llvm.org) provides a convenient way to give people access to a grpahical diff, and include reviewers. The usual workflow is to create a diff in Phabricator, attach the patch to it, and set one of the subscribers to lldb-commits. This will automatically send email to the list.

Either is fine.