[lldb-dev] lldb-server link failure with shared library configuration

2017-08-28 Thread Peeter Joot via lldb-dev
I've built lldb in tree on Linux (RHEL 7.3) with a shared library configuration:

CC=/usr/bin/clang CXX=/usr/bin/clang++ \

cmake -G Ninja ../llvm \

-DBUILD_SHARED_LIBS=true \

...

The lldb-server binary does not link for me, as I get unresolved symbols 
including:

llvm::RuntimeDyld::MemoryManager::anchor()

I've worked around this by changing the link rules for lldb-server like so:

diff --git a/tools/lldb-server/CMakeLists.txt b/tools/lldb-server/CMakeLists.txt

index f8c57cb..35311a8 100644

--- a/tools/lldb-server/CMakeLists.txt

+++ b/tools/lldb-server/CMakeLists.txt

@@ -82,6 +85,7 @@ add_lldb_tool(lldb-server INCLUDE_IN_FRAMEWORK

   lldbHost

   lldbInitialization

   lldbInterpreter

+  LLVMRuntimeDyld

   ${LLDB_PLUGINS}

   ${LLDB_SYSTEM_LIBS}

Is this a known issue, and what would the proper fix for this look like?

--
Peeter___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] lldb-server link failure with shared library configuration

2017-08-28 Thread Peeter Joot via lldb-dev
Hi Greg,

IRExecutionUnit.cpp looks like the origin of at least some of the undefined 
symbols:

.../llvm/include/llvm/ExecutionEngine/RTDyldMemoryManager.h:61: undefined 
reference to `vtable for llvm::RTDyldMemoryManager'

.../llvm/include/llvm/ExecutionEngine/JITSymbol.h:223: undefined reference to 
`vtable for llvm::JITSymbolResolver'

.../llvm/include/llvm/ExecutionEngine/RuntimeDyld.h:96: undefined reference to 
`vtable for llvm::RuntimeDyld::MemoryManager'

lib/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro+0x90): undefined 
reference to `llvm::RTDyldMemoryManager::deregisterEHFrames()'

lib/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro+0xa8): undefined 
reference to `llvm::RuntimeDyld::MemoryManager::anchor()'

lib/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro+0x118): undefined 
reference to `llvm::JITSymbolResolver::anchor()'

lib/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTVN4llvm18MCJITMemoryManagerE[_ZTVN4llvm18MCJITMemoryManagerE]+0x60):
 undefined reference to `llvm::RuntimeDyld:

:MemoryManager::anchor()'

there are a couple of undefined vtable references in headers (also above), but 
it's not clear to me if these also neccessarily come from IRExectionUnix.cpp.

--
Peeter___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] lldb-server link failure with shared library configuration

2017-08-29 Thread Peeter Joot via lldb-dev
Hi Tamas,

I was able to use your suggestion as follows:

diff --git a/source/Expression/CMakeLists.txt b/source/Expression/CMakeLists.txt

index 7d9643a..b53b095 100644

--- a/source/Expression/CMakeLists.txt

+++ b/source/Expression/CMakeLists.txt

@@ -2,6 +2,12 @@ if(NOT LLDB_BUILT_STANDALONE)

   set(tablegen_deps intrinsics_gen)

 endif()

+set(LLDB_EXP_DEPS)

+

+if(BUILD_SHARED_LIBS)

+  list(APPEND LLDB_EXP_DEPS LLVMRuntimeDyld)

+endif()

+

 add_lldb_library(lldbExpression

   DiagnosticManager.cpp

   DWARFExpression.cpp

@@ -30,6 +36,7 @@ add_lldb_library(lldbExpression

 lldbTarget

 lldbUtility

 lldbPluginExpressionParserClang

+${LLDB_EXP_DEPS}

   LINK_COMPONENTS

 Core

and was able to successfully build the lldb-server.

--
Peeter___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] lldb-server link failure with shared library configuration

2017-08-30 Thread Peeter Joot via lldb-dev
Hi Tamas,

It looks like lldb-server only fails if I build with a Debug configuration, 
which I didn't realize until now.  In Release configuration, I don't need any 
changes to CMakefiles and lldb-server links without error.  My full build 
configuration in debug mode was:

mkdir lldb50.1708110153

cd lldb50.1708110153

PATH=$PATH:/opt/lzlabs/bin

CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake \

-G \

Ninja \

../llvm \

-DBUILD_SHARED_LIBS=true \

-DLLVM_TARGETS_TO_BUILD='X86' \

-DCMAKE_BUILD_TYPE=Debug \

-DLLVM_ENABLE_ASSERTIONS=TRUE \

-DCMAKE_INSTALL_PREFIX=/home/pjoot/clang/lldb50.1708110153 \

-DLLVM_OPTIMIZED_TABLEGEN=ON \

-DICU_LIBRARY=/opt/lzlabs/lib64 \

-DICU_INCLUDE_DIR=/opt/lzlabs/include

Without any changes LLVMRuntimeDyld is not in the lldb-server link list, so 
this is not an ordering issue.  I'm not sure why this ends up as an issue only 
with Debug.

--
Peeter___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev