[ 
https://issues.apache.org/jira/browse/ARROW-2416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16430199#comment-16430199
 ] 

ASF GitHub Bot commented on ARROW-2416:
---------------------------------------

xhochy closed pull request #1854: ARROW-2416: [C++] Support system libprotobuf
URL: https://github.com/apache/arrow/pull/1854
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index a61bcad83..b91368585 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -139,6 +139,10 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL 
"${CMAKE_CURRENT_SOURCE_DIR}")
     "Use vendored Boost instead of existing Boost"
     OFF)
 
+  option(ARROW_PROTOBUF_USE_SHARED
+    "Rely on Protocol Buffers shared libraries where relevant"
+    OFF)
+
   option(ARROW_PYTHON
     "Build the Arrow CPython extensions"
     OFF)
@@ -531,6 +535,7 @@ endif(UNIX)
 # Linker and Dependencies
 ############################################################
 
+set(ARROW_LINK_LIBS)
 set(ARROW_STATIC_LINK_LIBS)
 
 if (ARROW_WITH_BROTLI)
@@ -568,8 +573,16 @@ endif()
 if (ARROW_ORC)
   SET(ARROW_STATIC_LINK_LIBS
     orc
-    protobuf
     ${ARROW_STATIC_LINK_LIBS})
+  if (ARROW_PROTOBUF_USE_SHARED)
+    SET(ARROW_LINK_LIBS
+      protobuf
+      ${ARROW_LINK_LIBS})
+  else()
+    SET(ARROW_STATIC_LINK_LIBS
+      protobuf
+      ${ARROW_STATIC_LINK_LIBS})
+  endif()
 endif()
 
 if (ARROW_STATIC_LINK_LIBS)
@@ -583,7 +596,8 @@ set(ARROW_BENCHMARK_LINK_LIBS
   ${ARROW_STATIC_LINK_LIBS})
 
 set(ARROW_LINK_LIBS
-  ${ARROW_STATIC_LINK_LIBS})
+  ${ARROW_STATIC_LINK_LIBS}
+  ${ARROW_LINK_LIBS})
 
 set(ARROW_SHARED_PRIVATE_LINK_LIBS
   ${BOOST_SYSTEM_LIBRARY}
diff --git a/cpp/cmake_modules/FindProtobuf.cmake 
b/cpp/cmake_modules/FindProtobuf.cmake
index a42f4493a..9591bd1eb 100644
--- a/cpp/cmake_modules/FindProtobuf.cmake
+++ b/cpp/cmake_modules/FindProtobuf.cmake
@@ -36,15 +36,23 @@ find_path (PROTOBUF_INCLUDE_DIR 
google/protobuf/io/coded_stream.h HINTS
   NO_DEFAULT_PATH
   PATH_SUFFIXES "include")
 
+set (lib_dirs "lib")
+if (EXISTS "${_protobuf_path}/lib64")
+  set (lib_dirs "lib64" ${lib_dirs})
+endif ()
+if (EXISTS "${_protobuf_path}/lib/${CMAKE_LIBRARY_ARCHITECTURE}")
+  set (lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}" ${lib_dirs})
+endif ()
+
 find_library (PROTOBUF_LIBRARY NAMES protobuf PATHS
   ${_protobuf_path}
   NO_DEFAULT_PATH
-  PATH_SUFFIXES "lib")
+  PATH_SUFFIXES ${lib_dirs})
 
 find_library (PROTOC_LIBRARY NAMES protoc PATHS
   ${_protobuf_path}
   NO_DEFAULT_PATH
-  PATH_SUFFIXES "lib")
+  PATH_SUFFIXES ${lib_dirs})
 
 find_program(PROTOBUF_EXECUTABLE protoc HINTS
   ${_protobuf_path}
@@ -53,6 +61,8 @@ find_program(PROTOBUF_EXECUTABLE protoc HINTS
 
 if (PROTOBUF_INCLUDE_DIR AND PROTOBUF_LIBRARY AND PROTOC_LIBRARY AND 
PROTOBUF_EXECUTABLE)
   set (PROTOBUF_FOUND TRUE)
+  set (PROTOBUF_SHARED_LIB ${PROTOBUF_LIBRARY})
+  set (PROTOC_SHARED_LIB ${PROTOC_LIBRARY})
   get_filename_component (PROTOBUF_LIBS ${PROTOBUF_LIBRARY} PATH)
   set (PROTOBUF_LIB_NAME protobuf)
   set (PROTOC_LIB_NAME protoc)
@@ -64,7 +74,9 @@ endif ()
 
 if (PROTOBUF_FOUND)
   message (STATUS "Found the Protobuf headers: ${PROTOBUF_INCLUDE_DIR}")
+  message (STATUS "Found the Protobuf shared library: ${PROTOBUF_SHARED_LIB}")
   message (STATUS "Found the Protobuf library: ${PROTOBUF_STATIC_LIB}")
+  message (STATUS "Found the Protoc shared library: ${PROTOC_SHARED_LIB}")
   message (STATUS "Found the Protoc library: ${PROTOC_STATIC_LIB}")
   message (STATUS "Found the Protoc executable: ${PROTOBUF_EXECUTABLE}")
 else()
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake 
b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index be9d55c53..129174c8d 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -915,8 +915,13 @@ if (ARROW_ORC)
   endif ()
 
   include_directories (SYSTEM ${PROTOBUF_INCLUDE_DIR})
-  ADD_THIRDPARTY_LIB(protobuf
-    STATIC_LIB ${PROTOBUF_STATIC_LIB})
+  if (ARROW_PROTOBUF_USE_SHARED)
+    ADD_THIRDPARTY_LIB(protobuf
+      SHARED_LIB ${PROTOBUF_LIBRARY})
+  else ()
+    ADD_THIRDPARTY_LIB(protobuf
+      STATIC_LIB ${PROTOBUF_STATIC_LIB})
+  endif ()
 
   if (PROTOBUF_VENDORED)
     add_dependencies (protobuf protobuf_ep)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [C++] Support system libprotobuf
> --------------------------------
>
>                 Key: ARROW-2416
>                 URL: https://issues.apache.org/jira/browse/ARROW-2416
>             Project: Apache Arrow
>          Issue Type: Sub-task
>          Components: C++
>    Affects Versions: 0.9.0
>            Reporter: Kouhei Sutou
>            Assignee: Kouhei Sutou
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.10.0
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to