Skip to content

[BUILD] Fixes grpc linking for OTLP exporter's tests #3435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 28, 2025

Conversation

owent
Copy link
Member

@owent owent commented May 22, 2025

Force build opentelemetry_proto and OTLP exporters as static libraries when protobuf or grpc are built static.

Fixes #3405

Changes

  • Build opentelemetry_proto and OTLP exporters as static libraries when protobuf or gRPC are statically built.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@owent owent requested a review from a team as a code owner May 22, 2025 12:14
Copy link

netlify bot commented May 22, 2025

Deploy Preview for opentelemetry-cpp-api-docs canceled.

Name Link
🔨 Latest commit 991561b
🔍 Latest deploy log https://app.netlify.com/projects/opentelemetry-cpp-api-docs/deploys/68603d576800680008987a3e

Copy link

codecov bot commented May 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.95%. Comparing base (82bddef) to head (991561b).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3435   +/-   ##
=======================================
  Coverage   89.95%   89.95%           
=======================================
  Files         219      219           
  Lines        7051     7051           
=======================================
  Hits         6342     6342           
  Misses        709      709           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbarker
Copy link
Member

dbarker commented May 30, 2025

Thanks for working on this @owent. I've added some feedback. Can you cherry-pick the tests commit from the testing PR #3427 into this PR so we can verify the changes?

I've tested this PR locally and the tests now pass with otel-cpp shared libs built with protobuf/grpc static libs (grpc 1.67 protobuf 5.27). The tests still fail to build with otel-cpp shared libs built with protobuf/grpc shared libs though.

@owent owent force-pushed the link_problems_of_grpc branch from b2837c5 to 4d8ab09 Compare May 30, 2025 17:29
@owent
Copy link
Member Author

owent commented May 30, 2025

Thanks for working on this @owent. I've added some feedback. Can you cherry-pick the tests commit from the testing PR #3427 into this PR so we can verify the changes?

I've tested this PR locally and the tests now pass with otel-cpp shared libs built with protobuf/grpc static libs (grpc 1.67 protobuf 5.27). The tests still fail to build with otel-cpp shared libs built with protobuf/grpc shared libs though.

Thanks. I just tested #3405 before. I will be on holiday these days. And I will test #3427 after that.

@dbarker
Copy link
Member

dbarker commented May 30, 2025

Thanks for working on this @owent. I've added some feedback. Can you cherry-pick the tests commit from the testing PR #3427 into this PR so we can verify the changes?
I've tested this PR locally and the tests now pass with otel-cpp shared libs built with protobuf/grpc static libs (grpc 1.67 protobuf 5.27). The tests still fail to build with otel-cpp shared libs built with protobuf/grpc shared libs though.

Thanks. I just tested #3405 before. I will be on holiday these days. And I will test #3427 after that.

Sounds good. We could address the test failures from #3427 in two PRs. This PR should fix the shared otel-cpp and static protobuf/grpc builds. Then a second PR can tackle the shared otel-cpp with shared protobuf/grpc libs build.

I think we can merge this PR with passing Run Tests (shared libs) steps added to the cmake_install.yml workflow jobs with the latest grpc/protobuf versions (ubuntu_2404_latest and ubuntu_2404_conan_latest). Can you add the following step to those jobs?

    - name: Run Tests (shared libs)
      env:
        BUILD_SHARED_LIBS: 'ON'
      run: ./ci/do_ci.sh cmake.install.test

@owent owent force-pushed the link_problems_of_grpc branch 2 times, most recently from 6f86f0f to c8cbb66 Compare June 7, 2025 13:41
@owent
Copy link
Member Author

owent commented Jun 7, 2025

Thanks for working on this @owent. I've added some feedback. Can you cherry-pick the tests commit from the testing PR #3427 into this PR so we can verify the changes?

I've tested this PR locally and the tests now pass with otel-cpp shared libs built with protobuf/grpc static libs (grpc 1.67 protobuf 5.27). The tests still fail to build with otel-cpp shared libs built with protobuf/grpc shared libs though.

The problem of building shared libraries with conan is solved now.
And I also cherry-pick #3427 into this PR to check the building.
Could you please have a look when you have time?@dbarker

@owent owent force-pushed the link_problems_of_grpc branch from 4f9d5ff to f829e9f Compare June 11, 2025 06:25
Copy link
Member

@dbarker dbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting two changes based on #3435 (comment)

(edit - good to merge) Changes requested:

  1. (edit - this is done) Remove handling of protobuf::libprotobuf and gRPC::grpc++ targets as INTERFACE_LIBRARY type from this PR and in that case default to the prior behavior of leaving the add_library <type> undefined (let BUILD_SHARED_LIBS determine the type).
  2. (edit - conan shared libs was test removed and we can add more testing in a separate PR) Remove the Run Tests (shared libs) step from the ubuntu_2404_conan_latest job and move that step to the ubuntu_2404_latest job.
  3. (edit - this is fixed) Remove OPENTELEMETRY_OTLP_PROTO_LIB_TYPE from opentelemetry-proto.cmake - please see #3435 (comment)

@owent owent force-pushed the link_problems_of_grpc branch from 84506fc to 225ebde Compare June 20, 2025 14:18
@owent owent force-pushed the link_problems_of_grpc branch from d5bf956 to 2e344f2 Compare June 24, 2025 09:27
Copy link
Member

@dbarker dbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for your time on this @owent

@marcalff marcalff changed the title Fixes grpc linking for OTLP exporter's tests [BUILD] Fixes grpc linking for OTLP exporter's tests Jun 28, 2025
@marcalff marcalff merged commit 7dfc312 into open-telemetry:main Jun 28, 2025
70 checks passed
@owent owent deleted the link_problems_of_grpc branch July 1, 2025 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add test for building otel-cpp shared libraries against shared libraries of grpc and protobuf
3 participants