microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.74k stars 6.29k forks source link

[gRPC] build failure #21457

Closed YuryBrodskiy closed 2 years ago

YuryBrodskiy commented 2 years ago

Host Environment

To Reproduce Steps to reproduce the behavior:

git clone https://github.com/microsoft/vcpkg  
.\bootstrap-vcpkg.bat  
./vcpkg install grpc:x64-windows  

Failure logs

[1037/1050] cmd.exe /C "cd . && C:\PROGRA~2\MICROS~2\2019\PROFES~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\lib.exe  /machine:x64 /nologo /out:grpc++_unsecure.lib CMakeFiles\grpc++_unsecure.dir\src\cpp\client\channel_cc.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\client\client_callback.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\client\client_context.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\client\client_interceptor.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\client\create_channel.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\client\create_channel_internal.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\client\create_channel_posix.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\client\credentials_cc.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\client\insecure_credentials.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\codegen\codegen_init.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\common\alarm.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\common\channel_arguments.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\common\channel_filter.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\common\completion_queue_cc.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\common\core_codegen.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\common\insecure_create_auth_context.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\common\resource_quota_cc.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\common\rpc_method.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\common\validate_service_config.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\common\version_cc.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\async_generic_service.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\channel_argument_option.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\create_default_thread_pool.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\dynamic_thread_pool.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\external_connection_acceptor_impl.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\health\default_health_check_service.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\health\health_check_service.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\health\health_check_service_server_builder_option.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\insecure_server_credentials.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\server_builder.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\server_callback.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\server_cc.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\server_context.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\server_credentials.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\server\server_posix.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\thread_manager\thread_manager.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\util\byte_buffer_cc.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\util\status.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\util\string_ref.cc.obj CMakeFiles\grpc++_unsecure.dir\src\cpp\util\time_cc.cc.obj  && cd ."
[1038/1050] cmd.exe /C "cd /D C:\workspace\vcpkg\buildtrees\grpc\src\2180080eb4-87c05d756b.clean && C:\workspace\vcpkg\installed\x64-windows\tools\protobuf\protoc.exe --grpc_out=generate_mock_code=true:C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens --cpp_out=C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens --plugin=protoc-gen-grpc=C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/grpc_cpp_plugin.exe -I . -I C:/workspace/vcpkg/installed/x64-windows/include src/proto/grpc/reflection/v1alpha/reflection.proto"
FAILED: gens/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc gens/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h gens/src/proto/grpc/reflection/v1alpha/reflection_mock.grpc.pb.h gens/src/proto/grpc/reflection/v1alpha/reflection.pb.cc gens/src/proto/grpc/reflection/v1alpha/reflection.pb.h C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/reflection/v1alpha/reflection_mock.grpc.pb.h C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/reflection/v1alpha/reflection.pb.cc C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/reflection/v1alpha/reflection.pb.h 
cmd.exe /C "cd /D C:\workspace\vcpkg\buildtrees\grpc\src\2180080eb4-87c05d756b.clean && C:\workspace\vcpkg\installed\x64-windows\tools\protobuf\protoc.exe --grpc_out=generate_mock_code=true:C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens --cpp_out=C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens --plugin=protoc-gen-grpc=C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/grpc_cpp_plugin.exe -I . -I C:/workspace/vcpkg/installed/x64-windows/include src/proto/grpc/reflection/v1alpha/reflection.proto"
--grpc_out: protoc-gen-grpc: Plugin failed with status code 3221225781.
[1039/1050] cmd.exe /C "cd /D C:\workspace\vcpkg\buildtrees\grpc\src\2180080eb4-87c05d756b.clean && C:\workspace\vcpkg\installed\x64-windows\tools\protobuf\protoc.exe --grpc_out=generate_mock_code=true:C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens --cpp_out=C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens --plugin=protoc-gen-grpc=C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/grpc_cpp_plugin.exe -I . -I C:/workspace/vcpkg/installed/x64-windows/include src/proto/grpc/channelz/channelz.proto"
FAILED: gens/src/proto/grpc/channelz/channelz.grpc.pb.cc gens/src/proto/grpc/channelz/channelz.grpc.pb.h gens/src/proto/grpc/channelz/channelz_mock.grpc.pb.h gens/src/proto/grpc/channelz/channelz.pb.cc gens/src/proto/grpc/channelz/channelz.pb.h C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/channelz/channelz.grpc.pb.cc C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/channelz/channelz.grpc.pb.h C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/channelz/channelz_mock.grpc.pb.h C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/channelz/channelz.pb.cc C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/channelz/channelz.pb.h 
cmd.exe /C "cd /D C:\workspace\vcpkg\buildtrees\grpc\src\2180080eb4-87c05d756b.clean && C:\workspace\vcpkg\installed\x64-windows\tools\protobuf\protoc.exe --grpc_out=generate_mock_code=true:C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens --cpp_out=C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens --plugin=protoc-gen-grpc=C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/grpc_cpp_plugin.exe -I . -I C:/workspace/vcpkg/installed/x64-windows/include src/proto/grpc/channelz/channelz.proto"
--grpc_out: protoc-gen-grpc: Plugin failed with status code 3221225781.
ninja: build stopped: subcommand failed.

