You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ts...@apache.org on 2014/08/14 15:01:17 UTC

git commit: MESOS-1174: Update system check to unbundle protobuf

Repository: mesos
Updated Branches:
  refs/heads/master 93c39b89e -> 5643f64b1


MESOS-1174: Update system check to unbundle protobuf

Enable mesos to build against system installed version of protobuf.

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


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

Branch: refs/heads/master
Commit: 5643f64b14c12dac2bdaea891a55ed91d4551bf8
Parents: 93c39b8
Author: Timothy St. Clair <ts...@redhat.com>
Authored: Thu Aug 14 08:00:26 2014 -0500
Committer: Timothy St. Clair <ts...@redhat.com>
Committed: Thu Aug 14 08:00:26 2014 -0500

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/Makefile.am        | 33 +++++---
 3rdparty/libprocess/configure.ac                | 61 +++++++++++++++
 configure.ac                                    | 80 ++++++++++++++++++--
 mpi/mpiexec-mesos.in                            |  4 +-
 src/Makefile.am                                 | 52 ++++++++-----
 src/examples/java/test-exception-framework.in   |  2 +-
 src/examples/java/test-executor.in              |  2 +-
 src/examples/java/test-framework.in             |  2 +-
 src/examples/java/test-log.in                   |  2 +-
 .../java/test-multiple-executors-framework.in   |  2 +-
 src/examples/python/test-containerizer.in       |  3 +-
 src/examples/python/test-executor.in            |  3 +-
 src/examples/python/test-framework.in           |  3 +-
 src/python/native/ext_modules.py.in             |  8 +-
 14 files changed, 206 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5643f64b/3rdparty/libprocess/3rdparty/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/Makefile.am b/3rdparty/libprocess/3rdparty/Makefile.am
index 497d038..ea46d6a 100644
--- a/3rdparty/libprocess/3rdparty/Makefile.am
+++ b/3rdparty/libprocess/3rdparty/Makefile.am
@@ -57,6 +57,7 @@ CLEAN_EXTRACTED =	\
   $(RY_HTTP_PARSER)	\
   $(PICOJSON)
 
+ALL_LOCAL = # Initialize ALL_LOCAL so we can add to it.
 
 # This is where the magic happens: we use stamp files as dependencies
 # which cause the packages to get extracted as necessary. We also
@@ -77,6 +78,19 @@ if WITH_BUNDLED_HTTP_PARSER
   $(RY_HTTP_PARSER)/http_parser.c: $(RY_HTTP_PARSER)-stamp
 endif
 
+if WITH_BUNDLED_PROTOBUF
+  $(PROTOBUF)/src/protoc $(PROTOBUF)/src/libprotobuf.la: $(PROTOBUF)-build-stamp
+
+  $(PROTOBUF)-build-stamp: $(PROTOBUF)-stamp
+	cd $(PROTOBUF) && ./configure $(CONFIGURE_ARGS) && \
+          $(MAKE) $(AM_MAKEFLAGS)
+	touch $@
+
+  LIBPROTOBUF = $(PROTOBUF)/src/libprotobuf.la
+
+else
+  LIBPROTOBUF = -lprotobuf
+endif
 
 # Convenience library for gmock/gtest.
 check_LTLIBRARIES = libgmock.la
@@ -120,13 +134,6 @@ $(LIBEV)/libev.la: $(LIBEV)-stamp
           $(MAKE) $(AM_MAKEFLAGS)
 endif
 
-$(PROTOBUF)/src/protoc $(PROTOBUF)/src/libprotobuf.la: $(PROTOBUF)-build-stamp
-
-$(PROTOBUF)-build-stamp: $(PROTOBUF)-stamp
-	cd $(PROTOBUF) && ./configure $(CONFIGURE_ARGS) && \
-          $(MAKE) $(AM_MAKEFLAGS)
-	touch $@
-
 # Tests for stout.
 check_PROGRAMS = stout-tests
 
@@ -192,8 +199,8 @@ endif
 
 stout_tests_LDADD =			\
   libgmock.la				\
-  $(PROTOBUF)/src/libprotobuf.la	\
   $(LIBGLOG)				\
+  $(LIBPROTOBUF)			\
   -ldl
 
 # We use a check-local target for now to avoid the parallel test
