You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2017/02/23 22:29:32 UTC

[1/4] mesos git commit: Dealt with some type casting warnings in common/values.cpp.

Repository: mesos
Updated Branches:
  refs/heads/master fb99cd00b -> fac4c5960


Dealt with some type casting warnings in common/values.cpp.

This fixes the type of the local variable we use to store an
IO stream's original precision while outputing a `Scalar` value.
We extraneously cast from a `std::streamsize` (`int`) to `long`.

Also, this removes an extranous cast from `size_t` to `int` in
a vector iteration loop.

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


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

Branch: refs/heads/master
Commit: fac4c59600d7c1b45fda128b114ebdff25b91a4c
Parents: 039343a
Author: Alex Clemmer <cl...@gmail.com>
Authored: Fri Feb 17 18:10:21 2017 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Thu Feb 23 14:28:42 2017 -0800

----------------------------------------------------------------------
 src/common/values.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/fac4c596/src/common/values.cpp
----------------------------------------------------------------------
diff --git a/src/common/values.cpp b/src/common/values.cpp
index cb26627..1ac327f 100644
--- a/src/common/values.cpp
+++ b/src/common/values.cpp
@@ -73,7 +73,8 @@ ostream& operator<<(ostream& stream, const Value::Scalar& scalar)
 {
   // Output the scalar's full significant digits and save the old
   // precision.
-  long precision = stream.precision(std::numeric_limits<double>::digits10);
+  std::streamsize precision =
+    stream.precision(std::numeric_limits<double>::digits10);
 
   // We discard any additional precision (of the fractional part)
   // from scalar resources before writing them to an ostream. This
@@ -609,12 +610,11 @@ Try<Value> parse(const string& text)
       for (size_t i = 0; i < tokens.size(); i += 2) {
         Value::Range* range = ranges->add_range();
 
-        int j = i;
-        Try<uint64_t> begin = numify<uint64_t>(tokens[j++]);
-        Try<uint64_t> end = numify<uint64_t>(tokens[j++]);
+        Try<uint64_t> begin = numify<uint64_t>(tokens[i]);
+        Try<uint64_t> end = numify<uint64_t>(tokens[i + 1]);
         if (begin.isError() || end.isError()) {
           return Error(
-              "Expecting non-negative integers in '" + tokens[j - 1] + "'");
+              "Expecting non-negative integers in '" + tokens[i] + "'");
         }
 
         range->set_begin(begin.get());


[3/4] mesos git commit: Windows: Silenced protobuf compilation warnings.

Posted by jo...@apache.org.
Windows: Silenced protobuf compilation warnings.

Generated code from protobufs generate warnings on MSVC and other
compilers.  On MSVC, this clutters the final list of warnings with
many (mostly harmless) warnings that we cannot address, due to
the fact that protobuf code is generated code.

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


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

Branch: refs/heads/master
Commit: 039343ab8be125d6491e061d879f42dd9518f9ec
Parents: af933d3
Author: Alex Clemmer <cl...@gmail.com>
Authored: Fri Feb 17 17:58:29 2017 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Thu Feb 23 14:28:42 2017 -0800

----------------------------------------------------------------------
 src/CMakeLists.txt | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/039343ab/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cacde5e..0d3654f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -125,6 +125,13 @@ add_dependencies(${MESOS_PROTOBUF_TARGET} ${PROTOBUF_TARGET})
 
 target_link_libraries(${MESOS_PROTOBUF_TARGET} ${PROTOBUF_LFLAG})
 
+if (WIN32)
+  # Disable all compiler warnings on Protocol Buffers source.
+  set_target_properties(
+    ${MESOS_PROTOBUF_TARGET}
+    PROPERTIES COMPILE_FLAGS "/w")
+endif (WIN32)
+
 
 # Configure Mesos files.
 ########################


[2/4] mesos git commit: Windows: Added build check for %PreferredToolArchitecture% == x64.

Posted by jo...@apache.org.
Windows: Added build check for %PreferredToolArchitecture% == x64.

Before building Mesos on a Windows machine, it is necessary to set
%PreferredToolArchitecture% to the value "x64". This is necessary to
work around (at least) two bugs in the MSVC backend: in particular, the
linker can sometimes take hours or days to link `mesos-x.x.x.lib`, and
the build system occasionally finds it self spuriously unable to find
file `mesos-x.x.x.lib` to link against.

These issues are well-known and documented (e.g., in the official Mesos
"getting started" document), but it is better to simply refuse to build
Mesos at all on Windows unless that environment variable is set.

This commit will introduce such a check.

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


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

Branch: refs/heads/master
Commit: af933d39d71f47696800a57cc48455cd7c06d0a4
Parents: f0f0c2f
Author: Alex Clemmer <cl...@gmail.com>
Authored: Fri Feb 17 15:43:55 2017 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Thu Feb 23 14:28:42 2017 -0800

----------------------------------------------------------------------
 cmake/CompilationConfigure.cmake     | 21 +++++++++++++++++++++
 docs/windows.md                      | 10 ++++++----
 src/CMakeLists.txt                   |  4 ++++
 src/slave/cmake/AgentConfigure.cmake |  4 ++++
 support/windows-build.bat            | 14 ++++++++------
 5 files changed, 43 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/af933d39/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 560935b..ed727e6 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -36,6 +36,27 @@ if (ENABLE_OPTIMIZE)
   endif (WIN32)
 endif (ENABLE_OPTIMIZE)
 
+if (WIN32)
+  # In MSVC 1900, there are two bugs in the linker, one that causes linking
+  # libmesos to occasionally take hours, and one that causes us to be able to
+  # fail to open the `mesos-x.lib` file. These have been confirmed as bugs with
+  # the MSVC backend team by hausdorff.
+  set(
+    ENSURE_TOOL_ARCH ensure_tool_arch
+    CACHE STRING "Ensures %PreferredToolArchitecture% == x64. See MESOS-6720.")
+
+  # NOTE: The "ERROR:" at the beginning of this message allows Visual Studio to
+  # pick up the error message and print it in the "Error List" pane.
+  ADD_CUSTOM_TARGET(
+    ${ENSURE_TOOL_ARCH} ALL
+    COMMAND
+      IF NOT "%PreferredToolArchitecture%" == "x64" (
+        echo "ERROR: Environment variable'PreferredToolArchitecture'
+          must be set to 'x64', see MESOS-6720 for details" 1>&2 && EXIT 1
+      )
+    )
+endif (WIN32)
+
 
 # 3RDPARTY OPTIONS.
 ###################

http://git-wip-us.apache.org/repos/asf/mesos/blob/af933d39/docs/windows.md
----------------------------------------------------------------------
diff --git a/docs/windows.md b/docs/windows.md
index 60de30a..38275f3 100644
--- a/docs/windows.md
+++ b/docs/windows.md
@@ -43,11 +43,13 @@ Following are the instructions for stock Windows 10 and Windows Server 2012 or n
     # Generate the solution and build.
     $ .\support\windows-build.bat
 
-    # After generating the Visual Studio solution you can use the IDE to open
-    # the project and skip the next step. In this case it is recommended to set
-    # `PreferredToolArchitecture` environment variable to `x64`.
+    # Set the `PreferredToolArchitecture` environment variable to `x64`.
     # NOTE: `PreferredToolArchitecture` can be set system-wide via Control Panel.
-    $ msbuild Mesos.sln /p:PreferredToolArchitecture=x64
+    $ SET PreferredToolArchitecture=x64
+
+    # After generating the Visual Studio solution you can use the IDE to open
+    # the project and skip this step.
+    $ msbuild Mesos.sln /m
 
     # mesos-agent.exe can be found in the <repository>\build\src folder.
     $ cd src

http://git-wip-us.apache.org/repos/asf/mesos/blob/af933d39/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3a4ace9..cacde5e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -531,6 +531,10 @@ add_dependencies(
   ${AGENT_DEPENDENCIES}
   )
 