Additional context None;

JackBoosY commented 2 years ago

3221225781 is 0xC0000135. Please check whether libprotoc.dll and libprotobuf.dll is installed in C:\workspace\vcpkg\installed\x64-windows\tools\protobuf\protoc.exe. If not, please copy them from C:\workspace\vcpkg\installed\x64-windows\lib into this path and try again.

This issue is tracking in https://github.com/microsoft/vcpkg/issues/12849.

YuryBrodskiy commented 2 years ago

Hi JackBoosY, The dlls are present in the folder. Those are the only dll are in the folder. Just in case I have tried to copy dll you mentioned from the bin folder(lib folder has no dll) manually again.
The problem persists.

JackBoosY commented 2 years ago

Can you please run command C:\workspace\vcpkg\installed\x64-windows\tools\protobuf\protoc.exe manually in cmd and provide the output?

Thanks.

Note to myself: The command is:

cd
/D
C:\workspace\vcpkg\buildtrees\grpc\src\2180080eb4-87c05d756b.clean
&&
C:\workspace\vcpkg\installed\x64-windows\tools\protobuf\protoc.exe
--grpc_out=generate_mock_code=true:C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens
--cpp_out=C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/gens
--plugin=protoc-gen-grpc=C:/workspace/vcpkg/buildtrees/grpc/x64-windows-dbg/grpc_cpp_plugin.exe
-I
.
-I
C:/workspace/vcpkg/installed/x64-windows/include
src/proto/grpc/reflection/v1alpha/reflection.proto
YuryBrodskiy commented 2 years ago

So just running protoc.exe results in help information (command option displayed). When using the command from the build script lien [1038/1050] from above, I have System error popups:

Missing dll:
libprotocd.dll
libprotobufd.dll
MSVCP140D.dll
VCRUNTIME140D.dll

In command line output
protoc-gen-grpc: Plugin failed with status code 3221225781

I have found the solution:
 Visual Studio requires additional components installed
Below is a working list (probably way more than needed)