@@ -204,10 +211,12 @@ check-local: stout-tests
 	./stout-tests
 
 # Dependencies for all-local.
-ALL_LOCAL =				\
-  $(STOUT)/Makefile			\
-  $(PROTOBUF)/src/libprotobuf.la	\
-  $(PROTOBUF)/src/protoc
+ALL_LOCAL += $(STOUT)/Makefile
+
+if WITH_BUNDLED_PROTOBUF
+  ALL_LOCAL += $(PROTOBUF)/src/libprotobuf.la
+  ALL_LOCAL += $(PROTOBUF)/src/protoc
+endif
 
 if WITH_BUNDLED_LIBEV
   ALL_LOCAL += $(LIBEV)/libev.la

http://git-wip-us.apache.org/repos/asf/mesos/blob/5643f64b/3rdparty/libprocess/configure.ac
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/configure.ac b/3rdparty/libprocess/configure.ac
index 7b39e63..d6695ce 100644
--- a/3rdparty/libprocess/configure.ac
+++ b/3rdparty/libprocess/configure.ac
@@ -106,6 +106,13 @@ AC_ARG_WITH([http-parser],
                            location prefixed by the given path]),
             [without_bundled_http_parser=yes], [])
 
+AC_ARG_WITH([protobuf],
+        AS_HELP_STRING([--with-protobuf@<:@=DIR@:>@],
+                       [excludes building and using the bundled protobuf
+                       package in lieu of an installed version at a
+                       location prefixed by the given path]),
+        [without_bundled_protobuf=yes], [])
+
 AC_ARG_WITH([zlib],
             AS_HELP_STRING([--without-zlib],
                            [disables zlib compression, which means the webui
@@ -117,6 +124,8 @@ AC_ARG_WITH([cxx11],
                            [builds libprocess without C++11 support (deprecated)]),
             [], [with_cxx11=yes])
 
+# There is no prefix installation of the JAR.
+AC_ARG_VAR([PROTOBUF_JAR], [full path to protobuf jar on prefixed builds])
 
 # Do some OS specific setup.
 case "${target_os}" in
@@ -158,6 +167,12 @@ if test -n "`echo $with_http-parser`"; then
   CPPFLAGS="$CPPFLAGS -I${with_http-parser}/include"
 fi
 
+if test -n "`echo $with_protobuf`"; then
+  CPPFLAGS="$CPPFLAGS -I${with_protobuf}/include"
+  LDFLAGS="$LDFLAGS -I${with_protobuf}/lib"
+  PROTOBUFPREFIX=${with_protobuf}
+fi
+
 # Check if user has asked us to use a preinstalled libev, or if they asked
 # us to ignore all bundled libraries while compiling and linking.
 if test "x$without_bundled_libev" = "xyes" || \
@@ -298,6 +313,52 @@ fi
 AM_CONDITIONAL([WITH_BUNDLED_HTTP_PARSER],
                [test "x$with_bundled_http_parser" = "xyes"])
 
+# Check if user has asked us to use a preinstalled protobuf, or if they asked
+# us to ignore all bundled libraries while compiling and linking.
+if test "x$without_bundled_protobuf" = "xyes" || \
+   test "x$enable_bundled" != "xyes"; then
+  # Check for protobuf.
+  PKG_CHECK_MODULES([PROTOBUFPREFIX],
+                    [protobuf],
+                    [found_protobuf=yes])
+
+  if test "x$found_protobuf" = "xyes"; then
+    with_bundled_protobuf=no
+    if test -z "`echo $PROTOBUF_JAR`"; then
+      PROTOBUF_JAR="/usr/share/java/protobuf.jar"
+    fi
+
+    AC_CHECK_FILE($PROTOBUF_JAR,
+                  [],
+                  [AC_MSG_ERROR([cannot find PROTOBUF_JAR=$PROTOBUF_JAR])])
+
+    AC_CHECK_TOOL([PROTOC], [protoc])
+
+    if test -z "`echo $PROTOC`"; then
+      AC_MSG_ERROR([protoc not found in PATH])
+    fi
+
+  else
+    AC_MSG_ERROR([cannot find protobuf
+-------------------------------------------------------------------
+You have requested the use of a non-bundled protobuf but no suitable
+protobuf could be found.
+
+You may want specify the location of protobuf by providing a prefix
+path via --with-protobuf=DIR, or check that the path you provided is
+correct if you're already doing this.
+-------------------------------------------------------------------
+])
+  fi
+else
+  with_bundled_protobuf=yes
+  PROTOBUF_JAR="\${MESOS_BUILD_DIR}/src/java/target/protobuf-java-2.5.0.jar"
+fi
+
+AM_CONDITIONAL([WITH_BUNDLED_PROTOBUF],
+               [test "x$with_bundled_protobuf" = "xyes"])
+
+AC_SUBST([PROTOBUF_JAR])
 
 # Default to gcc toolchain (we rely on some atomic builtins for now,
 # that are also present with clang).

http://git-wip-us.apache.org/repos/asf/mesos/blob/5643f64b/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 8fb0a3a..5653775 100644
--- a/configure.ac
+++ b/configure.ac
@@ -165,6 +165,13 @@ AC_ARG_WITH([glog],
                    location prefixed by the given path]),
         [without_bundled_glog=yes], [])
 