+if (WIN32)
+  add_dependencies(${MESOS_TARGET} ${ENSURE_TOOL_ARCH})
+endif (WIN32)
+
 # ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
 ######################################################
 target_link_libraries(${MESOS_LIBS_TARGET} ${MESOS_PROTOBUF_TARGET} ${AGENT_LIBS})

http://git-wip-us.apache.org/repos/asf/mesos/blob/af933d39/src/slave/cmake/AgentConfigure.cmake
----------------------------------------------------------------------
diff --git a/src/slave/cmake/AgentConfigure.cmake b/src/slave/cmake/AgentConfigure.cmake
index 8d930d3..2e7ae6e 100644
--- a/src/slave/cmake/AgentConfigure.cmake
+++ b/src/slave/cmake/AgentConfigure.cmake
@@ -45,6 +45,10 @@ set(AGENT_DEPENDENCIES
   make_bin_src_dir
   )
 
+if (WIN32)
+  set(AGENT_DEPENDENCIES ${AGENT_DEPENDENCIES} ${ENSURE_TOOL_ARCH})
+endif (WIN32)
+
 # Define third-party include directories. Tells compiler toolchain where to get
 # headers for our third party libs (e.g., -I/path/to/glog on Linux).
 ###############################################################################

http://git-wip-us.apache.org/repos/asf/mesos/blob/af933d39/support/windows-build.bat
----------------------------------------------------------------------
diff --git a/support/windows-build.bat b/support/windows-build.bat
index 12f7232..88e177c 100644
--- a/support/windows-build.bat
+++ b/support/windows-build.bat
@@ -52,9 +52,11 @@ REM because the path to GNU Patch is not the default.
 cmake .. -G "Visual Studio 14 2015 Win64" -DENABLE_LIBEVENT=1 -DHAS_AUTHENTICATION=0 %OTHER_CMAKE_OPTIONS%
 if %errorlevel% neq 0 exit /b %errorlevel%
 
