Skip to content
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

Grpc.Tools nuget package breaks builds on Windows_arm64 (see bottom for workaround) #31975

Closed
ScottSedgwick opened this issue Dec 23, 2022 · 4 comments

Comments

@ScottSedgwick
Copy link

What version of gRPC and what language are you using?

Grpc.Tools Nuget Package version 2.5.0

What operating system (Linux, Windows,...) and version?

Windows ARM64 (in a VM on Apple M1)

What runtime / compiler are you using (e.g. python version or version of gcc)

dotnet 7.0.100

What did you do?

Please provide either 1) A unit test for reproducing the bug or 2) Specific steps for us to follow to reproduce the bug. If there’s not enough information to debug the problem, gRPC team may close the issue at their discretion. You’re welcome to re-open the issue once you have a reproduction.

We have a C# project with developers using Windows x64, and Windows ARM64 (because they have Mac M1s).
Any project that includes the Grpc.Tools nuget package compiles correctly on Win64, but fails on ARM64.

What did you expect to see?

Compilation completes correctly.

What did you see instead?

Compilation fails with this message:

C:\Users\scott\.nuget\packages\grpc.tools\2.50.0\build\_protobuf\Google.Protobuf.Tools.targets(280,5): error MSB6004: The specified task executable location "C:\Users\scott\.nuget\packages\grpc.tools\2.50.0\tools\windows_arm64\protoc.exe" is invalid. [C:\dev\ngf\src\Servers\Device\Protos\Cochlear.Ngf.Servers.Device.Protos.csproj]

Anything else we should know about your project / environment?

Making a copy of the C:\Users\scott\.nuget\packages\grpc.tools\2.50.0\tools\windows_x86 folder and renaming it to C:\Users\scott\.nuget\packages\grpc.tools\2.50.0\tools\windows_arm86 fixes this problem. Windows ARM seems to be capable of running the x86 tools in compatibility mode.

@tonydnewell
Copy link
Contributor

tonydnewell commented Jan 3, 2023

@ScottSedgwick as you have observed we do not support Windows ARM64 in Grpc.Tools.

A couple of other workarounds:

Set the environment variables PROTOBUF_TOOLS_CPU to x86 executables before running the build

or

set the environment variables PROTOBUF_PROTOC and GRPC_PROTOC_PLUGIN to point to the x86 executables before running the build (see here)

e.g.

set PROTOBUF_PROTOC=%systemdrive%%homepath%\.nuget\packages\grpc.tools\2.50.0\tools\windows_x86\protoc.exe
set GRPC_PROTOC_PLUGIN=%systemdrive%%homepath%\.nuget\packages\grpc.tools\2.50.0\tools\windows_x86\grpc_csharp_plugin.exe

@jtattermusch It should be relatively easy to support Windows ARM64 in Grpc.Tools by using the Windows x86 binaries - either including them in the package in a different path or by adding some logic to the MSBuild files. However I do not have access to a Windows ARM64 instance for testing.

@jtattermusch jtattermusch changed the title Nuget package breaks builds on Windows_arm64 (see bottom for workaround) Grpc.Tools Nuget package breaks builds on Windows_arm64 (see bottom for workaround) Jan 3, 2023
@jtattermusch jtattermusch changed the title Grpc.Tools Nuget package breaks builds on Windows_arm64 (see bottom for workaround) Grpc.Tools nuget package breaks builds on Windows_arm64 (see bottom for workaround) Jan 3, 2023
@jtattermusch
Copy link
Contributor

FTR, on mac we changed the logic to use x64 binary when mac arm64 is detected (see #26080)
A similar trick could work for windows.

@tonydnewell
Copy link
Contributor

Created PR #32017 to do trick suggested in #31975 (comment)

@jtattermusch

@jtattermusch
Copy link
Contributor

Should be fixed by #32017.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants