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

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


The following commit(s) were added to refs/heads/main by this push:
     new f7dc37fff1 GH-39919: [C++][Dataset] Add missing Protobuf static link 
dependency (#40015)
f7dc37fff1 is described below

commit f7dc37fff17b5e5c68be59cfab287c4a2fa2cdb7
Author: Sutou Kouhei <[email protected]>
AuthorDate: Sat Feb 10 21:09:29 2024 +0900

    GH-39919: [C++][Dataset] Add missing Protobuf static link dependency 
(#40015)
    
    ### Rationale for this change
    
    We need to link system libprotobuf.a too when we link libarrow.a, ORC is 
enabled and system Protobuf is used.
    
    If we don't link system libprotobuf.a, some symbols are missing.
    
    ### What changes are included in this PR?
    
    Add missing `${ARROW_PROTOBUF_LIBPROTOBUF}` to 
`ARROW_STATIC_INSTALL_INTERFACE_LIBS`.
    
    ### Are these changes tested?
    
    Yes.
    
    ### Are there any user-facing changes?
    
    Yes.
    * Closes: #39919
    
    Lead-authored-by: Sutou Kouhei <[email protected]>
    Co-authored-by: Sutou Kouhei <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 cpp/CMakeLists.txt | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 50a85b33d5..7f2f7812e3 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -774,8 +774,7 @@ if(ARROW_ORC)
   list(APPEND ARROW_SHARED_LINK_LIBS orc::orc ${ARROW_PROTOBUF_LIBPROTOBUF})
   list(APPEND ARROW_STATIC_LINK_LIBS orc::orc ${ARROW_PROTOBUF_LIBPROTOBUF})
   if(ORC_SOURCE STREQUAL "SYSTEM")
-    list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS orc::orc
-         ${ARROW_PROTOBUF_LIBPROTOBUF})
+    list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS orc::orc)
   endif()
 endif()
 
@@ -824,9 +823,6 @@ if(ARROW_WITH_OPENTELEMETRY)
          opentelemetry-cpp::ostream_span_exporter
          opentelemetry-cpp::otlp_http_exporter)
   endif()
-  if(Protobuf_SOURCE STREQUAL "SYSTEM")
-    list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS 
${ARROW_PROTOBUF_LIBPROTOBUF})
-  endif()
   list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS CURL::libcurl)
 endif()
 
@@ -861,6 +857,14 @@ if(ARROW_USE_XSIMD)
   list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_XSIMD})
 endif()
 
+# This should be done after if(ARROW_ORC) and if(ARROW_WITH_OPENTELEMETRY)
+# because they depend on Protobuf.
+if(ARROW_WITH_PROTOBUF)
+  if(Protobuf_SOURCE STREQUAL "SYSTEM")
+    list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS 
${ARROW_PROTOBUF_LIBPROTOBUF})
+  endif()
+endif()
+
 add_custom_target(arrow_dependencies)
 add_custom_target(arrow_benchmark_dependencies)
 add_custom_target(arrow_test_dependencies)

Reply via email to