Skip to content

[opentelemetry-cpp] Add STL/stdlib support feature #47167

Description

Hello,

Opentelemetry-cpp natively supports builds with the standard template library instead of the internalnostd implementation, even though is not extremely clear how to do it from the official documentation.

More over, the guide for vcpkg reports a wrong feature that simply does not exists in the current opentelemetry-cpp port: vcpkg install opentelemetry[stdlib]

Of course both the above issues are for the opentelemetry-cpp repository and not for vcpkg, but I think that can be related to this.

It would be nice to support the stdlib in this port, honoring the feature that opentelemetry-cpp offers.

Moreover, in certain scenarios, trying to build with stdlib can produce ABI and C++ standard mismatches as reported in these issues open-telemetry/opentelemetry-cpp#1200, open-telemetry/opentelemetry-cpp#3363

After some investigations in the repository I figured out that the WITH_STL=<version> CMake option must match the CMAKE_CXX_STANDARD variable.
For example, both WITH_STL=2020 and CMAKE_CXX_STANDARD=20 variables must be added to the port in order to compile opentelemetry-cpp with stdlib and C++ 20.

Proposed solution

I created an overlay that add one feature per each CXX version: jacogasp@0475b97. It might be not the most elegant solution due to the manifold values supported by the WITH_STL variable, but it does the job.

Usage is vcpkg install opentelemetry-cpp[stdlib-cxx20]

I tested it in particular with CXX20.

If you think that changes are ok I can open a PR to add these features, otherwise I'm of course open to suggestions before submitting the PR.

Describe alternatives you've considered

No response

Additional context

No response

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:port-featureThe issue is with a library, which is requesting new capabilities that didn’t exist

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions