You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jp...@apache.org on 2017/11/03 17:11:22 UTC

[5/6] mesos git commit: Added workaround to unbreak the build with glibc <= 2.12.

Added workaround to unbreak the build with glibc <= 2.12.

In old versions of glibc, the <sys/sysmacros.h> header must be enclosed
in an `extern "C" { ... }` block. This prevents Mesos from linking on
CentOS 6.9 and likely other platforms from the same timeframe.

In more recent versions of glibc, the `extern "C" { ... }` linkage
declaration is not necessary (because the header file specifies this
itself). In this situation, there will now be two linkage declarations,
but that is fine: the inner-most linkage declaration takes precedence.

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


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

Branch: refs/heads/1.2.x
Commit: 180fc8b3e69ca15b8beffcb4d564c31852661a72
Parents: c6cf956
Author: Neil Conway <ne...@gmail.com>
Authored: Wed May 10 11:06:24 2017 -0700
Committer: James Peach <jp...@apache.org>
Committed: Fri Nov 3 09:48:36 2017 -0700

----------------------------------------------------------------------
 src/linux/fs.cpp                                         | 6 ++++++
 src/slave/containerizer/mesos/isolators/gpu/isolator.cpp | 6 ++++++
 src/tests/containerizer/fs_tests.cpp                     | 6 ++++++
 3 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/180fc8b3/src/linux/fs.cpp
----------------------------------------------------------------------
diff --git a/src/linux/fs.cpp b/src/linux/fs.cpp
index c0b8cc3..52dcab6 100644
--- a/src/linux/fs.cpp
+++ b/src/linux/fs.cpp
@@ -23,7 +23,13 @@
 #include <linux/limits.h>
 #include <linux/unistd.h>
 
+// This header include must be enclosed in an `extern "C"` block to
+// workaround a bug in glibc <= 2.12 (see MESOS-7378).
+//
+// TODO(neilc): Remove this when we no longer support glibc <= 2.12.
+extern "C" {
 #include <sys/sysmacros.h>
+}
 
 #include <list>
 #include <set>

http://git-wip-us.apache.org/repos/asf/mesos/blob/180fc8b3/src/slave/containerizer/mesos/isolators/gpu/isolator.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/gpu/isolator.cpp b/src/slave/containerizer/mesos/isolators/gpu/isolator.cpp
index 3fd1495..25636b5 100644
--- a/src/slave/containerizer/mesos/isolators/gpu/isolator.cpp
+++ b/src/slave/containerizer/mesos/isolators/gpu/isolator.cpp
@@ -16,7 +16,13 @@
 
 #include <stdint.h>
 
+// This header include must be enclosed in an `extern "C"` block to
+// workaround a bug in glibc <= 2.12 (see MESOS-7378).
+//
+// TODO(neilc): Remove this when we no longer support glibc <= 2.12.
+extern "C" {
 #include <sys/sysmacros.h>
+}
 
 #include <algorithm>
 #include <list>

http://git-wip-us.apache.org/repos/asf/mesos/blob/180fc8b3/src/tests/containerizer/fs_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/fs_tests.cpp b/src/tests/containerizer/fs_tests.cpp
index 00f3483..a8b93ba 100644
--- a/src/tests/containerizer/fs_tests.cpp
+++ b/src/tests/containerizer/fs_tests.cpp
@@ -18,7 +18,13 @@
 
 #include <gmock/gmock.h>
 
+// This header include must be enclosed in an `extern "C"` block to
+// workaround a bug in glibc <= 2.12 (see MESOS-7378).
+//
+// TODO(neilc): Remove this when we no longer support glibc <= 2.12.
+extern "C" {
 #include <sys/sysmacros.h>
+}
 
 #include <stout/foreach.hpp>
 #include <stout/gtest.hpp>