Skip to content

[C++] Allow building against system opentelemetry #44982

@h-vetinari

Description

@h-vetinari

Describe the enhancement requested

I've been wanting to add opentelemetry support in conda-forge for a long time, but given the amount of mutation that happens in packaging there, I wasn't comfortable in doing that before landing conda-forge/arrow-cpp-feedstock#1058.

Now that this is in, I've rebased the PR, but am running into problems pretty quickly. For one, arrow hardcodes

set(opentelemetry-cpp_SOURCE "AUTO")

even if the config explicitly asks for -Dopentelemetry-cpp_SOURCE="SYSTEM". With the following patch

diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 0b215b5b2..b9cc05953 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -4977,7 +4977,6 @@ if(ARROW_WITH_OPENTELEMETRY)
   # cURL is required whether we build from source or use an existing installation
   # (OTel's cmake files do not call find_curl for you)
   find_curl()
-  set(opentelemetry-cpp_SOURCE "AUTO")
   resolve_dependency(opentelemetry-cpp)
   set(ARROW_OPENTELEMETRY_LIBS
       opentelemetry-cpp::trace

I then run into further problems in ThirdpartyToolchain.cmake

CMake Error at cmake_modules/ThirdpartyToolchain.cmake:313 (find_package):
  By not providing "Findopentelemetry-cpp.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "opentelemetry-cpp", but CMake did not find one.

  Could not find a package configuration file provided by "opentelemetry-cpp"
  with any of the following names:

    opentelemetry-cppConfig.cmake
    opentelemetry-cpp-config.cmake

  Add the installation prefix of "opentelemetry-cpp" to CMAKE_PREFIX_PATH or
  set "opentelemetry-cpp_DIR" to a directory containing one of the above
  files.  If "opentelemetry-cpp" provides a separate development package or
  SDK, be sure it has been installed.
Call Stack (most recent call first):
  cmake_modules/ThirdpartyToolchain.cmake:4980 (resolve_dependency)
  CMakeLists.txt:546 (include)

despite the fact that our otel packages clearly contain the CMake metadata.

CC @lidavidm @kou

Component(s)

C++, Packaging

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions