Skip to content

Conversation

@owent
Copy link
Member

@owent owent commented Jan 6, 2026

Fixes #3799

Changes

Please provide a brief description of the changes here.

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

Copilot AI review requested due to automatic review settings January 6, 2026 12:35
@owent owent requested a review from a team as a code owner January 6, 2026 12:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds CI validation to ensure OpenTelemetry C++ can be built with a different C++ standard than the protobuf dependency it uses, addressing issue #3799 where MSVC linking errors occurred when protobuf was compiled with C++17 but OpenTelemetry was built with C++20.

Key Changes:

  • Adds new cmake.different_std.test CI target for both Linux (GCC) and Windows (MSVC) platforms
  • Linux GCC test installs dependencies with C++17, then builds OpenTelemetry with C++23
  • Windows MSVC test validates similar scenario with C++20 for OpenTelemetry

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
ci/do_ci.sh Adds new cmake.different_std.test target for Linux/GCC that builds with C++23 STL and enables OTLP file support
ci/do_ci.ps1 Adds new cmake.different_std.test target for Windows/MSVC that builds with C++20 STL, maintainer mode, and OTLP file support
.github/workflows/ci.yml Adds two new CI jobs: one for GCC (installs protobuf with C++17, builds with C++23) and one for MSVC (tests different C++ standards)

cmake "${CMAKE_OPTIONS[@]}" \
-DWITH_METRICS_EXEMPLAR_PREVIEW=ON \
-DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The PowerShell script sets DWITH_STL=CXX20 (line 278) and also explicitly sets DCMAKE_CXX_STANDARD=20 (line 279). However, the bash script only sets DWITH_STL=CXX23 (line 343) without explicitly setting CMAKE_CXX_STANDARD. This inconsistency could lead to different behaviors. Consider either adding CMAKE_CXX_STANDARD to the bash script or removing it from the PowerShell script to maintain consistency, or align both to use the same C++ standard version.

Suggested change
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DCMAKE_CXX_STANDARD=23 \

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.93%. Comparing base (f0a1da2) to head (00ca2ea).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3800   +/-   ##
=======================================
  Coverage   89.93%   89.93%           
=======================================
  Files         225      225           
  Lines        7163     7163           
=======================================
  Hits         6441     6441           
  Misses        722      722           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@owent owent force-pushed the proto_std_should_follow_pb branch from 159c5b0 to 626d7e2 Compare January 7, 2026 12:14
add --build-shared-libs "ON"
@owent owent force-pushed the proto_std_should_follow_pb branch from 5791943 to 4859e4e Compare January 8, 2026 12:34
owent added 2 commits January 8, 2026 21:17
Fixes the compatibility for old version of protobuf with C++14 used

Fixes DEFINED CMAKE_CXX_STANDARD checking
@owent owent force-pushed the proto_std_should_follow_pb branch from 9afd979 to 00ca2ea Compare January 9, 2026 13:40
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.

MSVC may link error when using protobuf built with C++17 but build otel-cpp with C++20

1 participant