+AC_ARG_WITH([protobuf],
+        AS_HELP_STRING([--with-protobuf@<:@=DIR@:>@],
+                       [excludes building and using the bundled protobuf
+                       package in lieu of an installed version at a
+                       location prefixed by the given path]),
+        [without_bundled_protobuf=yes], [])
+
 AC_ARG_WITH([cxx11],
 	    AS_HELP_STRING([--without-cxx11],
                            [builds Mesos without C++11 support (deprecated)]),
@@ -175,12 +182,6 @@ AC_ARG_WITH([network-isolator],
                            [builds the network isolator]),
             [], [with_network_isolator=no])
 
-# TODO(benh): Support --without-included-protobuf,
-# --without-included-glog, etc. Doing this for protobuf is
-# considerably more tricky because we need to make sure that 'protoc'
-# exists, that a protobuf JAR exists or we can make one, that a
-# protobuf egg exists or we can make one, etc.
-
 AC_ARG_VAR([JAVA_HOME], [location of Java Development Kit (JDK)])
 
 AC_ARG_VAR([JAVA_CPPFLAGS], [preprocessor flags for JNI])
@@ -189,6 +190,8 @@ AC_ARG_VAR([JAVA_JVM_LIBRARY], [full path to libjvm.so])
 
 AC_ARG_VAR([MAVEN_HOME], [looks for mvn at MAVEN_HOME/bin/mvn])
 
+AC_ARG_VAR([PROTOBUF_JAR], [full path to protobuf jar on prefixed builds])
+
 AC_ARG_VAR([PYTHON], [which Python interpreter to use])
 
 AC_MSG_NOTICE([Setting up build environment for ${target_cpu} ${target_os}])
@@ -237,6 +240,19 @@ if test -n "`echo $with_leveldb`"; then
   LDFLAGS="$LDFLAGS -L${with_leveldb}/lib"
 fi
 
+if test -n "`echo $with_protobuf`"; then
+  CPPFLAGS="$CPPFLAGS -I${with_protobuf}/include"
+  LDFLAGS="$LDFLAGS -L${with_protobuf}/lib"
+  PROTOBUFPREFIX="${with_protobuf}"
+  PROTOCOMPILER="${with_protobuf}/bin/protoc"
+elif test "x$enable_bundled" = "xno"; then
+  PROTOCOMPILER="protoc"
+
+# In the 'else' case src/Makefile.am will use the bundled
+# protoc from 3rdparty.
+
+fi
+
 # Check if ZooKeeper prefix path was supplied and if so, add it to
 # CPPFLAGS while extending it by /include and to LDFLAGS while
 # extending it by /lib.
@@ -341,6 +357,58 @@ fi
 AM_CONDITIONAL([WITH_BUNDLED_ZOOKEEPER],
                [test "x$with_bundled_zookeeper" = "xyes"])
 
