GoogleCloudPlatform / google-cloud-dotnet-powerpack

Small NuGet packages for Google Cloud Platform users.
Apache License 2.0
19 stars 11 forks source link

Unable to load shared library 'libdl.so' or one of its dependencies (dotnet 5.0 support) #22

Open mrfelton opened 3 years ago

mrfelton commented 3 years ago

Getting the following error when running in a docker images that uses mcr.microsoft.com/dotnet/sdk:5.0.

I think the grpc dependency needs updating.

See https://github.com/grpc/grpc/pull/24485

Application startup exception: System.DllNotFoundException: Unable to load shared library 'libdl.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl.so: cannot open shared object file: No such file or directory at Grpc.Core.Internal.UnmanagedLibrary.Linux.dlopen(String filename, Int32 flags) at Grpc.Core.Internal.UnmanagedLibrary.LoadLibraryPosix(Func3 dlopenFunc, Func1 dlerrorFunc, String libraryPath, String& errorMsg) at Grpc.Core.Internal.UnmanagedLibrary.PlatformSpecificLoadLibrary(String libraryPath, String& errorMsg) at Grpc.Core.Internal.UnmanagedLibrary..ctor(String[] libraryPathAlternatives) at Grpc.Core.Internal.NativeExtension.LoadUnmanagedLibrary() 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, IEnumerable1 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.ClientBuilderBase1.CreateChannel(String endpoint, ChannelCredentials credentials) at Google.Api.Gax.Grpc.ClientBuilderBase`1.CreateCallInvoker() at Google.Cloud.Kms.V1.KeyManagementServiceClientBuilder.BuildImpl() at Google.Cloud.Kms.V1.KeyManagementServiceClientBuilder.Build() at Microsoft.AspNetCore.DataProtection.GoogleCloudDataProtectionBuilderExtensions.<>c__DisplayClass3_0.b__0(IServiceProvider services)

jskeet commented 3 years ago

Grpc.Core hasn't been released since that PR was merged, as far as I can tell - so I don't think there's anything we can do at the moment. (Once it has been released, you don't need to wait for an update to this library - you can just add an explicit dependency on the latest version of Grpc.Core in your project.)

Newp commented 3 years ago
<PackageReference Include="Grpc.Core" Version="2.33.1" />

@jskeet you say mean like this?

jskeet commented 3 years ago

@Newp: Exactly, but I didn't think it was fixed in 2.33.1...

draganjovanovic1 commented 3 years ago

I can confirm that it isn't. @jskeet any estimate when the fix will be released? Thanks

jskeet commented 3 years ago

No, I don't work on gRPC. I suggest you ask on the linked issue.

gitfool commented 3 years ago

Meanwhile, you can work around the issue by installing libc-dev:

sudo apt update && sudo apt install -y libc-dev
Gladskih commented 3 years ago

And for CentOS: yum -y install glibc-devel

sergiutugulschi commented 3 years ago

I'm using Google.Cloud.Diagnostics.AspNetCore and I'm also getting the same mentioned exception on top when calling services.AddGoogleExceptionLogging after I switched to dotnet 5.0.

As a fix also mentioned here I have installed separately Grpc.Core package of version 2.35.0 and now I'm getting this exception

---> System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)

at Google.Api.Gax.GkePlatformDetails.TryLoad(String metadataJson, KubernetesData kubernetesData) at Google.Api.Gax.Platform.LoadInstanceAsync() at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result() at Google.Api.Gax.Platform.Instance() at Google.Api.Gax.Grpc.MonitoredResourceBuilder.FromPlatform() at Google.Cloud.Diagnostics.Common.EventTarget.ForLogging(LogTarget logTarget, String logName, LoggingServiceV2Client loggingClient, MonitoredResource monitoredResource) at Google.Cloud.Diagnostics.Common.EventTarget.ForLogging(String projectId, String logName, LoggingServiceV2Client loggingClient, MonitoredResource monitoredResource) at Google.Cloud.Diagnostics.Common.ErrorReportingOptions.Create(String projectId, BufferOptions bufferOptions, RetryOptions retryOptions) at Google.Cloud.Diagnostics.Common.ErrorReportingContextExceptionLogger.Create(String projectId, String serviceName, String version, ErrorReportingOptions options) at Google.Cloud.Diagnostics.Common.ContextExceptionLogger.Create(String projectId, String serviceName, String version, ErrorReportingOptions options) at Google.Cloud.Diagnostics.AspNetCore.ErrorReportingExceptionLoggerExtension.AddGoogleExceptionLogging(IServiceCollection services, Action`1 setupAction) ...

jskeet commented 3 years ago

@sergiutugulschi: Please file a new issue with more details, given that the expected workaround isn't working for you. Additionally, unless you're actually using one of the packages in this repo, please file the issue in https://github.com/googleapis/google-cloud-dotnet rather than here.

mustafa-korkmaz commented 3 years ago

Got the same error. These two below worked for me. <PackageReference Include="Google.Cloud.Diagnostics.AspNetCore3" Version="4.2.0" /> <PackageReference Include="Grpc.Core" Version="2.36.4" />

kesslern commented 3 years ago

In my case this error was caused by a reference to an older version of Google.Cloud.SecretManager.V1. Upgrading from 1.0.0 to 1.4.0 fixed the problem.