2

Background - i am writing a project managing sort of an enclosed area dispatching automated vehicle using .NET 6 and raspberry pi, the Pi received instructions using Wi-Fi, manages the motion system using a PLC (Programmable Logic Controller), basically, works fine. I am using 32Bit Raspebian (updated) I wanted to implement a "technician's UI" using GRPC, something i have done several times on window machines, i use the "gRpc.Core" nugget (+ dependencies..), create a server:

grpcServer = new Server {
    Services = { ACTechService.BindService(grpcHandler) },
    Ports = { new ServerPort("192.168...", 50051, ServerCredentials.Insecure) }
}

works find on windows (using a test client i wrote) When i move the code (that otherwise works!) to the RPi and run it i get:

GRPC server start failed, exception:: System.InvalidOperationException: Unsupported architecture "Unknown".
    at Grpc.Core.Internal.NativeExtension.GetArchitectureString()
    at Grpc.Core.Internal.NativeExtension.GetNativeLibraryFilename()
    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.Server..ctor(IEnumerable`1 options)
    at Grpc.Core.Server..ctor()
    at Program.<Main>$(String[] args) in C:\Projects\AirTouch\CarMk2.5\Tries\GRPCMyServer\Program.cs:line 10

I google and understood the problem is that the gRPC is not pure .NET, there is an underlying native library that is not implemented on the Raspberry Pi

Microsoft has a pure NET library called "Grpc.AspNetCore" i couldn't figure out how to use it in a console application :-(

And the question: bottom line, looking for a grpc server package that will work on Arm32 architecture, namely the RPi, either using the microsoft version (if its good) or any other alternative thanks

doronweiss
  • 69
  • 2
  • 2
    grpc.AspNetCore is intended to be used from .net core application which hosts a server or starts a client and talks to the server. gRPC is all about report procedure calls. You can start a console application which acts as self host or use .net core supplied web server such as Kestrel. Here is an example - https://learn.microsoft.com/en-us/aspnet/core/tutorials/grpc/grpc-start?view=aspnetcore-6.0&tabs=visual-studio – Amogh Sarpotdar Jul 16 '22 at 13:08
  • Maybe this github repo helps: [C# GRPC for Arm (x32 / x64)](https://github.com/xevilmaxx/grpc_arm_csharp) – dan-kli Jul 18 '22 at 20:49
  • 1
    ARM32 is not supported by Grpc.Core by default. You'd need to bring in a custom-build version of the grpc_csharp_ext native component in order to make things work on 32-bit Raspberry pi (and of course it would be officially unsupported). You should be able the run a grpc-dotnet server (ASP.NET Core based) on raspberry pi, there should be plenty of examples out there on how to run a console app with grpc-dotnet server in it (even the Greeter server in the grpc/grpc-dotnet repository is actually a console app). – Jan Tattermusch Aug 16 '22 at 13:10

0 Answers0