{
  "version": "1.0",
  "components": [
    "Microsoft.VisualStudio.Component.CoreEditor",
    "Microsoft.VisualStudio.Workload.CoreEditor",
    "Microsoft.NetCore.Component.Runtime.5.0",
    "Microsoft.NetCore.Component.Runtime.3.1",
    "Microsoft.NetCore.Component.SDK",
    "Microsoft.VisualStudio.Component.NuGet",
    "Microsoft.Net.Component.4.6.1.TargetingPack",
    "Microsoft.VisualStudio.Component.Roslyn.Compiler",
    "Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
    "Microsoft.VisualStudio.Component.FSharp",
    "Microsoft.ComponentGroup.ClickOnce.Publish",
    "Microsoft.NetCore.Component.DevelopmentTools",
    "Microsoft.VisualStudio.Component.FSharp.WebTemplates",
    "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions",
    "Microsoft.VisualStudio.Component.DockerTools",
    "Microsoft.NetCore.Component.Web",
    "Microsoft.Net.Component.4.8.SDK",
    "Microsoft.Net.Component.4.7.2.TargetingPack",
    "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
    "Microsoft.VisualStudio.Component.TypeScript.4.3",
    "Microsoft.VisualStudio.Component.JavaScript.TypeScript",
    "Microsoft.VisualStudio.Component.JavaScript.Diagnostics",
    "Microsoft.Component.MSBuild",
    "Microsoft.VisualStudio.Component.TextTemplating",
    "Component.Microsoft.VisualStudio.RazorExtension",
    "Microsoft.VisualStudio.Component.IISExpress",
    "Microsoft.VisualStudio.Component.SQL.ADAL",
    "Microsoft.VisualStudio.Component.SQL.LocalDB.Runtime",
    "Microsoft.VisualStudio.Component.Common.Azure.Tools",
    "Microsoft.VisualStudio.Component.SQL.CLR",
    "Microsoft.VisualStudio.Component.MSODBC.SQL",
    "Microsoft.VisualStudio.Component.MSSQL.CMDLnUtils",
    "Microsoft.VisualStudio.Component.ManagedDesktop.Core",
    "Microsoft.Net.Component.4.5.2.TargetingPack",
    "Microsoft.Net.Component.4.5.TargetingPack",
    "Microsoft.VisualStudio.Component.SQL.SSDT",
    "Microsoft.VisualStudio.Component.SQL.DataSources",
    "Component.Microsoft.Web.LibraryManager",
    "Component.Microsoft.WebTools.BrowserLink.WebLivePreview",
    "Microsoft.VisualStudio.ComponentGroup.Web",
    "Microsoft.VisualStudio.Component.Web",
    "Microsoft.VisualStudio.ComponentGroup.Web.Client",
    "Microsoft.Net.Component.4.TargetingPack",
    "Microsoft.Net.Component.4.5.1.TargetingPack",
    "Microsoft.Net.Component.4.6.TargetingPack",
    "Microsoft.Net.ComponentGroup.TargetingPacks.Common",
    "Component.Microsoft.VisualStudio.Web.AzureFunctions",
    "Microsoft.VisualStudio.ComponentGroup.AzureFunctions",
    "Microsoft.VisualStudio.Component.Azure.Compute.Emulator",
    "Microsoft.VisualStudio.Component.Azure.Storage.Emulator",
    "Microsoft.VisualStudio.Component.Azure.ClientLibs",
    "Microsoft.VisualStudio.Component.Azure.AuthoringTools",
    "Microsoft.VisualStudio.Component.CloudExplorer",
    "Microsoft.VisualStudio.ComponentGroup.Web.CloudTools",
    "Microsoft.VisualStudio.Component.DiagnosticTools",
    "Microsoft.VisualStudio.Component.EntityFramework",
    "Microsoft.VisualStudio.Component.AspNet45",
    "Microsoft.VisualStudio.Component.AppInsights.Tools",
    "Microsoft.VisualStudio.Component.WebDeploy",
    "Microsoft.VisualStudio.Component.Debugger.JustInTime",
    "Component.Microsoft.VisualStudio.LiveShare",
    "Microsoft.VisualStudio.Component.IntelliCode",
    "Microsoft.Net.Core.Component.SDK.2.1",
    "Microsoft.VisualStudio.Workload.NetWeb",
    "Microsoft.VisualStudio.Component.VC.CoreIde",
    "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
    "Microsoft.VisualStudio.Component.Graphics.Tools",
    "Microsoft.VisualStudio.Component.VC.DiagnosticTools",
    "Microsoft.VisualStudio.Component.Windows10SDK.19041",
    "Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
    "Microsoft.ComponentGroup.Blend",
    "Microsoft.VisualStudio.Component.DotNetModelBuilder",
    "Microsoft.VisualStudio.Workload.ManagedDesktop",
    "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
    "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
    "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake",
    "Microsoft.VisualStudio.Component.VC.CMake.Project",
    "Microsoft.VisualStudio.Component.VC.ATL",
    "Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest",
    "Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest",
    "Microsoft.VisualStudio.Component.VC.ASAN",
    "Microsoft.VisualStudio.Component.Windows10SDK.18362",
    "Microsoft.VisualStudio.Component.Windows10SDK.16299",
    "Microsoft.VisualStudio.Component.VC.v141.x86.x64",
    "Microsoft.Component.VC.Runtime.UCRTSDK",
    "Microsoft.VisualStudio.Workload.NativeDesktop",
    "Microsoft.VisualStudio.Component.Git",
    "Microsoft.VisualStudio.Component.WinXP",
    "Microsoft.VisualStudio.Component.VC.v141.ATL",
    "Microsoft.VisualStudio.Component.VC.v141.CLI.Support",
    "Microsoft.VisualStudio.Component.VC.v141.MFC",
    "Microsoft.VisualStudio.Component.VC.14.20.ATL",
    "Microsoft.VisualStudio.Component.VC.14.20.MFC"
  ]
}
JackBoosY commented 2 years ago