-REM NOTE: We pass in the build option `/p:PreferredToolArchitecture=x64`
-REM to force Visual Studio to use the native toolchain, which is (infinitely?)
-REM faster than the default cross-compiler.
+REM NOTE: We set the environment variable `PreferredToolArchitecture`
+REM to work around some known issues in Visual Studio's linking step.
+REM Without this variable set, MSVC may take hours/days to link
+REM and may sometimes erroneously fail to find the library to link against.
+SET PreferredToolArchitecture=x64
 
 REM NOTE: The build option `/m` tells Visual Studio to build projects in
 REM parallel if possible.
@@ -63,21 +65,21 @@ REM NOTE: Specifying a build "target" is done via the build option `/t`.
 REM Multiple targets can be specified with semi-comma separation.
 
 REM Build and run the stout tests.
-msbuild Mesos.sln /p:PreferredToolArchitecture=x64 /m /t:stout-tests
+msbuild Mesos.sln /m /t:stout-tests
 if %errorlevel% neq 0 exit /b %errorlevel%
 
 "3rdparty/stout/tests/Debug/stout-tests.exe"
 if %errorlevel% neq 0 exit /b %errorlevel%
 
 REM Build and run the libprocess tests.
-msbuild Mesos.sln /p:PreferredToolArchitecture=x64 /m /t:libprocess-tests
+msbuild Mesos.sln /m /t:libprocess-tests
 if %errorlevel% neq 0 exit /b %errorlevel%
 
 "3rdparty/libprocess/src/tests/Debug/libprocess-tests.exe"
 if %errorlevel% neq 0 exit /b %errorlevel%
 
 REM Build everything else.
-msbuild Mesos.sln /p:PreferredToolArchitecture=x64 /m
+msbuild Mesos.sln /m
 if %errorlevel% neq 0 exit /b %errorlevel%
 
 REM Due to how Mesos uses and creates symlinks, the next test suite


[4/4] mesos git commit: Windows: Undefined `ACL` macro defined in Zookeeper headers.

Posted by jo...@apache.org.
Windows: Undefined `ACL` macro defined in Zookeeper headers.

On Windows, Zookeeper will define a `ACL` macro because `Windows.h`
defines a `struct ACL`, different from Zookeeper's `struct ACL`.
Since this is a macro, it bleeds into other sources and ends up
replacing odd bits of code, such as when we access our namespaced
`ACL`s.  i.e. `mesos::ACL::RunTask`.

This commit undefines the `ACL` macro after the inclusion of the
Zookeeper headers in two places, while redefining the macro in the
one source file where we use Zookeeper's `struct ACL`.

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


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

Branch: refs/heads/master
Commit: f0f0c2f32c722b55d42705ecd0fbeca191cb00b9
Parents: fb99cd0
Author: Joseph Wu <jo...@apache.org>
Authored: Wed Feb 22 17:12:54 2017 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Thu Feb 23 14:28:42 2017 -0800

