-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
When building gRPC/1.72.0 on windows with -s:a compiler.runtime=static
, the build fails when producing the gRPC C++ plugin, as follows:
2025-10-14T20:38:45.6168332Z libprotoc.lib(code_generator.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in cpp_plugin.obj [C:\Users\runneradmin\.conan2\p\b\grpcb32e956441a79\b\build\grpc_cpp_plugin.vcxproj]
This can be worked around by explicitly passing -c:a tools.cmake.cmaketoolchain:extra_variables="{'gRPC_MSVC_STATIC_RUNTIME': 'ON'}"
in order to tell the gRPC build to expect the static runtime. However, this should probably happen automatically as part of the conan recipe when compiler.runtime=static
: it took me a lot of digging and false starts to figure out that I needed to tunnel that flag in (and how to do so).
Package and Environment Details
- Package Name/Version: grpc/1.72.0
- Operating System+version: Microsoft Windows Server 2025
- Compiler+version: MSVC 19.44.35217.0
- Conan version: conan v2.21.0
- Python version: Python ???
Conan profile
2025-10-14T19:33:24.0147217Z Profile host:
2025-10-14T19:33:24.0147814Z [settings]
2025-10-14T19:33:24.0148105Z arch=x86_64
2025-10-14T19:33:24.0148345Z build_type=Release
2025-10-14T19:33:24.0148610Z compiler=msvc
2025-10-14T19:33:24.0148858Z compiler.cppstd=17
2025-10-14T19:33:24.0149132Z compiler.runtime=static
2025-10-14T19:33:24.0149424Z compiler.runtime_type=Release
2025-10-14T19:33:24.0149954Z compiler.version=194
2025-10-14T19:33:24.0150295Z os=Windows
2025-10-14T19:33:24.0150602Z &:build_type=RelWithDebInfo
2025-10-14T19:33:24.0150920Z [options]
2025-10-14T19:33:24.0151149Z &:shared=False
2025-10-14T19:33:24.0151397Z *:shared=False
2025-10-14T19:33:24.0151664Z grpc/*:csharp_plugin=False
2025-10-14T19:33:24.0152007Z grpc/*:node_plugin=False
2025-10-14T19:33:24.0152331Z grpc/*:objective_c_plugin=False
2025-10-14T19:33:24.0152687Z grpc/*:otel_plugin=False
2025-10-14T19:33:24.0152999Z grpc/*:php_plugin=False
2025-10-14T19:33:24.0153309Z grpc/*:python_plugin=False
2025-10-14T19:33:24.0153642Z grpc/*:ruby_plugin=False
2025-10-14T19:33:24.0153932Z [conf]
2025-10-14T19:33:24.0154199Z tools.microsoft:winsdk_version=10.0.17763.0
2025-10-14T19:33:24.0154489Z
2025-10-14T19:33:24.0154591Z Profile build:
2025-10-14T19:33:24.0154830Z [settings]
2025-10-14T19:33:24.0155024Z arch=x86_64
2025-10-14T19:33:24.0155264Z build_type=Release
2025-10-14T19:33:24.0155536Z compiler=msvc
2025-10-14T19:33:24.0155797Z compiler.cppstd=17
2025-10-14T19:33:24.0156088Z compiler.runtime=dynamic
2025-10-14T19:33:24.0156435Z compiler.runtime_type=Release
2025-10-14T19:33:24.0156794Z compiler.version=194
2025-10-14T19:33:24.0157071Z os=Windows
2025-10-14T19:33:24.0157304Z [options]
2025-10-14T19:33:24.0157550Z grpc/*:csharp_plugin=False
2025-10-14T19:33:24.0157891Z grpc/*:node_plugin=False
2025-10-14T19:33:24.0158227Z grpc/*:objective_c_plugin=False
2025-10-14T19:33:24.0158578Z grpc/*:otel_plugin=False
2025-10-14T19:33:24.0158886Z grpc/*:php_plugin=False
2025-10-14T19:33:24.0159598Z grpc/*:python_plugin=False
2025-10-14T19:33:24.0159924Z grpc/*:ruby_plugin=False
Steps to reproduce
Build any package with a gRPC dependency with -s:a compiler.runtime=static
Logs
2025-10-14T20:38:40.9830043Z Building Custom Rule C:/Users/runneradmin/.conan2/p/b/grpcb32e956441a79/b/src/CMakeLists.txt
2025-10-14T20:38:41.0529506Z cpp_plugin.cc
2025-10-14T20:38:45.6168332Z libprotoc.lib(code_generator.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in cpp_plugin.obj [C:\Users\runneradmin\.conan2\p\b\grpcb32e956441a79\b\build\grpc_cpp_plugin.vcxproj]
2025-10-14T20:38:45.6171740Z libprotoc.lib(plugin.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in cpp_plugin.obj [C:\Users\runneradmin\.conan2\p\b\grpcb32e956441a79\b\build\grpc_cpp_plugin.vcxproj]
2025-10-14T20:38:45.6173720Z libprotoc.lib(generator.cc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in cpp_plugin.obj [C:\Users\runneradmin\.conan2\p\b\grpcb32e956441a79\b\build\grpc_cpp_plugin.vcxproj]
2025-10-14T20:38:45.6185852Z libprotoc.lib(plugin.pb.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in cpp_plugin.obj [C:\Users\runneradmin\.conan2\p\b\grpcb32e956441a79\b\build\grpc_cpp_plugin.vcxproj]
2025-10-14T20:38:45.6195211Z libprotoc.lib(helpers.cc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in cpp_plugin.obj [C:\Users\runneradmin\.conan2\p\b\grpcb32e956441a79\b\build\grpc_cpp_plugin.vcxproj]
2025-10-14T20:38:45.6216667Z libprotoc.lib(pyi_generator.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in cpp_plugin.obj [C:\Users\runneradmin\.conan2\p\b\grpcb32e956441a79\b\build\grpc_cpp_plugin.vcxproj]
2025-10-14T20:38:45.6243613Z libprotoc.lib(retention.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in cpp_plugin.obj [C:\Users\runneradmin\.conan2\p\b\grpcb32e956441a79\b\build\grpc_cpp_plugin.vcxproj]
2025-10-14T20:38:45.6253641Z libprotoc.lib(versions.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in cpp_plugin.obj [C:\Users\runneradmin\.conan2\p\b\grpcb32e956441a79\b\build\grpc_cpp_plugin.vcxproj]
...
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working