You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2016/12/16 23:52:07 UTC

mesos git commit: Made CMake build default to use brew APR on OS X.

Repository: mesos
Updated Branches:
  refs/heads/master b495fda02 -> ace0f8b88


Made CMake build default to use brew APR on OS X.

This review is a follow-up to the chain starting at #54278, which
transitions the Autotools Mesos build to use homebrew's APR on OS X
builds.

The goal of this commit is to fix the things that could confuse the
CMake build into selecting the wrong APR* headers and libraries. The big
ones are:

* Header and library paths are missing for brew defaults. Since APR* is
  currently keg-only, we don't expect it to show up in systems paths,
  and we should add the brew key paths ourselves.
* Header and library paths are ordered incorrectly. So, it is possible
  to select headers from `/usr/include`, but libraries from
  `/usr/local/opt`. Additionally, we want to check the user-specific
  paths before system paths.
* The call to `find_library` passes the suggested paths into the `PATHS`
  argument instead of the `HINTS` argument. In the case of the former,
  system paths are checked first, and then our suggested paths are
  checked. But, we'd like the opposite.
* Linking flags are incorrect. We should be passing `lib/` paths into
  the `-L` flags, but we're passing in paths to the actual library files
  instead. The library names should go as `-l` flags, or we `-L` to the
  `lib/` directory paths.
* There's a typo causing us to never search `POSSIBLE_APRUTIL_LIB_DIRS`.

Review: https://reviews.apache.org/r/54827/


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

Branch: refs/heads/master
Commit: ace0f8b886d5c6548d09ad2766dbe293174c322b
Parents: b495fda
Author: Alex Clemmer <cl...@gmail.com>
Authored: Fri Dec 16 15:50:51 2016 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Fri Dec 16 15:51:05 2016 -0800

----------------------------------------------------------------------
 3rdparty/stout/cmake/FindApr.cmake        | 42 +++++++++++++++++---------
 3rdparty/stout/cmake/StoutConfigure.cmake |  3 +-
 2 files changed, 29 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ace0f8b8/3rdparty/stout/cmake/FindApr.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/stout/cmake/FindApr.cmake b/3rdparty/stout/cmake/FindApr.cmake
index 9d55ba0..98adeab 100644
--- a/3rdparty/stout/cmake/FindApr.cmake
+++ b/3rdparty/stout/cmake/FindApr.cmake
@@ -46,24 +46,31 @@ unset(APR_INCLUDE_DIR)
 unset(APR_LIBS)
 unset(APR_FOUND)
 
+# NOTE: If this fails, stderr is ignored, and the output variable is empty.
+# This has no deleterious effect our path search.
+execute_process(
+  COMMAND brew --prefix apr
+  OUTPUT_VARIABLE APR_PREFIX
+  OUTPUT_STRIP_TRAILING_WHITESPACE)
+
 set(POSSIBLE_APR_INCLUDE_DIRS
   ${POSSIBLE_APR_INCLUDE_DIRS}
-  /opt/homebrew/opt/apr/include/apr-1
+  ${APR_PREFIX}/libexec/include/apr-1
   /usr/local/include/apr-1
   /usr/local/include/apr-1.0
+  /usr/local/apr/include/apr-1
   /usr/include/apr-1
   /usr/include/apr-1.0
-  /usr/local/apr/include/apr-1
   )
 
 set(APR_LIB_NAMES ${APR_LIB_NAMES} apr-1)
 
 set(POSSIBLE_APR_LIB_DIRS
   ${POSSIBLE_APR_LIB_DIRS}
-  /usr/lib
-  /usr/local/lib
+  ${APR_PREFIX}/libexec/lib
   /usr/local/apr/lib
-  /opt/homebrew/opt/apr/lib
+  /usr/local/lib
+  /usr/lib
   )
 
 # SEARCH FOR APR LIBRARIES.
@@ -73,7 +80,7 @@ find_path(APR_INCLUDE_DIR apr.h ${POSSIBLE_APR_INCLUDE_DIRS})
 find_library(
   APR_LIB
   NAMES ${APR_LIB_NAMES}
-  PATHS ${POSSIBLE_APR_LIB_DIRS}
+  HINTS ${POSSIBLE_APR_LIB_DIRS}
   )
 
 # Did we find the include directory?
@@ -125,24 +132,31 @@ mark_as_advanced(
 # CONFIGURE THE APR-UTIL SEARCH. Specify what we're looking for, and which
 # directories we're going to look through to find them.
 #############################################################################
+# NOTE: If this fails, stderr is ignored, and the output variable is empty.
+# This has no deleterious effect our path search.
+execute_process(
+  COMMAND brew --prefix apr-util
+  OUTPUT_VARIABLE APR_UTIL_PREFIX
+  OUTPUT_STRIP_TRAILING_WHITESPACE)
+
 set(POSSIBLE_APRUTIL_INCLUDE_DIRS
   ${POSSIBLE_APRUTIL_INCLUDE_DIRS}
-  /opt/homebrew/opt/apr-util/include/apr-1
+  ${APR_UTIL_PREFIX}/libexec/include/apr-1
+  /usr/local/apr/include/apr-1
   /usr/local/include/apr-1
   /usr/local/include/apr-1.0
   /usr/include/apr-1
   /usr/include/apr-1.0
-  /usr/local/apr/include/apr-1
   )
 
 set(APRUTIL_LIB_NAMES ${APRUTIL_LIB_NAMES} aprutil-1)
 
-set(POSSIBLE_APRURIL_LIB_DIRS
-  ${POSSIBLE_APRURIL_LIB_DIRS}
-  /usr/lib
-  /usr/local/lib
+set(POSSIBLE_APRUTIL_LIB_DIRS
+  ${POSSIBLE_APRUTIL_LIB_DIRS}
+  ${APR_UTIL_PREFIX}/libexec/lib
   /usr/local/apr/lib
-  /opt/homebrew/opt/apr-util/lib
+  /usr/local/lib
+  /usr/lib
   )
 
 # SEARCH FOR APR-UTIL LIBRARIES.
@@ -152,7 +166,7 @@ find_path(APRUTIL_INCLUDE_DIR apu.h ${POSSIBLE_APRUTIL_INCLUDE_DIRS})
 find_library(
   APRUTIL_LIB
   NAMES ${APRUTIL_LIB_NAMES}
-  PATHS ${POSSIBLE_APRUTIL_LIB_DIRS}
+  HINTS ${POSSIBLE_APRUTIL_LIB_DIRS}
   )
 
 # Did we find the include directory?

http://git-wip-us.apache.org/repos/asf/mesos/blob/ace0f8b8/3rdparty/stout/cmake/StoutConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/stout/cmake/StoutConfigure.cmake b/3rdparty/stout/cmake/StoutConfigure.cmake
index d8da0f0..04e0f2f 100644
--- a/3rdparty/stout/cmake/StoutConfigure.cmake
+++ b/3rdparty/stout/cmake/StoutConfigure.cmake
@@ -79,10 +79,8 @@ endif (WIN32)
 ########################################################################
 set(STOUT_LIB_DIRS
   ${STOUT_LIB_DIRS}
-  ${APR_LIBS}
   ${GLOG_LIB_DIR}
   ${PROTOBUF_LIB_DIR}
-  ${SVN_LIBS}
   )
 
 if (WIN32)
@@ -99,6 +97,7 @@ endif (WIN32)
 set(STOUT_LIBS
   ${STOUT_LIBS}
   ${CMAKE_THREAD_LIBS_INIT}
+  ${APR_LIBS}
   ${CURL_LFLAG}
   ${GLOG_LFLAG}
   ${SVN_LIBS}