----------------------------------------------------------------------
 include/mesos/zookeeper/authentication.hpp | 7 +++++++
 include/mesos/zookeeper/zookeeper.hpp      | 7 +++++++
 src/tests/api_tests.cpp                    | 8 ++++++--
 src/zookeeper/authentication.cpp           | 9 +++++++++
 4 files changed, 29 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f0f0c2f3/include/mesos/zookeeper/authentication.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/zookeeper/authentication.hpp b/include/mesos/zookeeper/authentication.hpp
index 6a955ab..ac19f4e 100644
--- a/include/mesos/zookeeper/authentication.hpp
+++ b/include/mesos/zookeeper/authentication.hpp
@@ -19,6 +19,13 @@
 
 #include <zookeeper.h>
 
+#ifdef __WINDOWS__
+// NOTE: We need to undefine this macro to prevent it from bleeding
+// into our code and thereby break compilation of our namespaced ACLs.
+// This macro is defined in zookeeper/src/c/include/winconfig.h.
+#undef ACL
+#endif // __WINDOWS__
+
 #include <string>
 
 #include <glog/logging.h>

http://git-wip-us.apache.org/repos/asf/mesos/blob/f0f0c2f3/include/mesos/zookeeper/zookeeper.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/zookeeper/zookeeper.hpp b/include/mesos/zookeeper/zookeeper.hpp
index d4723dd..3b922a4 100644
--- a/include/mesos/zookeeper/zookeeper.hpp
+++ b/include/mesos/zookeeper/zookeeper.hpp
@@ -28,6 +28,13 @@
 
 #include <zookeeper.h>
 
+#ifdef __WINDOWS__
+// NOTE: We need to undefine this macro to prevent it from bleeding
+// into our code and thereby break compilation of our namespaced ACLs.
+// This macro is defined in zookeeper/src/c/include/winconfig.h.
+#undef ACL
+#endif // __WINDOWS__
+
 #include <string>
 #include <vector>
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/f0f0c2f3/src/tests/api_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/api_tests.cpp b/src/tests/api_tests.cpp
index 378612d..24f31ff 100644
--- a/src/tests/api_tests.cpp
+++ b/src/tests/api_tests.cpp
@@ -4128,7 +4128,9 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(AgentAPITest, LaunchNestedContainerSession)
 
 // This tests verifies that unauthorized principals are unable to
 // launch nested container sessions.
-TEST_P(AgentAPITest, LaunchNestedContainerSessionUnauthorized)
+TEST_P_TEMP_DISABLED_ON_WINDOWS(
+    AgentAPITest,
+    LaunchNestedContainerSessionUnauthorized)
 {
   ContentType contentType = GetParam();
 
@@ -4645,7 +4647,9 @@ TEST_F(AgentAPITest, AttachContainerInputFailure)
 
 // Verifies that unauthorized users are not able to attach to a
 // nested container input.
-TEST_P(AgentAPITest, AttachContainerInputAuthorization)
+TEST_P_TEMP_DISABLED_ON_WINDOWS(
+    AgentAPITest,
+    AttachContainerInputAuthorization)
 {
   ContentType contentType = GetParam();
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/f0f0c2f3/src/zookeeper/authentication.cpp
----------------------------------------------------------------------
diff --git a/src/zookeeper/authentication.cpp b/src/zookeeper/authentication.cpp
index 0fd99b0..9fcb540 100644
--- a/src/zookeeper/authentication.cpp
+++ b/src/zookeeper/authentication.cpp
@@ -16,6 +16,15 @@
 
 #include <mesos/zookeeper/authentication.hpp>
 
+#ifdef __WINDOWS__
+// NOTE: We need to redefine this macro, normally defined in
+// zookeeper/src/c/include/winconfig.h.  Headers that include
+// zookeeper.h typically need to undefine this macro to prevent
+// it from bleeding into other sources.  However, this file
+// needs to use the Zookeeper ACL struct, rather than Mesos ACLs.
+#define ACL ZKACL
+#endif // __WINDOWS__
+
 namespace zookeeper {
 
 ACL _EVERYONE_READ_CREATOR_ALL_ACL[] = {