grpc: latest nuget 1.21.0 can't build in xamarin.ios

msbuild error log:

"/Users/wellbye/repos/j/mb/mb.iOS/mb.iOS.csproj" (build target) (1) ->
(_CompileToNative target) -> 
  clang : error : linker command failed with exit code 1 (use -v to see invocation) [/Users/wellbye/repos/j/mb/mb.iOS/mb.iOS.csproj]
  MTOUCH : error MT5210: Native linking failed, undefined symbol: operator delete(void*). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. [/Users/wellbye/repos/j/mb/mb.iOS/mb.iOS.csproj]
  MTOUCH : error MT5210: Native linking failed, undefined symbol: operator new(unsigned long). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. [/Users/wellbye/repos/j/mb/mb.iOS/mb.iOS.csproj]
  MTOUCH : error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -L/Users/wellbye/repos/j/mb/packages/Grpc.Core.1.21.0/build/Xamarin.iOS10/../../native/ios/universal -lgrpc_csharp_ext -force_load /Users/wellbye/repos/j/mb/packages/Grpc.Core.1.21.0/build/Xamarin.iOS10/../../native/ios/universal/libgrpc_csharp_ext.a -L/Users/wellbye/repos/j/mb/packages/Grpc.Core.1.21.0/build/Xamarin.iOS10/../../native/ios/universal -lgrpc -force_load /Users/wellbye/repos/j/mb/packages/Grpc.Core.1.21.0/build/Xamarin.iOS10/../../native/ios/universal/libgrpc.a -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/wellbye/repos/j/mb/mb.iOS/obj/iPhoneSimulator/Debug/Entitlements.xcent [/Users/wellbye/repos/j/mb/mb.iOS/mb.iOS.csproj]
  MTOUCH : error MT5202: Native linking failed. Please review the build log. [/Users/wellbye/repos/j/mb/mb.iOS/mb.iOS.csproj]

the xamarin sample in repo is using 1.18.0 which is ok. so there must be something wrong in the new version. please check~

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 23 (4 by maintainers)

Most upvoted comments

I would say this is still relevant, I experience similar errors while trying to run the xamarin demo included.

I’m going to close issue this since we’re not going to pursuit Unity/Xamarin support in Grpc.Core anymore.

  • The Grpc.Core implementation is now in maintenance mode and we’re only going to focus on critical and security fixes.
  • Supporting Unity/Xamarin simply presents too much maintenance overhead and it’s also difficult to test with the test infrastructure available to us
  • The Unity/Xamarin support has always been classified as “experimental”, so discontinuing the support shouldn’t be too surprising.

See the recent update on gRPC C# for more details.

Note that in practice, running Grpc.Core on Unity/Xamarin might still be possible (there is nothing in principle that would prevent it from working), but it will be completely at your own risk and it’s simply not one of the use cases the grpc team will help you with as Grpc.Core on Unity/Xamarin is now considered as “not supported” by us (but you might still be able to get help from the community).

What´s going on here? I can’t use gRPC on Xamarin.iOS ?? I noticed there is a package call gRPC.Core.Xamarin but it doesn’t work correctly yet !!

I got the same problem on macOS 10.15.7 VS 2019 8.8 with NuGet package 2.33.1 (why does the NuGet package start with 2?)

I get 103 linker errors:

/Users/user/Documents_local/Projects/dfsdf.iOS/MTOUCH: Error MT5210: Native linking failed, undefined symbol: std::exception::~exception(). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. (MT5210) (sdf.iOS)


/Users/user/Documents_local/Projects/sfsdf.iOS/MTOUCH: Error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -L/Users/user/.nuget/packages/grpc.core/2.33.1/build/Xamarin.iOS10/../../native/ios/universal -lgrpc_csharp_ext -force_load /Users/user/.nuget/packages/grpc.core/2.33.1/build/Xamarin.iOS10/../../native/ios/universal/libgrpc_csharp_ext.a -L/Users/user/.nuget/packages/grpc.core/2.33.1/build/Xamarin.iOS10/../../native/ios/universal -lgrpc -force_load /Users/user/.nuget/packages/grpc.core/2.33.1/build/Xamarin.iOS10/../../native/ios/universal/libgrpc.a (MT5201) (sdf.iOS)

I tried:

<IsCxx>True</IsCxx>

and

    <PropertyGroup>
        <RuntimeIdentifiers>mac;mac-x86;mac-x64</RuntimeIdentifiers>
        <NuGetRuntimeIdentifier>mac</NuGetRuntimeIdentifier>
    </PropertyGroup>

which did not really help. Although latter eliminated the error loading the win library.

On Android I get System.DllNotFoundException: grpc_csharp_ext assembly:<unknown assembly> type:<unknown type> member:(null) on calling a function.

FWIW, I’ve been playing with these recently with a Xamarin.Forms app. Grpc.Core 1.22.1 works OK but the latest 2.29.0 fails with lots of linker errors to do with std::basic_string etc (basically the C++ runtime). Editing ~/.nuget/packages/grpc.core/2.29.0/build/Xamarin.iOS10/Grpc.Core.Targets and adding

<IsCxx>True</IsCxx>

For both libraries makes it build and run for me (with just linker warnings). So with this I can use 2.29.0 for both iOS and Android Xamarin.Forms targets.