+# Check if user has asked us to use a preinstalled protobuf, or if they asked
+# us to ignore all bundled libraries while compiling and linking.
+if test "x$without_bundled_protobuf" = "xyes" || \
+   test "x$enable_bundled" != "xyes"; then
+  # Check for protobuf.
+  PKG_CHECK_MODULES([PROTOBUFPREFIX],
+                    [protobuf],
+                    [found_protobuf=yes])
+
+  if test "x$found_protobuf" = "xyes"; then
+    with_bundled_protobuf=no
+    if test -z "`echo $PROTOBUF_JAR`"; then
+      PROTOBUF_JAR="${PROTOBUFPREFIX}/usr/share/java/protobuf.jar"
+    fi
+
+    AC_CHECK_FILE($PROTOBUF_JAR,
+                  [],
+                  [AC_MSG_ERROR([cannot find PROTOBUF_JAR=$PROTOBUF_JAR])])
+
+    AC_CHECK_TOOL([PROTOBUF_COMPILER], $PROTOCOMPILER)
+
+    if test -z "`echo $PROTOBUF_COMPILER`"; then
+      AC_MSG_ERROR([protoc not found in PATH])
+    fi
+
+    if test "x$enable_python" = "xyes"; then
+        AC_PYTHON_MODULE([google.protobuf], [yes])
+    fi
+
+  else
+    AC_MSG_ERROR([cannot find protobuf
+-------------------------------------------------------------------
+You have requested the use of a non-bundled protobuf but no suitable
+protobuf could be found.
+
+You may want specify the location of protobuf by providing a prefix
+path via --with-protobuf=DIR, or check that the path you provided is
+correct if youre already doing this.
+-------------------------------------------------------------------
+])
+  fi
+else
+  with_bundled_protobuf=yes
+  PROTOBUF_JAR="\${MESOS_BUILD_DIR}/src/java/target/protobuf-java-2.5.0.jar"
+fi
+
+AM_CONDITIONAL([WITH_BUNDLED_PROTOBUF],
+               [test "x$with_bundled_protobuf" = "xyes"])
+
+AC_SUBST([PROTOBUF_JAR])
+AC_SUBST([PROTOCOMPILER])
+
 # Check if we're using clang.
 AC_MSG_CHECKING([if compiling with clang])
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/5643f64b/mpi/mpiexec-mesos.in
----------------------------------------------------------------------
diff --git a/mpi/mpiexec-mesos.in b/mpi/mpiexec-mesos.in
index 8812ee2..9aa0702 100644
--- a/mpi/mpiexec-mesos.in
+++ b/mpi/mpiexec-mesos.in
@@ -25,9 +25,9 @@ test ! -e ${DISTRIBUTE_EGG} && \
 PROTOBUF=${MESOS_BUILD_DIR}/3rdparty/libprocess/3rdparty/protobuf-*
 PROTOBUF_EGG=`echo ${PROTOBUF}/python/dist/protobuf*.egg`
 
+# Just warn in the case when build with --disable-bundled.
 test ! -e ${PROTOBUF_EGG} && \
-  echo "${RED}Failed to find ${PROTOBUF_EGG}${NORMAL}" && \
-  exit 1
+  echo "${RED}Failed to find ${PROTOBUF_EGG} check your PYTHONPATH${NORMAL}"
 
 MESOS_EGGS=""
 for egg in interface native; do

http://git-wip-us.apache.org/repos/asf/mesos/blob/5643f64b/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 0ac95b4..5b2978a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,6 +18,7 @@
 # which is necessary for dealing with naming conflicts, i.e,,
 # master/http.cpp and slave/http.cpp.
 AUTOMAKE_OPTIONS = subdir-objects
+MESOS_BUILD_DIR=@abs_top_builddir@
 
 include ../3rdparty/versions.am
 include ../3rdparty/libprocess/3rdparty/versions.am
@@ -44,8 +45,13 @@ PICOJSON = $(LIBPROCESS)/3rdparty/picojson-$(PICOJSON_VERSION)
 pkglibexecdir = $(libexecdir)/$(PACKAGE)
 pkglocalstatedir = $(localstatedir)/$(PACKAGE)
 
-# Protocol buffer compiler.
-PROTOC = ../$(PROTOBUF)/src/protoc
+if WITH_BUNDLED_PROTOBUF
+  # Protocol buffer compiler.
+  PROTOC = ../$(PROTOBUF)/src/protoc
+else
+  PROTOC = @PROTOCOMPILER@
+endif
+
 PROTOCFLAGS = -I$(top_srcdir)/include -I$(srcdir)
 
 # Initialize variables here so we can use += operator everywhere else.
