I'm literally going crazy: I can't build any GRPC project any more and I can't find a solution.
When I run the build command (dotnet build
) I receive the following error:
mr@bogobox GrpcLab % dotnet build
MSBuild version 17.9.8+b34f75857 for .NET
Determining projects to restore...
All projects are up-to-date for restore.
/Users/mr/.nuget/packages/grpc.tools/2.62.0/build/_protobuf/Google.Protobuf.Tools.targets(291,5): error MSB6004: The specified task executable location "/Users/mr/.nuget/packages/grpc.tools/2.62.0/tools/macosx_aarch64/protoc" is invalid. [/Users/mr/temp/dotnetlab/grpclab/GrpcLab/GrpcGreeter/GrpcGreeter.csproj]
Build FAILED.
Analyzing the message I see the reference to the architecture macosx_aarch64
that sounds strange to me.
My laptop is an Apple M1 Pro (arm64
). It seems like Msbuild fails to resolve the proper architecture or something related.
I've tried to reinstall the grpc tools but the error persists.
The above error is generated on a fresh new Grpc service created from dotnet template.
Any idea?
New day, fresh mindset.
I've examined the msbuild
protobuffer target file and found that the path is resolved, after some logic, by concatenating two environment variables PROTOBUF_TOOLS_OS
and PROTOBUF_TOOLS_CPU
that on my system are:
PROTOBUF_TOOLS_CPU=aarch64
PROTOBUF_TOOLS_OS=macosx
Fixing the former to 'x64' will re-establish the expected behaviour.
The last step is to research the root cause of this, possibly, misconfiguration.