Run .NET 5.0 application on ARM64 CPU

Issue

I’m moving one console app from my PC to RPI4. I’ve installed Ubuntu 21.04 OS there.
The app written in .NET 5.0 architecture. I’ve published it using following configurationenter profile settings

Note: I’ve also tried Self-contained mode but it yielded same error.

First problem I encountered was fact I needed to install runtimes and SDK for .NET5 and so I did. Here’s what I have installed:dotnet info
and here’s ENV:env info

Then I realised VS only offers arm32 runtime. I found this quide on internet: https://forum.armbian.com/topic/4764-running-32-bit-applications-on-aarch64/

Now I’m stuck with following error.

Unhandled exception. System.Net.Http.HttpRequestException: Error while
copying content to a stream. —>
System.IO.Compression.ZLibException: The underlying compression
routine could not be loaded correctly. —>
System.DllNotFoundException: Unable to load shared library
‘libSystem.IO.Compression.Native’ or one of its dependencies. In order
to help diagnose loading problems, consider setting the LD_DEBUG
environment variable: liblibSystem.IO.Compression.Native: cannot open
shared object file: No such file or directory at
Interop.zlib.InflateInit2_(ZStream& stream, Int32 windowBits) at
System.IO.Compression.ZLibNative.ZLibStreamHandle.InflateInit2_(Int32
windowBits) at System.IO.Compression.Inflater.InflateInit(Int32
windowBits)

It seems like it has something to do with fact that it’s deployed for arm32 while rpi4 has arm64 CPU but I couldn’t find any workaround.

Solution

In case someone would find this question, it turned out that VS can’t deploy apps on 64bit ARM linux. You need to install 32bit version of linux on RPI to make it work. Not best solution, but works well.

Answered By – David Mikula

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published