@@ -109,6 +115,10 @@ if WITH_NETWORK_ISOLATOR
   MESOS_CPPFLAGS += $(LIBNL_CFLAGS)
 endif
 
+if WITH_BUNDLED_PROTOBUF
+  MESOS_CPPFLAGS += -I../$(PROTOBUF)/src
+endif
+
 # README: we build the Mesos library out of a collection of
 # convenience libraries (that is, libraries that do not get installed
 # but we can use as building blocks to vary compile flags as necessary
@@ -554,8 +564,6 @@ libmesos_la_LIBADD = libmesos_no_3rdparty.la
 # For non-convenience libraries we need to link them in to make the shared
 # library each time. (Currently, we don't support platforms where this is not
 # possible.)
-libmesos_la_LIBADD += ../$(PROTOBUF)/src/libprotobuf.la
-
 if WITH_BUNDLED_GLOG
   libmesos_la_LIBADD += ../$(GLOG)/libglog.la
 else
@@ -578,6 +586,12 @@ else
   libmesos_la_LIBADD += -lzookeeper_mt
 endif
 
+if WITH_BUNDLED_PROTOBUF
+  libmesos_la_LIBADD += ../$(PROTOBUF)/src/libprotobuf.la
+else
+  libmesos_la_LIBADD += -lprotobuf
+endif
+
 libmesos_la_LIBADD += ../$(LIBPROCESS)/libprocess.la
 
 # Binaries.
@@ -781,8 +795,6 @@ EXTRA_DIST += $(EXAMPLES_SOURCE)
 
 
 if HAS_JAVA
-# Protobuf jar, copied there by Maven.
-PROTOBUF_JAR = java/target/protobuf-java-$(PROTOBUF_VERSION).jar
 
 $(MESOS_JAR): $(MESOS_JAR_SOURCE) $(MESOS_JAR_GENERATED) java/mesos.pom
 	@echo "Building mesos-$(PACKAGE_VERSION).jar ..."
@@ -847,44 +859,44 @@ BUILT_SOURCES += $(nodist_libjava_la_SOURCES)
 
 java/jni/org_apache_mesos_MesosSchedulerDriver.h: $(MESOS_JAR)
 	$(JAVA_HOME)/bin/javah -d java/jni				\
-	-classpath $(MESOS_JAR):$(PROTOBUF_JAR)				\
+	-classpath $(MESOS_JAR):@PROTOBUF_JAR@				\
 	  org.apache.mesos.MesosSchedulerDriver
 
 java/jni/org_apache_mesos_MesosExecutorDriver.h: $(MESOS_JAR)
 	$(JAVA_HOME)/bin/javah -d java/jni				\
-	-classpath $(MESOS_JAR):$(PROTOBUF_JAR)				\
+	-classpath $(MESOS_JAR):@PROTOBUF_JAR@				\
           org.apache.mesos.MesosExecutorDriver
 
 java/jni/org_apache_mesos_Log.h: $(MESOS_JAR)
 	$(JAVA_HOME)/bin/javah -d java/jni				\
-	-classpath $(MESOS_JAR):$(PROTOBUF_JAR)				\
+	-classpath $(MESOS_JAR):@PROTOBUF_JAR@				\
 	  org.apache.mesos.Log
 
 java/jni/org_apache_mesos_state_AbstractState.h: $(MESOS_JAR)
 	$(JAVA_HOME)/bin/javah -d java/jni				\
-	-classpath $(MESOS_JAR):$(PROTOBUF_JAR)				\
+	-classpath $(MESOS_JAR):@PROTOBUF_JAR@				\
 	  org.apache.mesos.state.AbstractState
 
 java/jni/org_apache_mesos_state_LevelDBState.h: $(MESOS_JAR)
 	$(JAVA_HOME)/bin/javah -d java/jni				\
-	-classpath $(MESOS_JAR):$(PROTOBUF_JAR)				\
+	-classpath $(MESOS_JAR):@PROTOBUF_JAR@				\
 	  org.apache.mesos.state.LevelDBState
 
 java/jni/org_apache_mesos_state_Variable.h: $(MESOS_JAR)
 	$(JAVA_HOME)/bin/javah -d java/jni				\