That's werid, protoc shouldn't dependency on the protobuf debug libs. Did you try to install protobuf using your custom triplet? Did you try to modify protobuf's portfile.cmake and make some custom changes?

sebdej commented 2 years ago

Same problem here. Installed a fresh vcpkg environment from Visual Studio 2019's Developer Command Prompt so no custom changes.

vcpkg install grpc fails because it try to use the debug version of grpc_cpp_plugin.exe. The release version of grpc_cpp_plugin.exe is not available in [vcpkg]\buildtrees\grpc\x64-windows-rel.

FAILED: gens/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc gens/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h gens/src/proto/grpc/reflection/v1alpha/reflection_mock.grpc.pb.h gens/src/proto/grpc/reflection/v1alpha/reflection.pb.cc gens/src/proto/grpc/reflection/v1alpha/reflection.pb.h D:/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc D:/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h D:/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/reflection/v1alpha/reflection_mock.grpc.pb.h D:/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/reflection/v1alpha/reflection.pb.cc D:/vcpkg/buildtrees/grpc/x64-windows-dbg/gens/src/proto/grpc/reflection/v1alpha/reflection.pb.h 
cmd.exe /C "cd /D D:\vcpkg\buildtrees\grpc\src\2180080eb4-87c05d756b.clean && D:\vcpkg\installed\x64-windows\tools\protobuf\protoc.exe --grpc_out=generate_mock_code=true:D:/vcpkg/buildtrees/grpc/x64-windows-dbg/gens --cpp_out=D:/vcpkg/buildtrees/grpc/x64-windows-dbg/gens --plugin=protoc-gen-grpc=D:/vcpkg/buildtrees/grpc/x64-windows-dbg/grpc_cpp_plugin.exe -I . -I D:/vcpkg/installed/x64-windows/include src/proto/grpc/reflection/v1alpha/reflection.proto"
--grpc_out: protoc-gen-grpc: Plugin failed with status code 3221225781.
yanrez commented 2 years ago

I am hitting same problem when building on the remote build server which doesn't have debug c runtime. Doesn't repro locally where I have full Visual Studio studio with debug c runtime installed.

cmd.exe /C "cd /D D:\dbs\sh\idsv\1217_172628\cmd\0\temp\buildtrees\grpc\src\2180080eb4-87c05d756b.clean && D:\dbs\sh\idsv\1217_172628\cmd\0\vcpkg_installed\x64-windows\x64-windows\tools\protobuf\protoc.exe --grpc_out=generate_mock_code=true:D:/dbs/sh/idsv/1217_172628/cmd/0/temp/buildtrees/grpc/x64-windows-dbg/gens --cpp_out=D:/dbs/sh/idsv/1217_172628/cmd/0/temp/buildtrees/grpc/x64-windows-dbg/gens --plugin=protoc-gen-grpc=D:/dbs/sh/idsv/1217_172628/cmd/0/temp/buildtrees/grpc/x64-windows-dbg/grpc_cpp_plugin.exe -I . -I D:/dbs/sh/idsv/1217_172628/cmd/0/vcpkg_installed/x64-windows/x64-windows/include src/proto/grpc/reflection/v1alpha/reflection.proto"
--grpc_out: protoc-gen-grpc: Plugin failed with status code 3221225781.
JackBoosY commented 2 years ago

@BillyONeal Can you please take a look at this issue?

Thanks.

BillyONeal commented 2 years ago

I am hitting same problem when building on the remote build server which doesn't have debug c runtime.

vcpkg needs Visual Studio for the compilers which won't create a system in this configuration so I'm not sure how practical supporting something like that is

JackBoosY commented 2 years ago

As the workaround, please copy the following dlls from _VCPKGROOT/installed/x64-windows/debug/lib to _VCPKGROOT/installed/x64-windows/tools/protobuf-c:

  1. libprotocd.dll
  2. libprotobufd.dll
JackBoosY commented 2 years ago

Also can you please provide the following logs since this is a protobuf-c issue: _VCPKGROOT/buildtrees/protobuf-c/stdout-x64-windows.log _VCPKGROOT/buildtrees/protobuf-c/config-x64-windows-rel-out.log _VCPKGROOT/buildtrees/protobuf-c/install-x64-windows-rel-out.log

yanrez commented 2 years ago

I've resolved my issue by adding debug c runtime binaries into PATH in my triplet file

JackBoosY commented 2 years ago

Fine, please reopen this issue if it still bother you.