build: different libunwind workaround for 0dc19bfb3

Rather than add libunwind to the gutil test dependency list twice (once
explicitly, and once via KUDU_BASE_LIBS), let's express it as a dependency of
glog. That'll cause cmake to adjust the link order based on the new dependency
graph, and place libunwind early enough that glog can resolve symbols in it.

I tested this by building the two gutil tests in release mode. After removing
the workaround from gutil/CMakeLists.txt, they failed to build. With the new
dependency information, they build successfully.

Change-Id: I18325dbbddf82f8bad7d7b9bf759487811396ff3
Reviewed-on: http://gerrit.cloudera.org:8080/11343
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <aser...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/d55df3c6
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/d55df3c6
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/d55df3c6

Branch: refs/heads/master
Commit: d55df3c6e6f3c6540d5eec9b42f3138b6ebe51c5
Parents: 5d69deb
Author: Adar Dembo <a...@cloudera.com>
Authored: Tue Aug 28 12:15:42 2018 -0700
Committer: Adar Dembo <a...@cloudera.com>
Committed: Tue Aug 28 21:23:13 2018 +0000

----------------------------------------------------------------------
 CMakeLists.txt                | 12 +++++++++---
 src/kudu/gutil/CMakeLists.txt |  1 -
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/d55df3c6/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 11b47b6..7029a4a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -984,15 +984,21 @@ ADD_THIRDPARTY_LIB(gssapi_krb5
   SHARED_LIB "${GSSAPI_SHARED_LIB}"
   DEPS ${GSSAPI_LIB_DEPS})
 
-## GLog
+## GLog (depends on libunwind)
 find_package(GLog REQUIRED)
 include_directories(SYSTEM ${GLOG_INCLUDE_DIR})
+set(GLOG_DEPS)
+if (NOT APPLE)
+  set(GLOG_DEPS unwind)
+endif()
 ADD_THIRDPARTY_LIB(glog
   STATIC_LIB "${GLOG_STATIC_LIB}"
-  SHARED_LIB "${GLOG_SHARED_LIB}")
+  SHARED_LIB "${GLOG_SHARED_LIB}"
+  DEPS "${GLOG_DEPS}")
 list(APPEND KUDU_BASE_LIBS glog)
 
-## libunwind (dependent of glog)
+## libunwind
+##
 ## Doesn't build on OSX.
 if (NOT APPLE)
   find_package(LibUnwind REQUIRED)

http://git-wip-us.apache.org/repos/asf/kudu/blob/d55df3c6/src/kudu/gutil/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/CMakeLists.txt b/src/kudu/gutil/CMakeLists.txt
index 787e6db..3d487eb 100644
--- a/src/kudu/gutil/CMakeLists.txt
+++ b/src/kudu/gutil/CMakeLists.txt
@@ -59,7 +59,6 @@ set(GUTIL_LIBS
 if (NOT APPLE)
   set(GUTIL_LIBS
     ${GUTIL_LIBS}
-    unwind
     rt) # clock_gettime() requires -lrt
 endif()
 

Reply via email to