From c5cdddda7c4b456e7760e5f7e12f0a705aa53171 Mon Sep 17 00:00:00 2001 From: Philipp Moritz Date: Wed, 27 Sep 2017 16:21:32 -0700 Subject: [PATCH 1/2] xcode 9 compilation workaround --- cpp/src/plasma/CMakeLists.txt | 1 + cpp/src/plasma/common.h | 2 ++ cpp/src/plasma/compat.h | 33 +++++++++++++++++++++++++++++++++ cpp/src/plasma/io.h | 1 + cpp/src/plasma/plasma.h | 2 ++ 5 files changed, 39 insertions(+) create mode 100644 cpp/src/plasma/compat.h diff --git a/cpp/src/plasma/CMakeLists.txt b/cpp/src/plasma/CMakeLists.txt index 7e91202623e..ed1762b32e5 100644 --- a/cpp/src/plasma/CMakeLists.txt +++ b/cpp/src/plasma/CMakeLists.txt @@ -111,6 +111,7 @@ target_link_libraries(plasma_store plasma_static) install(FILES common.h common_generated.h + compat.h client.h events.h plasma.h diff --git a/cpp/src/plasma/common.h b/cpp/src/plasma/common.h index 66d5f3069d0..cc67ffe4686 100644 --- a/cpp/src/plasma/common.h +++ b/cpp/src/plasma/common.h @@ -26,6 +26,8 @@ #define __STDC_FORMAT_MACROS #endif +#include "plasma/compat.h" + #include "arrow/status.h" #include "arrow/util/logging.h" diff --git a/cpp/src/plasma/compat.h b/cpp/src/plasma/compat.h new file mode 100644 index 00000000000..6934755b3b9 --- /dev/null +++ b/cpp/src/plasma/compat.h @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#ifndef PLASMA_COMPAT_H +#define PLASMA_COMPAT_H + +// Workaround for multithreading on XCode 9, see +// https://issues.apache.org/jira/browse/ARROW-1622 and +// https://github.com/tensorflow/tensorflow/issues/13220#issuecomment-331579775 +// This should be a short-term fix until the problem is fixed upstream. +#ifndef _MACH_PORT_T +#define _MACH_PORT_T +#include /* __darwin_mach_port_t */ +typedef __darwin_mach_port_t mach_port_t; +#include +mach_port_t pthread_mach_thread_np(pthread_t); +#endif /* _MACH_PORT_T */ + +#endif // PLASMA_COMPAT_H diff --git a/cpp/src/plasma/io.h b/cpp/src/plasma/io.h index ef96c06ccea..4beb1346be4 100644 --- a/cpp/src/plasma/io.h +++ b/cpp/src/plasma/io.h @@ -27,6 +27,7 @@ #include #include "arrow/status.h" +#include "plasma/compat.h" // TODO(pcm): Replace our own custom message header (message type, // message length, plasma protocol verion) with one that is serialized diff --git a/cpp/src/plasma/plasma.h b/cpp/src/plasma/plasma.h index 476002f68c0..603ff8a4fac 100644 --- a/cpp/src/plasma/plasma.h +++ b/cpp/src/plasma/plasma.h @@ -31,6 +31,8 @@ #include #include +#include "plasma/compat.h" + #include "arrow/status.h" #include "arrow/util/logging.h" #include "plasma/common.h" From 7642499fd6d3147dcd104c5c8da9d35fc4cee6e9 Mon Sep 17 00:00:00 2001 From: Philipp Moritz Date: Wed, 27 Sep 2017 16:57:04 -0700 Subject: [PATCH 2/2] fix on other platforms --- cpp/src/plasma/compat.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpp/src/plasma/compat.h b/cpp/src/plasma/compat.h index 6934755b3b9..ce751da1d71 100644 --- a/cpp/src/plasma/compat.h +++ b/cpp/src/plasma/compat.h @@ -22,6 +22,7 @@ // https://issues.apache.org/jira/browse/ARROW-1622 and // https://github.com/tensorflow/tensorflow/issues/13220#issuecomment-331579775 // This should be a short-term fix until the problem is fixed upstream. +#ifdef __APPLE__ #ifndef _MACH_PORT_T #define _MACH_PORT_T #include /* __darwin_mach_port_t */ @@ -29,5 +30,6 @@ typedef __darwin_mach_port_t mach_port_t; #include mach_port_t pthread_mach_thread_np(pthread_t); #endif /* _MACH_PORT_T */ +#endif /* __APPLE__ */ #endif // PLASMA_COMPAT_H