Where to get libgrpc_csharp_ext.arm64.dylib?
When I try to run app with Google.Ads.GoogleAds nuget package on MacOS with M1 silicon I get the following error :
Unhandled exception. System.IO.FileNotFoundException: Error loading native library. Not found in any of the possible locations: .../libgrpc_csharp_ext.arm64.dylib
Cannot really find where to obtain libgrpc_csharp_ext.arm64.dylib
or where can I find source for it and how to compile.
You can try to use prebuilt version of the native .dylib for Apple M1 CPUs:
https://github.com/einari/Grpc.Core.M1
https://www.nuget.org/packages/Contrib.Grpc.Core.M1/
I just spent 2-3 hours trying to fix this problem. This solves it. Thank you. (I know typing meaningless comments is frowned upon, but, omg, awesome. I even tried using ChatGPT before this ,but that didnt help :P )
Can you please supply the detailed steps of adding the lib file to a project? I'm trying to build Azure Durable Functions and can't seem to get it to work.
There is a well detailed description here github.com/einari/Grpc.Core.M1
Interestingly enough installing the x64 version and not the Arm64 version solves this as well. No need for other packages.
@ChristopherPenkin can you explain how to do that?
You might have arrived here because you accidentally imported Grpc.Core instead of Grpc.Core.Api. If you are using grpc-dotnet (the now recommended package for grpc in dotnet applications), your code will compile when referencing the Grpc.Core package, but will fail trying to find libgrpc_csharp_ext.arm64.dylib. Switching from Grpc.Core to Grpc.Core.Api worked for me.
Grpc.Core.Api is implicit referenced by Microsoft.Azure.Functions.Worker, no explicit reference to gRpc. Fails on Mac.
Not sure what was causing this, but now, referencing Google.Ads.GoogleAds 15.0.0 in project that uses .net 7 (I did update to latest runtime and sdk), no longer causes this issue. Previously, as a hot fix, I was running same code on linux VM instead.