-	-classpath $(MESOS_JAR):$(PROTOBUF_JAR)				\
+	-classpath $(MESOS_JAR):@PROTOBUF_JAR@				\
 	  org.apache.mesos.state.Variable
 
 java/jni/org_apache_mesos_state_ZooKeeperState.h: $(MESOS_JAR)
 	$(JAVA_HOME)/bin/javah -d java/jni				\
-	-classpath $(MESOS_JAR):$(PROTOBUF_JAR)				\
+	-classpath $(MESOS_JAR):@PROTOBUF_JAR@				\
 	  org.apache.mesos.state.ZooKeeperState
 
 $(EXAMPLES_JAR): $(EXAMPLES_SOURCE)
 	@echo "Building examples.jar ..."
 	$(MKDIR_P) examples/java
 	$(JAVA_HOME)/bin/javac -source 1.6 -target 1.6			\
-          -cp ../$(ZOOKEEPER_JAR):$(PROTOBUF_JAR):$(MESOS_JAR):$(srcdir)/examples/java	\
+          -cp ../$(ZOOKEEPER_JAR):@PROTOBUF_JAR@:$(MESOS_JAR):$(srcdir)/examples/java	\
           -sourcepath $(srcdir)/examples/java -d examples/java	        \
           $(srcdir)/examples/java/*.java
 	$(JAVA_HOME)/bin/jar cf $@ -C examples/java .
@@ -932,17 +944,19 @@ DISTRIBUTE_EGG_SUFFIX = $(DISTRIBUTE_VERSION)$(PYTHON_EGG_PUREPY_POSTFIX).egg
 DISTRIBUTE_EGG = \
   $(abs_top_builddir)/$(DISTRIBUTE)/dist/distribute-$(DISTRIBUTE_EGG_SUFFIX)
 
-# Build a protobuf Python egg.
-PROTOBUF_EGG_SUFFIX = $(PROTOBUF_VERSION)$(PYTHON_EGG_PUREPY_POSTFIX).egg
-PROTOBUF_EGG = ../$(PROTOBUF)/python/dist/protobuf-$(PROTOBUF_EGG_SUFFIX)
+if WITH_BUNDLED_PROTOBUF
+  # Build a protobuf Python egg.
+  PROTOBUF_EGG_SUFFIX = $(PROTOBUF_VERSION)$(PYTHON_EGG_PUREPY_POSTFIX).egg
+  PROTOBUF_EGG = ../$(PROTOBUF)/python/dist/protobuf-$(PROTOBUF_EGG_SUFFIX)
 
-$(PROTOBUF_EGG):
+  $(PROTOBUF_EGG):
 	@echo "Building protobuf Python egg ..."
 	cd ../$(PROTOBUF)/python && \
           CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
 	  PYTHONPATH=$(DISTRIBUTE_EGG) $(PYTHON) setup.py build bdist_egg
 
-CLEANFILES += $(PROTOBUF_EGG)
+  CLEANFILES += $(PROTOBUF_EGG)
+endif
 
 # This builds the mesos.native egg against libmesos_no_3rdparty.a that is
 # self-contained. It currently depends on the libraries in 3rdparty

http://git-wip-us.apache.org/repos/asf/mesos/blob/5643f64b/src/examples/java/test-exception-framework.in
----------------------------------------------------------------------
diff --git a/src/examples/java/test-exception-framework.in b/src/examples/java/test-exception-framework.in
index 065f3c0..76ffcf0 100644
--- a/src/examples/java/test-exception-framework.in
+++ b/src/examples/java/test-exception-framework.in
@@ -12,7 +12,7 @@ JAVA=${JAVA-${JAVA_HOME}/bin/java}
 # Use colors for errors.
 . ${MESOS_SOURCE_DIR}/support/colors.sh
 
-PROTOBUF_JAR=${MESOS_BUILD_DIR}/src/java/target/protobuf-java-2.5.0.jar
+PROTOBUF_JAR=@PROTOBUF_JAR@
 
 test ! -e ${PROTOBUF_JAR} && \
   echo "${RED}Failed to find ${PROTOBUF_JAR}${NORMAL}" && \

http://git-wip-us.apache.org/repos/asf/mesos/blob/5643f64b/src/examples/java/test-executor.in
----------------------------------------------------------------------
diff --git a/src/examples/java/test-executor.in b/src/examples/java/test-executor.in
index 35559d2..65ee051 100644
--- a/src/examples/java/test-executor.in
+++ b/src/examples/java/test-executor.in
@@ -12,7 +12,7 @@ JAVA=${JAVA-${JAVA_HOME}/bin/java}
 # Use colors for errors.
 . ${MESOS_SOURCE_DIR}/support/colors.sh
 
-PROTOBUF_JAR=${MESOS_BUILD_DIR}/src/java/target/protobuf-java-2.5.0.jar
+PROTOBUF_JAR=@PROTOBUF_JAR@
 
 test ! -e ${PROTOBUF_JAR} && \
   echo "${RED}Failed to find ${PROTOBUF_JAR}${NORMAL}" && \

http://git-wip-us.apache.org/repos/asf/mesos/blob/5643f64b/src/examples/java/test-framework.in
----------------------------------------------------------------------
diff --git a/src/examples/java/test-framework.in b/src/examples/java/test-framework.in
index 9af48f9..e889752 100644
--- a/src/examples/java/test-framework.in
+++ b/src/examples/java/test-framework.in
@@ -12,7 +12,7 @@ JAVA=${JAVA-${JAVA_HOME}/bin/java}
 # Use colors for errors.
 . ${MESOS_SOURCE_DIR}/support/colors.sh
 
-PROTOBUF_JAR=${MESOS_BUILD_DIR}/src/java/target/protobuf-java-2.5.0.jar
+PROTOBUF_JAR=@PROTOBUF_JAR@
 
 test ! -e ${PROTOBUF_JAR} && \
   echo "${RED}Failed to find ${PROTOBUF_JAR}${NORMAL}" && \

http://git-wip-us.apache.org/repos/asf/mesos/blob/5643f64b/src/examples/java/test-log.in
----------------------------------------------------------------------
diff --git a/src/examples/java/test-log.in b/src/examples/java/test-log.in
index 8afed0d..4c8547a 100644
--- a/src/examples/java/test-log.in
+++ b/src/examples/java/test-log.in
@@ -13,7 +13,7 @@ JAVA=${JAVA-${JAVA_HOME}/bin/java}
 . ${MESOS_SOURCE_DIR}/support/colors.sh
 
 # TODO(vinod): Deduce the protobuf version.
-PROTOBUF_JAR=${MESOS_BUILD_DIR}/src/java/target/protobuf-java-2.5.0.jar
+PROTOBUF_JAR=@PROTOBUF_JAR@
 
 test ! -e ${PROTOBUF_JAR} && \
   echo "${RED}Failed to find ${PROTOBUF_JAR}${NORMAL}" && \

http://git-wip-us.apache.org/repos/asf/mesos/blob/5643f64b/src/examples/java/test-multiple-executors-framework.in
----------------------------------------------------------------------
diff --git a/src/examples/java/test-multiple-executors-framework.in b/src/examples/java/test-multiple-executors-framework.in
index 235eb23..582d5b7 100644
--- a/src/examples/java/test-multiple-executors-framework.in
+++ b/src/examples/java/test-multiple-executors-framework.in
@@ -12,7 +12,7 @@ JAVA=${JAVA-${JAVA_HOME}/bin/java}
 # Use colors for errors.
 . ${MESOS_SOURCE_DIR}/support/colors.sh
 
-PROTOBUF_JAR=${MESOS_BUILD_DIR}/src/java/target/protobuf-java-2.5.0.jar
+PROTOBUF_JAR=@PROTOBUF_JAR@
 
 test ! -e ${PROTOBUF_JAR} && \
   echo "${RED}Failed to find ${PROTOBUF_JAR}${NORMAL}" && \

http://git-wip-us.apache.org/repos/asf/mesos/blob/5643f64b/src/examples/python/test-containerizer.in
----------------------------------------------------------------------
diff --git a/src/examples/python/test-containerizer.in b/src/examples/python/test-containerizer.in
index f71828d..3238ccc 100644
--- a/src/examples/python/test-containerizer.in
+++ b/src/examples/python/test-containerizer.in
@@ -27,8 +27,7 @@ PROTOBUF_EGG=${PROTOBUF}/python/dist/
 PROTOBUF_EGG+=protobuf-2.5.0@PYTHON_EGG_PUREPY_POSTFIX@.egg
 
 test ! -e ${PROTOBUF_EGG} && \
-  echo "${RED}Failed to find ${PROTOBUF_EGG}${NORMAL}" && \
-  exit 1
+  echo "${RED}Failed to find ${PROTOBUF_EGG} check your PYTHONPATH${NORMAL}"
 
 MESOS_EGGS=""
 for egg in interface native; do

http://git-wip-us.apache.org/repos/asf/mesos/blob/5643f64b/src/examples/python/test-executor.in
----------------------------------------------------------------------
diff --git a/src/examples/python/test-executor.in b/src/examples/python/test-executor.in
index b22e7a7..072fd7d 100644
--- a/src/examples/python/test-executor.in
+++ b/src/examples/python/test-executor.in
@@ -27,8 +27,7 @@ PROTOBUF_EGG=${PROTOBUF}/python/dist/
 PROTOBUF_EGG+=protobuf-2.5.0@PYTHON_EGG_PUREPY_POSTFIX@.egg
 
 test ! -e ${PROTOBUF_EGG} && \
-  echo "${RED}Failed to find ${PROTOBUF_EGG}${NORMAL}" && \
-  exit 1
+  echo "${RED}Failed to find ${PROTOBUF_EGG} check your PYTHONPATH${NORMAL}"
 
 MESOS_EGGS=""
 for egg in interface native; do

http://git-wip-us.apache.org/repos/asf/mesos/blob/5643f64b/src/examples/python/test-framework.in
----------------------------------------------------------------------
diff --git a/src/examples/python/test-framework.in b/src/examples/python/test-framework.in
index 64fb1dd..ee90e55 100644
--- a/src/examples/python/test-framework.in
+++ b/src/examples/python/test-framework.in
@@ -27,8 +27,7 @@ PROTOBUF_EGG=${PROTOBUF}/python/dist/
 PROTOBUF_EGG+=protobuf-2.5.0@PYTHON_EGG_PUREPY_POSTFIX@.egg
 
 test ! -e ${PROTOBUF_EGG} && \
-  echo "${RED}Failed to find ${PROTOBUF_EGG}${NORMAL}" && \
-  exit 1
+  echo "${RED}Failed to find ${PROTOBUF_EGG} check your PYTHONPATH ${NORMAL}"
 
 MESOS_EGGS=""
 for egg in interface native; do

http://git-wip-us.apache.org/repos/asf/mesos/blob/5643f64b/src/python/native/ext_modules.py.in
----------------------------------------------------------------------
diff --git a/src/python/native/ext_modules.py.in b/src/python/native/ext_modules.py.in
index 477e63d..4825fe4 100644
--- a/src/python/native/ext_modules.py.in
+++ b/src/python/native/ext_modules.py.in
@@ -64,7 +64,6 @@ LIBRARY_DIRS = []
 
 EXTRA_OBJECTS = [
     os.path.join(abs_top_builddir, 'src', '.libs', 'libmesos_no_3rdparty.a'),
-    os.path.join(abs_top_builddir, protobuf, 'src', '.libs', 'libprotobuf.a'),
     os.path.join(abs_top_builddir, libprocess, '.libs', 'libprocess.a')
 ]
 
@@ -75,6 +74,8 @@ libglog = os.path.join(abs_top_builddir, glog, '.libs', 'libglog.a')
 libleveldb = os.path.join(abs_top_builddir, leveldb, 'libleveldb.a')
 libzookeeper = os.path.join(
     abs_top_builddir, zookeeper, '.libs', 'libzookeeper_mt.a')
+libprotobuf = os.path.join(
+    abs_top_builddir, protobuf, 'src', '.libs', 'libprotobuf.a')
 
 if os.path.exists(libleveldb):
     EXTRA_OBJECTS.append(libleveldb)
@@ -96,6 +97,11 @@ if os.path.exists(libglog):
 else:
     EXTRA_OBJECTS.append('-lglog')
 
+if os.path.exists(libprotobuf):
+  EXTRA_OBJECTS.append(libprotobuf)
+else:
+  EXTRA_OBJECTS.append('-lprotobuf')
+
 # For gperftools, we need to check for the presence of libprofiler.a, since
 # it is possible to disable perftools inside libprocess.
 libprofiler = os.path.join(