durabletask-dotnet: Workaround for "Error loading native library" error on Mac M1/Mac M2
When trying out the Durable Functions SDK for .NET isolated, Mac M1 / M2 users may encounter the following error:
A host error has occurred during startup operation 'xxx-xxxx-xxxx-xxxx'.
[2023-02-17T16:33:49.933Z] Grpc.Core: Error loading native library.
Not found in any of the possible locations: [...]/bin/output/.azurefunctions/libgrpc_csharp_ext.arm64.dylib,[...]/bin/output/.azurefunctions/runtimes/osx-arm64/native/libgrpc_csharp_ext.arm64.dylib,[...]/bin/output/.azurefunctions/../../runtimes/osx-arm64/native/libgrpc_csharp_ext.arm64.dylib.
Value cannot be null. (Parameter 'provider')
This is a temporary limitation and has a known workaround. Please see the instructions below, which were originally contributed by @vdboots and @apavate here.
- Add the Nuget package Contrib.Grpc.Core.M1 to the Azure Function Project by either using the Nuget Package Manager or by just adding the following line to the .csproj file.
<PackageReference Include="Contrib.Grpc.Core.M1" Version="2.41.0" />
- Add the following line to the .csproj file right before the last </Project> tag.
<Target Name="CopyGrpcNativeAssetsToOutDir" AfterTargets="Build"> <ItemGroup> <NativeAssetToCopy Condition="$([MSBuild]::IsOSPlatform('OSX'))" Include="$(OutDir)runtimes/osx-arm64/native/*" /> </ItemGroup> <Copy SourceFiles="@(NativeAssetToCopy)" DestinationFolder="$(OutDir).azurefunctions/runtimes/osx-arm64/native" /> </Target>
- Run the project and it should work!
This exception is currently being worked on and we will update this post once resolved.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 13
- Comments: 48 (10 by maintainers)
Commits related to this issue
- Add workaround to fix Jobs on Mac OS X for Arm64. See https://github.com/microsoft/durabletask-dotnet/issues/148. — committed to eten-tech/aquifer-server by NateMerritt 2 years ago
- Add workaround to fix Jobs on Mac OS X for Arm64. (#619) See https://github.com/microsoft/durabletask-dotnet/issues/148. — committed to eten-tech/aquifer-server by NateMerritt 2 years ago
I created an issue about this 2 years ago and we’re still chatting about it. Is there any timeline on a more concrete fix than copying a lib from a third party?
It is unbelievable that this is still an issue. I fully understand @srs-adamr’s decision on returning the Mac. I agree that it is not Apple’s fault, but at the end of the day, if you can’t get your job done, you are left with few options.
Relying on a third-party workaround that may or may not work, depending on different versions etc. is not a viable solution after almost 2 years.
This bug has stopped me from choosing Durable Functions several times and instead implement my own orchestrations using regular Azure Functions. It is not what I want, but I have wasted so many hours on this issue.
Please give us some updates and a timeline for when we can expect this issue to be resolved.
This is my setup, and it works on my laptop:
So in the .csproj file I have something like the following:
And I run
dotnet-isolatedfunctions only, I thought the other type is not supported (or will not be in the future). And I have installed azurite via NPM which I run with the commandazurite --silent --debug c:\azurite\debug.log --inMemoryPersistence falseBEFORE I start the project.Hope this helps!
thanks everyone for the feedback! This item defintely hasn’t fallen off our radar. Apologies for haven’t been able to prioritize it sooner, but we’re picking it up now! Will share progress here.
Occurs for .NET 8 as well
@LloydNicholson I got the same error with 2.46.6. 2.41.0 still works.
Newest version 2.46.6 doesn’t work with workaround anymore for my project.
This is our current Functions.csproj file
This currently breaks with version 2.46.6 with error
but 2.41.0 still works.
@vdboots do you have the exact implementation? I am curious how yours works and mine isn’t working.
@KulikovEkb We already have fix for this and will be included in our next release. I will update this thread once it’s out.
Part of our plan is to migrate out of the current GRPC provider we’re using, into the one provided by AspNetCore, which we understand works more reliably and is the same as what the Azure Functions Host/runtime uses. This is currently gated behind the release of Durable Functions WebJobs extension v3 (which will include the new AspNetCore GRPC dependency, as well as updating other transitive dependencies), and after that we’ll need to make a release where we swap our GRPC provider (DF v3’s first release will only include the new dependency, then we’ll need to actually invoke it over the current GRPC implementation)
Hi all, thank you so much for your patience! In case you’re not aware yet, the change @nytian mentioned was released in Microsoft.Azure.Functions.Worker.Extensions.DurableTask v1.5.0 last week! You shouldn’t have to use the workaround anymore when using that version of the package.
I returned my new M4 because of it.
You guys from microsoft are just some not funny joke
Potentially valid, however, I am a .NET developer by trade, if there’s something my new device cannot do, it’s not for me, regardless whoms fault it is. 🤷 (Plus I hate macOS in general, and it has horrible multi-monitor support, so it was more the final nail in the coffin for me)
Ah my mistake. Fixed my problems with the explanation given by @LloydNicholson, see https://github.com/microsoft/durabletask-dotnet/issues/148#issuecomment-1729006827
My system: Chip: Apple M3 Pro 18GB OS version: Sonoma 14.2.1
I am having the
Grpc.Core: Error loading native libraryerror for any version now on a Mac M3 Pro. Additionally, I tried to copy the dylib to the correct folder myself after build, but then I receive the following error:Grpc.Core: Error loading native library "/Users/olofmorra/RiderProjects/OneBoard/Infrastructure/bin/output/.azurefunctions/libgrpc_csharp_ext.arm64.dylib". .Do we have any update on this issue? Because of this reason I cannot run Durable Functions locally with .NET 8…