Skip to content

cmake fail if enable DBUILD_OPTEL but disable DBUILD_OPTEL_OTLP_BENCHMARKS #3213

@chuandew

Description

@chuandew

Describe the bug

when I set BUILD_OPTEL=ON and BUILD_OPTEL_OTLP_BENCHMARKS=OFF, cmake configure fail

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

when I set BUILD_OPTEL=ON and BUILD_OPTEL_OTLP_BENCHMARKS=OFF, cmake configure should success.

Current Behavior

cmake -DCMAKE_PREFIX_PATH=/home/chuande/workspace/dingofs/third-party/installed -DBUILD_OPTEL=ON -DBUILD_SHARED_LIBS=OFF -DENABLE_TESTING=OFF -DAUTORUN_UNIT_TESTS=OFF -DBUILD_ONLY=s3 -DBUILD_OPTEL=ON -DBUILD_OPTEL_OTLP_BENCHMARKS=OFF ..

CMake Error at /home/chuande/workspace/dingofs/third-party/installed/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-target.cmake:142 (set_target_properties):
  The link interface of target "opentelemetry-cpp::otlp_http_client"
  contains:

    nlohmann_json::nlohmann_json

  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):
  /home/chuande/workspace/dingofs/third-party/installed/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-config.cmake:131 (include)
  cmake/external_dependencies.cmake:114 (find_package)
  CMakeLists.txt:199 (include)

cmake -DCMAKE_PREFIX_PATH=/home/chuande/workspace/dingofs/third-party/installed -DBUILD_OPTEL=ON -DBUILD_SHARED_LIBS=OFF -DENABLE_TESTING=OFF -DAUTORUN_UNIT_TESTS=OFF -DBUILD_ONLY=s3 -DBUILD_OPTEL=ON -DBUILD_OPTEL_OTLP_BENCHMARKS=ON ..

-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:opentelemetry-cpp::api
-- SKIPPING:opentelemetry-cpp::api
-- SKIPPING:opentelemetry-cpp::sdk
-- SKIPPING:opentelemetry-cpp::sdk
-- SKIPPING:opentelemetry-cpp::ext
-- SKIPPING:opentelemetry-cpp::ext
-- Configuring done (8.8s)
-- Generating done (0.3s)
-- Build files have been written to: /home/chuande/workspace/aws-sdk-cpp/build

-

Reproduction Steps

In build dir run

cmake -DCMAKE_PREFIX_PATH=/home/chuande/workspace/dingofs/third-party/installed -DBUILD_OPTEL=ON  -DBUILD_SHARED_LIBS=OFF  -DENABLE_TESTING=OFF  -DAUTORUN_UNIT_TESTS=OFF  -DBUILD_ONLY=s3 -DBUILD_OPTEL=ON -DBUILD_OPTEL_OTLP_BENCHMARKS=OFF ..

Possible Solution

In external_dependencies.cmake,if BUILD_OPTEL enable, call find_package(nlohmann_json REQUIRED)

# Open telemetry client
if (BUILD_OPTEL)
    find_package(nlohmann_json REQUIRED)
    find_package(opentelemetry-cpp CONFIG REQUIRED)
endif ()

Additional Information/Context

No response

AWS CPP SDK version used

1.11.399

Compiler and Version used

gcc (GCC) 13.1.1 20230614 (Red Hat 13.1.1-4) Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

Operating System and version

Rocky Linux release 8.9 (Green Obsidian)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions