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

Error loading libgrpc on osx_arm64 with dotnet 6 when building firestore client #7560

Closed
palexcast opened this issue Nov 22, 2021 · 4 comments
Assignees
Labels
type: question Request for information or clarification. Not an issue.

Comments

@palexcast
Copy link

.NET 6 will include new runtime id -- osx-arm64 -- for targeting this hardware. It refers to the macOS operating system running on Apple Silicon devices.
-- dotnet/runtime#43313

Environment details

  • OS: macOS Big Sur Version 11.4 (Apple M1)
  • .NET version: 6.0.100
  • Package name and version: Google.Cloud.Firestore 2.4.0

Steps to reproduce

  1. Install Google.Cloud.Firestore package
  2. Attempt to call FirestoreDb.Create("projectId")
  3. Exception thrown

Stacktrace:

Error loading native library. Not found in any of the possible locations: **/API/bin/Debug/net6.0/libgrpc_csharp_ext.arm64.dylib,/**/API/bin/Debug/net6.0/runtimes/osx-arm64/native/libgrpc_csharp_ext.arm64.dylib,**/API/bin/Debug/net6.0/../../runtimes/osx-arm64/native/libgrpc_csharp_ext.arm64.dylib
 at Grpc.Core.Internal.UnmanagedLibrary.FirstValidLibraryPath(String[] libraryPathAlternatives)
 at Grpc.Core.Internal.UnmanagedLibrary..ctor(String[] libraryPathAlternatives)
 at Grpc.Core.Internal.NativeExtension.LoadNativeMethodsUsingExplicitLoad()
 at Grpc.Core.Internal.NativeExtension.LoadNativeMethods()
 at Grpc.Core.Internal.NativeExtension..ctor()
 at Grpc.Core.Internal.NativeExtension.Get()
 at Grpc.Core.Internal.NativeMethods.Get()
 at Grpc.Core.GrpcEnvironment.GrpcNativeInit()
 at Grpc.Core.GrpcEnvironment..ctor()
 at Grpc.Core.GrpcEnvironment.AddRef()
 at Grpc.Core.Channel..ctor(String target, ChannelCredentials credentials, IEnumerable`1 options)
 at Google.Api.Gax.Grpc.GrpcCore.GrpcCoreAdapter.CreateChannelImpl(String endpoint, ChannelCredentials credentials, GrpcChannelOptions options)
 at Google.Api.Gax.Grpc.GrpcAdapter.CreateChannel(String endpoint, ChannelCredentials credentials, GrpcChannelOptions options)
 at Google.Api.Gax.Grpc.ChannelPool.GetChannel(GrpcAdapter grpcAdapter, String endpoint, GrpcChannelOptions channelOptions, ChannelCredentials credentials)
 at Google.Api.Gax.Grpc.ChannelPool.GetChannel(GrpcAdapter grpcAdapter, String endpoint, GrpcChannelOptions channelOptions)
 at Google.Api.Gax.Grpc.ClientBuilderBase`1.CreateCallInvoker()
 at Google.Cloud.Firestore.V1.FirestoreClientBuilder.BuildImpl()
 at Google.Cloud.Firestore.V1.FirestoreClientBuilder.Build()
 at Google.Cloud.Firestore.FirestoreDbBuilder.Build()
 at Google.Cloud.Firestore.FirestoreDb.Create(String projectId, FirestoreClient client)
@jskeet
Copy link
Collaborator

jskeet commented Nov 22, 2021

This isn't really the Firestore library, but Grpc.Core not supporting that platform.

You could request support on the grpc/grpc repo but Grpc.Core is now in maintenance mode.

In the next major version of all our libraries (expected 2022H1) we will be migrating to Grpc.Net.Client. You can manually use the Grpc.Net.Client adapter before then, however:

var db = new FirestoreDbBuilder
{
    ProjectId = "project-id",
    GrpcAdapter = GrpcNetClientAdapter.Default
}.Build();

Note that this is an untested scenario - we don't perform any OSX testing - but I'd expect it to just work out of the box.

@jskeet jskeet self-assigned this Nov 22, 2021
@jskeet jskeet added the type: question Request for information or clarification. Not an issue. label Nov 22, 2021
@palexcast
Copy link
Author

@jskeet Thank you for taking your time to reply with a possible solution anyway.

I can confirm that the proposed solution works, thank you!

@carlpatchett
Copy link

@jskeet

In the next major version of all our libraries (expected 2022H1) we will be migrating to Grpc.Net.Client.

Any updates on this? We are using the API's extensively throughout our tooling, and this is a problem among our M1 users. Ideally didn't want to go refactoring workaround in many places if the change is upcoming anytime soon

@jskeet
Copy link
Collaborator

jskeet commented Jan 12, 2023

@carlpatchett: Yes, we shipped in June 2022. So if you use Google.Cloud.Firestore version 3.0.0 for example, from .NET 6 or .NET Core 3.1, it'll use Grpc.Net.Client and should work in M1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

3 participants