Skip to content

OpenTelemetry-cpp superbuild #1384

Description

@esigo

Before opening a feature request against this repo, consider whether the feature should/could be implemented in the other OpenTelemetry client libraries. If so, please open an issue on opentelemetry-specification first.

Is your feature request related to a problem?
If so, provide a concise description of the problem.
I have a piece of cmake that builds OpenTelemetry-cpp:

ExternalProject_Add(
  opentelemetry
  DEPENDS grpc
  GIT_REPOSITORY https://github.com/open-telemetry/opentelemetry-cpp.git
  GIT_TAG v1.3.0
  GIT_SHALLOW 1
  UPDATE_COMMAND ""
  CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}
             -DCMAKE_BUILD_TYPE=Release
             -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE
             -DWITH_ZIPKIN=OFF
             -DWITH_JAEGER=OFF
             -DWITH_EXAMPLES=OFF
             -DCMAKE_INSTALL_PREFIX=/opt/third_party/install
             -DBUILD_TESTING=OFF
             -DWITH_OTLP=ON
             -DBUILD_SHARED_LIBS=ON
             -DProtobuf_DIR=${STAGED_INSTALL_PREFIX}/lib/cmake/protobuf
             -Drotobuf_DIR=${STAGED_INSTALL_PREFIX}/lib/cmake/protobuf
             -DgRPC_DIR=${grpc_DIR}
             -Dabsl_DIR=${STAGED_INSTALL_PREFIX}/lib/cmake/absl
  CMAKE_CACHE_ARGS -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
  TEST_AFTER_INSTALL 0
  DOWNLOAD_NO_PROGRESS 1
  LOG_CONFIGURE 1
  LOG_BUILD 0
  LOG_INSTALL 1)

Where grpc is another external project (similar to #1382). The build fails using this cmake because we use find_package in module mode which doesn't find grpc/protobuf because of name mismatch. This can be solved if we use config search mode first.

failure:

  Found package configuration file:

    build/stage/lib/cmake/grpc/gRPCConfig.cmake

  but it set gRPC_FOUND to FALSE so package "gRPC" is considered to be NOT
  FOUND.  Reason given by package:

  The following imported targets are referenced, but are missing:
  protobuf::libprotobuf protobuf::libprotoc

Describe the solution you'd like
What do you want to happen instead? What is the expected behavior?
We can use this:

  find_package(Protobuf QUIET CONFIG)
  if((NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND))
    find_package(Protobuf)
  endif()

Describe alternatives you've considered
Which alternative solutions or features have you considered?

Additional context
Add any other context about the feature request here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions