open-telemetry / open-telemetry/opentelemetry-cpp

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

Open
#3,799 3 comments 0 reactions 1 assignee View on GitHub

@owent is already working on this.

Since Dec 31, 2025.

bug do-not-stale
Dominant language
C++
Stars
1.4k
Forks
632
Avg merge
1d 13h
Merged PRs (30d)
75

Description

Describe your environment

Platform: Windows 11
Compiler: Visual Studio 2026 (v143 latest: v14.44(17.14))

Package:

  • Protobuf: v31.1 ( Compiling with c++17 standard )
  • abseil-cpp: 20250512.1 ( Compiling with c++17 standard )
  • otel-cpp: v1.24.0 ( Compiling with c++20 standard )

Steps to reproduce

Build package as above.

What is the expected behavior?

Build success

What is the actual behavior?

31>  pc-distributed-transaction-protocol.vcxproj -> D:\workspace\git\github\atframework\atsf4g-co\build_jobs_cmake_tools\publish\bin\Debug\pc-distributed-transaction-protocol.dll
32>  server_frame-config.vcxproj -> D:\workspace\git\github\atframework\atsf4g-co\build_jobs_cmake_tools\publish\bin\Debug\server_frame-config.dll
30>  pp-gamesvr-protocol.vcxproj -> D:\workspace\git\github\atframework\atsf4g-co\build_jobs_cmake_tools\publish\bin\Debug\pp-gamesvr-protocol.dll
33>------ Build started: Project: server_frame, Configuration: Debug x64 ------
33>     Creating library D:/workspace/git/github/atframework/atsf4g-co/build_jobs_cmake_tools/publish/lib/e6f3a084/lib/Debug/server_frame.lib and object D:/workspace/git/github/atframework/atsf4g-co/build_jobs_cmake_tools/publish/lib/e6f3a084/lib/Debug/server_frame.exp
33>opentelemetry_proto.lib(metrics_service.pb.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl google::protobuf::internal::ArenaStringPtr::ArenaStringPtr(class google::protobuf::internal::GlobalEmptyStringConstexpr const *,struct google::protobuf::internal::ConstantInitialized)" (__imp_??0ArenaStringPtr@internal@protobuf@google@@QEAA@PEBVGlobalEmptyStringConstexpr@123@UConstantInitialized@123@@Z)
33>opentelemetry_proto.lib(common.pb.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl google::protobuf::internal::ArenaStringPtr::ArenaStringPtr(class google::protobuf::internal::GlobalEmptyStringConstexpr const *,struct google::protobuf::internal::ConstantInitialized)" (__imp_??0ArenaStringPtr@internal@protobuf@google@@QEAA@PEBVGlobalEmptyStringConstexpr@123@UConstantInitialized@123@@Z)
33>opentelemetry_proto.lib(metrics.pb.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl google::protobuf::internal::ArenaStringPtr::ArenaStringPtr(class google::protobuf::internal::GlobalEmptyStringConstexpr const *,struct google::protobuf::internal::ConstantInitialized)" (__imp_??0ArenaStringPtr@internal@protobuf@google@@QEAA@PEBVGlobalEmptyStringConstexpr@123@UConstantInitialized@123@@Z)
33>opentelemetry_proto.lib(trace.pb.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl google::protobuf::internal::ArenaStringPtr::ArenaStringPtr(class google::protobuf::internal::GlobalEmptyStringConstexpr const *,struct google::protobuf::internal::ConstantInitialized)" (__imp_??0ArenaStringPtr@internal@protobuf@google@@QEAA@PEBVGlobalEmptyStringConstexpr@123@UConstantInitialized@123@@Z)
33>opentelemetry_proto.lib(trace_service.pb.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl google::protobuf::internal::ArenaStringPtr::ArenaStringPtr(class google::protobuf::internal::GlobalEmptyStringConstexpr const *,struct google::protobuf::internal::ConstantInitialized)" (__imp_??0ArenaStringPtr@internal@protobuf@google@@QEAA@PEBVGlobalEmptyStringConstexpr@123@UConstantInitialized@123@@Z)
33>opentelemetry_proto.lib(logs.pb.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl google::protobuf::internal::ArenaStringPtr::ArenaStringPtr(class google::protobuf::internal::GlobalEmptyStringConstexpr const *,struct google::protobuf::internal::ConstantInitialized)" (__imp_??0ArenaStringPtr@internal@protobuf@google@@QEAA@PEBVGlobalEmptyStringConstexpr@123@UConstantInitialized@123@@Z)
33>opentelemetry_proto.lib(logs_service.pb.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl google::protobuf::internal::ArenaStringPtr::ArenaStringPtr(class google::protobuf::internal::GlobalEmptyStringConstexpr const *,struct google::protobuf::internal::ConstantInitialized)" (__imp_??0ArenaStringPtr@internal@protobuf@google@@QEAA@PEBVGlobalEmptyStringConstexpr@123@UConstantInitialized@123@@Z)
33>    Hint on symbols that are defined and could potentially match:
33>      "__declspec(dllimport) public: __cdecl google::protobuf::internal::ArenaStringPtr::ArenaStringPtr(class google::protobuf::Arena *)" (__imp_??0ArenaStringPtr@internal@protobuf@google@@QEAA@PEAVArena@23@@Z)
33>      "__declspec(dllimport) public: __cdecl google::protobuf::internal::ArenaStringPtr::ArenaStringPtr(class google::protobuf::Arena *,struct google::protobuf::internal::ArenaStringPtr const &)" (__imp_??0ArenaStringPtr@internal@protobuf@google@@QEAA@PEAVArena@23@AEBU0123@@Z)
33>opentelemetry_proto.lib(metrics_service.pb.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) class google::protobuf::internal::GlobalEmptyStringConstexpr const google::protobuf::internal::fixed_address_empty_string" (__imp_?fixed_address_empty_string@internal@protobuf@google@@3VGlobalEmptyStringConstexpr@123@B)
33>opentelemetry_proto.lib(common.pb.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) class google::protobuf::internal::GlobalEmptyStringConstexpr const google::protobuf::internal::fixed_address_empty_string" (__imp_?fixed_address_empty_string@internal@protobuf@google@@3VGlobalEmptyStringConstexpr@123@B)
33>opentelemetry_proto.lib(metrics.pb.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) class google::protobuf::internal::GlobalEmptyStringConstexpr const google::protobuf::internal::fixed_address_empty_string" (__imp_?fixed_address_empty_string@internal@protobuf@google@@3VGlobalEmptyStringConstexpr@123@B)
33>opentelemetry_proto.lib(trace.pb.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) class google::protobuf::internal::GlobalEmptyStringConstexpr const google::protobuf::internal::fixed_address_empty_string" (__imp_?fixed_address_empty_string@internal@protobuf@google@@3VGlobalEmptyStringConstexpr@123@B)
33>opentelemetry_proto.lib(trace_service.pb.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) class google::protobuf::internal::GlobalEmptyStringConstexpr const google::protobuf::internal::fixed_address_empty_string" (__imp_?fixed_address_empty_string@internal@protobuf@google@@3VGlobalEmptyStringConstexpr@123@B)
33>opentelemetry_proto.lib(logs.pb.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) class google::protobuf::internal::GlobalEmptyStringConstexpr const google::protobuf::internal::fixed_address_empty_string" (__imp_?fixed_address_empty_string@internal@protobuf@google@@3VGlobalEmptyStringConstexpr@123@B)
33>opentelemetry_proto.lib(logs_service.pb.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) class google::protobuf::internal::GlobalEmptyStringConstexpr const google::protobuf::internal::fixed_address_empty_string" (__imp_?fixed_address_empty_string@internal@protobuf@google@@3VGlobalEmptyStringConstexpr@123@B)
33>D:\workspace\git\github\atframework\atsf4g-co\build_jobs_cmake_tools\publish\bin\Debug\server_frame.dll : fatal error LNK1120: 2 unresolved externals
34>------ Build started: Project: loginsvr, Configuration: Debug x64 ------

Additional context

Protobuf v31-v33 will have different ABI in C++17 and C++20, we should force the generated .pb.cc files be compiled as the same c++ standard as protobuf.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.