You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2019/05/02 00:24:12 UTC

[arrow] branch master updated: ARROW-5130: [C++][Python] Limit exporting of std::* symbols

This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 0289af2  ARROW-5130: [C++][Python] Limit exporting of std::* symbols
0289af2 is described below

commit 0289af23a780ee0947c97707b82bad4df2f6e30f
Author: Alex Sergeev <as...@uber.com>
AuthorDate: Wed May 1 19:23:59 2019 -0500

    ARROW-5130: [C++][Python] Limit exporting of std::* symbols
    
    This patch addresses the incompatibility of `pyarrow` and `tensorflow` wheels provided by Google.
    
    It has been tested with:
    
    ```python
    import pyarrow
    import tensorflow
    ```
    
    As well as more complicated examples such as https://github.com/horovod/horovod/blob/master/examples/keras_spark_rossmann.py which uses PyArrow + Petastorm to read the data.
    
    Fixes https://issues.apache.org/jira/browse/ARROW-5130
    
    Author: Alex Sergeev <as...@uber.com>
    
    Closes #4232 from alsrgv/simple_symbols and squashes the following commits:
    
    b82e32036 <Alex Sergeev> Add *std::__once_call* to excluded symbols
    21ecb9eb4 <Alex Sergeev> Add __once_proxy to excluded symbols
    54de31c6c <Alex Sergeev> Limit exporting of std::* symbols
---
 cpp/src/arrow/symbols.map               |  5 -----
 cpp/src/parquet/CMakeLists.txt          |  4 ++--
 cpp/src/parquet/symbols.map             |  2 ++
 cpp/src/plasma/CMakeLists.txt           | 10 ++++++++++
 cpp/src/{parquet => plasma}/symbols.map |  8 ++------
 5 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/cpp/src/arrow/symbols.map b/cpp/src/arrow/symbols.map
index 0149f95..a882525 100644
--- a/cpp/src/arrow/symbols.map
+++ b/cpp/src/arrow/symbols.map
@@ -18,11 +18,6 @@
 {
   global:
     extern "C++" {
-      # Export pthread_once-related symbols so that two SO files
-      # (e.g. libarrow.so and libplasma.so) don't use separate copies of
-      # those symbols.
-      # See https://github.com/apache/arrow/pull/1953#issuecomment-386057063
-      std::__once*;
       # The leading asterisk is required for symbols such as
       # "typeinfo for arrow::SomeClass".
       # Unfortunately this will also catch template specializations
diff --git a/cpp/src/parquet/CMakeLists.txt b/cpp/src/parquet/CMakeLists.txt
index 3615246..6798510 100644
--- a/cpp/src/parquet/CMakeLists.txt
+++ b/cpp/src/parquet/CMakeLists.txt
@@ -209,8 +209,8 @@ if(NOT APPLE AND NOT MSVC)
   # Localize thirdparty symbols using a linker version script. This hides them
   # from the client application. The OS X linker does not support the
   # version-script option.
-  set(SHARED_LINK_FLAGS
-      "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/parquet/symbols.map")
+  set(PARQUET_SHARED_LINK_FLAGS
+      "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map")
 endif()
 
 # Because of PARQUET-1420 (Thrift-generated symbols not exported in DLL),
diff --git a/cpp/src/parquet/symbols.map b/cpp/src/parquet/symbols.map
index e00751e..4bf032d 100644
--- a/cpp/src/parquet/symbols.map
+++ b/cpp/src/parquet/symbols.map
@@ -21,6 +21,7 @@
   local:
     # devtoolset / static-libstdc++ symbols
     __cxa_*;
+    __once_proxy;
 
     extern "C++" {
       # boost
@@ -34,5 +35,6 @@
       # a system with an older libstdc++ which doesn't include the necessary
       # c++11 symbols.
       std::*;
+      *std::__once_call*;
     };
 };
diff --git a/cpp/src/plasma/CMakeLists.txt b/cpp/src/plasma/CMakeLists.txt
index 729fba7..fa3b157 100644
--- a/cpp/src/plasma/CMakeLists.txt
+++ b/cpp/src/plasma/CMakeLists.txt
@@ -80,6 +80,14 @@ if(ARROW_CUDA)
   add_definitions(-DPLASMA_CUDA)
 endif()
 
+if(NOT APPLE AND NOT MSVC)
+  # Localize thirdparty symbols using a linker version script. This hides them
+  # from the client application. The OS X linker does not support the
+  # version-script option.
+  set(PLASMA_SHARED_LINK_FLAGS
+      "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map")
+endif()
+
 add_arrow_lib(plasma
               SOURCES
               ${PLASMA_SRCS}
@@ -87,6 +95,8 @@ add_arrow_lib(plasma
               PLASMA_LIBRARIES
               DEPENDENCIES
               gen_plasma_fbs
+              SHARED_LINK_FLAGS
+              ${PLASMA_SHARED_LINK_FLAGS}
               SHARED_LINK_LIBS
               ${PLASMA_LINK_LIBS}
               STATIC_LINK_LIBS
diff --git a/cpp/src/parquet/symbols.map b/cpp/src/plasma/symbols.map
similarity index 95%
copy from cpp/src/parquet/symbols.map
copy to cpp/src/plasma/symbols.map
index e00751e..32c86da 100644
--- a/cpp/src/parquet/symbols.map
+++ b/cpp/src/plasma/symbols.map
@@ -21,18 +21,14 @@
   local:
     # devtoolset / static-libstdc++ symbols
     __cxa_*;
+    __once_proxy;
 
     extern "C++" {
-      # boost
-      boost::*;
-
-	  # thrift
-	  apache::thrift::*;
-
       # devtoolset or -static-libstdc++ - the Red Hat devtoolset statically
       # links c++11 symbols into binaries so that the result may be executed on
       # a system with an older libstdc++ which doesn't include the necessary
       # c++11 symbols.
       std::*;
+      *std::__once_call*;
     };
 };