-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
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.
This is on Ubuntu 22.04, with Cmake version 3.31.6.
Component(s)
C++