You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "anku94 (via GitHub)" <gi...@apache.org> on 2025/03/27 22:51:07 UTC

[I] Missing find_dependency in cmake config files with external protobuf [arrow]

anku94 opened a new issue, #45959:
URL: https://github.com/apache/arrow/issues/45959

   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   I am getting some cmake configuration errors in `find_package(Arrow::arrow_static)` on Arrow built with Flight/FlightSQL support enabled but without internal protobuf. Specifically, the generated `ArrowTargets.cmake` incorrectly specifies `protobuf::libprotobuf` as an interface dependency for `Arrow::arrow_static`, even though Arrow itself (core library) does not depend on protobuf—only ArrowFlight and ArrowFlightSQL do.
   
   ```
   -- Arrow version: 19.0.0
   -- Found the Arrow shared library: /install-tree/lib/libarrow.so.1900.0.0
   -- Found the Arrow import library: ARROW_IMPORT_LIB-NOTFOUND
   -- Found the Arrow static library: /install-tree/lib/libarrow.a
   -- Parquet version: 19.0.0
   -- Found the Parquet shared library: /install-tree/lib/libparquet.so.1900.0.0
   -- Found the Parquet import library: PARQUET_IMPORT_LIB-NOTFOUND
   -- Found the Parquet static library: /install-tree/lib/libparquet.a
   -- Arrow version: 19.0.0
   -- Found the Arrow shared library: /install-tree/lib/libarrow.so.1900.0.0
   -- Found the Arrow import library: ARROW_IMPORT_LIB-NOTFOUND
   -- Found the Arrow static library: /install-tree/lib/libarrow.a
   -- Arrow version: 19.0.0
   -- Found the Arrow shared library: /install-tree/lib/libarrow.so.1900.0.0
   -- Found the Arrow import library: ARROW_IMPORT_LIB-NOTFOUND
   -- Found the Arrow static library: /install-tree/lib/libarrow.a
   -- Parquet version: 19.0.0
   -- Found the Parquet shared library: /install-tree/lib/libparquet.so.1900.0.0
   -- Found the Parquet import library: PARQUET_IMPORT_LIB-NOTFOUND
   -- Found the Parquet static library: /install-tree/lib/libparquet.a
   -- Configuring done (0.4s)
   CMake Error at /install-tree/lib/cmake/Arrow/ArrowTargets.cmake:70 (set_target_properties):
     The link interface of target "Arrow::arrow_static" contains:
   
       protobuf::libprotobuf
   
     but the target was not found.  Possible reasons include:
   
       * There is a typo in the target name.
       * A find_package call is missing for an IMPORTED target.
       * An ALIAS target is missing.
   
   Call Stack (most recent call first):
     /install-tree/lib/cmake/Arrow/ArrowConfig.cmake:125 (include)
     src/CMakeLists.txt:6 (find_package)
   
   ```
   
   I am building Arrow from the git tag `apache-arrow-19.0.0` with Flight, FlightSql, and Parquet enabled. Protobuf is being built separately.
   
   The problem seems to be that `ArrowTargets.cmake` specifies protobuf in its `INTERFACE_LINK_LIBRARIES`, but `ArrowConfig.cmake` does not trigger a `find_dependency` for protobuf because Arrow does not need protobuf, only ArrowFlight and ArrowFlightSql do.
   
   From `ArrowTargets.cmake`:
   ```
   set_target_properties(Arrow::arrow_static PROPERTIES
     INTERFACE_COMPILE_FEATURES "cxx_std_17"
     INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
     INTERFACE_LINK_LIBRARIES "Arrow::arrow_bundled_dependencies;OpenSSL::Crypto;OpenSSL::SSL;ZLIB::ZLIB;re2::re2;protobuf::libprotobuf;Threads::Threads;dl;rt"
   )
   ```
   
   From `ArrowConfig.cmake`:
   ```
   set(ARROW_SYSTEM_DEPENDENCIES "OpenSSLAlt;ZLIB;re2Alt")
   # This is used to trigger arrow_find_dependencies in the following lines
   ```
   
   For reference, `ArrowFlightConfig.cmake` does include protobuf and it builds correctly:
   ```
   set(ARROW_FLIGHT_SYSTEM_DEPENDENCIES "ProtobufAlt;abslAlt;gRPCAlt")
   ```
   
   ---
   
   I think the problem arises because of how `ARROW_WITH_PROTOBUF` is tracked. From `cpp/cmake_modules/ThirdpartyToolchain.cmake`:
   
   ```
   if(ARROW_ORC OR ARROW_FLIGHT)
     set(ARROW_WITH_PROTOBUF ON)
   endif()
   
   if(ARROW_SUBSTRAIT)
     set(ARROW_WITH_PROTOBUF ON)
   endif()
   ```
   
   And from `cpp/src/arrow/CMakeLists.txt`:
   ```
   # 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()
   ```
   
   If the triggering condition is `ARROW_FLIGHT`, Arrow itself contains no references to protobuf, and only the `INTERFACE_LINK_LIBRARIES` for `ArrowFlight::arrow_flight_static` should contain `protobuf::libprotobuf`.
   
   ### Component(s)
   
   C++


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] Missing find_dependency in cmake config files with external protobuf [arrow]

Posted by "anku94 (via GitHub)" <gi...@apache.org>.
anku94 commented on issue #45959:
URL: https://github.com/apache/arrow/issues/45959#issuecomment-2762040697

   Thanks for the quick fix!
   
   I've since encountered other issues trying to build Arrow with external protobuf/gRPC on Ubuntu 22.04 and GCC 11/12 (possibly related: https://github.com/protocolbuffers/protobuf/issues/19447) and I have reverted to `BUNDLED` mode for now, so unable to confirm if the fix works. Will close this for now and reopen when I am able to try it again.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] Missing find_dependency in cmake config files with external protobuf [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on issue #45959:
URL: https://github.com/apache/arrow/issues/45959#issuecomment-2762466041

   OK.
   
   Then I'll merge this for the next release for now.
   
   Could you try it again and share the result when you can do it?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] Missing find_dependency in cmake config files with external protobuf [arrow]

Posted by "anku94 (via GitHub)" <gi...@apache.org>.
anku94 closed issue #45959: [C++] Missing find_dependency in cmake config files with external protobuf
URL: https://github.com/apache/arrow/issues/45959


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] Missing find_dependency in cmake config files with external protobuf [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on issue #45959:
URL: https://github.com/apache/arrow/issues/45959#issuecomment-2762469309

   Issue resolved by pull request 45960
   https://github.com/apache/arrow/pull/45960


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] Missing find_dependency in cmake config files with external protobuf [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou closed issue #45959: [C++] Missing find_dependency in cmake config files with external protobuf
URL: https://github.com/apache/arrow/issues/45959


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org