Hi all,
I've just trying to build the latest lldb/llvm with
BUILD_SHARED_LIBS/DEBUG On linux:
- llvm: 1f22900
- lldb: 942b4a2
- ld: 2.24.51 (binutils for debian)
And got some errors about undefined references, for most of additional
libraries, that exist in lldbCore mostly.
And then I came with the patch [ADD_LLDB_LIBRARY.PATCH], but even after
this patch lldb didn't built successfully for me, and the reason was in
inter-libs dependencies, and here is the cmake error message after I add
tried to resolve them:
CMake Error: The inter-target dependency graph contains the following strongly
connected component (cycle):
"lldbTarget" of type SHARED_LIBRARY
depends on "lldbCore" (weak)
"lldbCore" of type SHARED_LIBRARY
depends on "lldbTarget" (weak)
At least one of these targets is not a STATIC_LIBRARY. Cyclic dependencies are
allowed only among static libraries.
Indeed:
- lldbCore depends from lldbTarget
- lldbTarget depends from lldbCore
So after this I came with another patch, that just allows undefined
references in object files [CMAKE_SHARED_LINKER_FLAGS.PATCH].
But it is a bit hackish, and so if somebody have ideas/existing solution
for this problem please post here.
Cheers,
Azat.
>From 942b4a2201c52baf8d93ef7c2ced09aa04344c62 Mon Sep 17 00:00:00 2001
From: Azat Khuzhin <[email protected]>
Date: Mon, 23 Feb 2015 06:00:04 -0500
Subject: [PATCH] Don't add -Wl,-z,defs for lldb, because of inter-libs
dependencies
---
CMakeLists.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index efc866d..3095db4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -235,6 +235,8 @@ else ()
set(cmake_2_8_12_PUBLIC PUBLIC)
endif ()
+string(REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
+
macro(add_lldb_library name)
# only supported parameters to this macro are the optional
# MODULE;SHARED;STATIC library type and source files
--
1.7.10.4
>From d40bfd96e44a07712fff3bb4e56713c2573a0ddb Mon Sep 17 00:00:00 2001
From: Azat Khuzhin <[email protected]>
Date: Mon, 23 Feb 2015 05:17:33 -0500
Subject: [PATCH] Autoadd lldbCore for most of additional libs
---
CMakeLists.txt | 13 ++++++++++---
source/API/CMakeLists.txt | 2 ++
source/CMakeLists.txt | 5 +++--
source/Core/CMakeLists.txt | 2 ++
source/Host/CMakeLists.txt | 2 +-
source/Target/CMakeLists.txt | 2 ++
6 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index efc866d..387deea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -239,9 +239,9 @@ macro(add_lldb_library name)
# only supported parameters to this macro are the optional
# MODULE;SHARED;STATIC library type and source files
cmake_parse_arguments(PARAM
- "MODULE;SHARED;STATIC"
- ""
- ""
+ "MODULE;SHARED;STATIC;NOCORE" # options
+ "" # one value
+ "LIBS" # multi value
${ARGN})
llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
@@ -294,6 +294,13 @@ macro(add_lldb_library name)
if (LLVM_COMMON_DEPENDS)
add_dependencies(${name} ${LLVM_COMMON_DEPENDS})
endif()
+ if (NOT PARAM_NOCORE AND NOT "${name}" STREQUAL "lldbCore")
+ message(STATUS "Autoadd lldbCore for ${name}")
+ set(PARAM_LIBS ${PARAM_LIBS} lldbCore)
+ endif()
+ if (NOT "${PARAM_LIBS}" STREQUAL "")
+ target_link_libraries(${name} ${PARAM_LIBS})
+ endif()
# Hack: only some LLDB libraries depend on the clang autogenerated headers,
# but it is simple enough to make all of LLDB depend on some of those
diff --git a/source/API/CMakeLists.txt b/source/API/CMakeLists.txt
index 65ce88e..5a285fe 100644
--- a/source/API/CMakeLists.txt
+++ b/source/API/CMakeLists.txt
@@ -62,4 +62,6 @@ add_lldb_library(lldbAPI
SBVariablesOptions.cpp
SBWatchpoint.cpp
SBUnixSignals.cpp
+
+ LIBS lldbCore
)
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 0259176..cd88eeb 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -25,17 +25,17 @@ include_directories(
)
endif ()
+add_subdirectory(Target)
+add_subdirectory(Core)
add_subdirectory(API)
add_subdirectory(Breakpoint)
add_subdirectory(Commands)
-add_subdirectory(Core)
add_subdirectory(DataFormatters)
add_subdirectory(Expression)
add_subdirectory(Host)
add_subdirectory(Interpreter)
add_subdirectory(Plugins)
add_subdirectory(Symbol)
-add_subdirectory(Target)
add_subdirectory(Utility)
include(../cmake/LLDBDependencies.cmake)
@@ -45,6 +45,7 @@ add_lldb_library(liblldb SHARED
lldb-log.cpp
${LLDB_WRAP_PYTHON}
${LLDB_VERS_GENERATED_FILE}
+ NOCORE
)
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
diff --git a/source/Core/CMakeLists.txt b/source/Core/CMakeLists.txt
index b2069a0..2ccce8d 100644
--- a/source/Core/CMakeLists.txt
+++ b/source/Core/CMakeLists.txt
@@ -72,5 +72,7 @@ add_lldb_library(lldbCore
ValueObjectSyntheticFilter.cpp
ValueObjectVariable.cpp
VMRange.cpp
+
+ LIBS lldbTarget lldbHost
)
diff --git a/source/Host/CMakeLists.txt b/source/Host/CMakeLists.txt
index cdc79bc..bf17029 100644
--- a/source/Host/CMakeLists.txt
+++ b/source/Host/CMakeLists.txt
@@ -125,4 +125,4 @@ else()
endif()
endif()
-add_lldb_library(lldbHost ${HOST_SOURCES})
+add_lldb_library(lldbHost ${HOST_SOURCES} NOCORE)
diff --git a/source/Target/CMakeLists.txt b/source/Target/CMakeLists.txt
index d34aa92..c28638a 100644
--- a/source/Target/CMakeLists.txt
+++ b/source/Target/CMakeLists.txt
@@ -56,4 +56,6 @@ add_lldb_library(lldbTarget
ThreadSpec.cpp
UnixSignals.cpp
UnwindAssembly.cpp
+
+ NOCORE
)
--
1.7.10.4
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev