Core: Problem install .Net Core on Raspberry Pi Model B

Created on 24 Jun 2016  路  14Comments  路  Source: dotnet/core

I tried to install .Net Core on my Raspberry Pi Model B device with OS "Raspbian Jessie Lite".
I used the installation instructions here: https://www.microsoft.com/net/core#debian
I had a problem with a missing library libunwind:

pi@raspberrypi:~ $ sudo curl -sSL https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview1/scripts/obtain/dotnet-install.sh | bash /dev/stdin --version 1.0.0-preview1-002702 --install-dir ~/dotnet
dotnet_install: Error: Unable to locate libunwind. Install libunwind to continue

I tried to find it alone, but I could not.

pi@raspberrypi:~ $ sudo apt-get install libunwind
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libunwind

This device model (Raspberry Pi Model B) is not supported?

Most helpful comment

Correct. .NET Core 1.0 doesn't have ARM support. It is in the roadmap and we have many community members working with us on adding ARM support so I hope we'll have something soon.

All 14 comments

I believe the package name for libunwind is libunwind8.

@svick Thank you!

But I have another problem:

pi@raspberrypi:~ $ sudo curl -sSL https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview1/scripts/obtain/dotnet-install.sh | bash /dev/stdin --version 1.0.0-preview1-002702 --install-dir ~/dotnet
dotnet-install: Downloading https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/1.0.0-preview1-002702/dotnet-dev-debian-x64.1.0.0-preview1-002702.tar.gz
dotnet-install: Extracting zip
dotnet-install: Adding to current process PATH: /home/pi/dotnet. Note: This change will be visible only when sourcing script.
dotnet-install: Installation finished successfuly.
pi@raspberrypi:~ $ sudo ln -s ~/dotnet/dotnet /usr/local/bin
pi@raspberrypi:~ $ dotnet
-bash: /usr/local/bin/dotnet: cannot execute binary file: Exec format error
pi@raspberrypi:~ $ sudo dotnet
/usr/local/bin/dotnet: 1: /usr/local/bin/dotnet: Syntax error: redirection unexpected

What is the problem ?

That's the same error as https://github.com/dotnet/cli/issues/3197: it fails, because there are no binaries for ARM.

I think if you want to use .Net Core on that machine, you will need to build and publish your code on another machine and then copy it to the Pi.

Correct. .NET Core 1.0 doesn't have ARM support. It is in the roadmap and we have many community members working with us on adding ARM support so I hope we'll have something soon.

I think if you want to use .Net Core on that machine, you will need to build and publish your code on another machine and then copy it to the Pi.

So it works to run an ASP.NET Core app on Raspberry Pi but not building the source code?

@OskarKlintrot, I'm not imagine how to do it.
For example, on another computer I'm doing:

mkdir app
cd app
dotnet new
dotnet restore
dotnet build

As a result, I get app.dll file.
How to run it on Raspberry, if dotnet does not work?

dotnet run app.dll?

pi@raspberrypi:~/test $ dotnet run app.dll
-bash: /usr/local/bin/dotnet: cannot execute binary file: Exec format error

Note: On raspbery not installed mono. I want to run the .net core programs without mono.

@neyromant: Neither do I. I really hoped ASP.NET Core would work without Mono on RPi.

@neyromant I haven't tried but I think you didn't read the previous comments carefully

you will need to build and publish your code on another machine and then copy it to the Pi

In your code sample, you just forgot the most important part: publishing

@OskarKlintrot, I think, what you need is a ASP.Net Core Standalone Application.

When you remove "type": "platform" from your Microsoft.NETCore.App dependency, and add a runtimes section at the root level of your project.json, you can call dotnet publish -c Release -r {yourRuntime}.
After that you get an export, which run on the platform you specified without installing dotnet cli. There should be a binary with the name of your project you can call to start your app, but I never tried it on a Raspberry Pi.
Dont forget, you still need the right glibc, libunwind, and libicu.

Example for the runtimes section:

{
  "runtimes": {
    "win7-x64": {},
    "centos.7-x64": {},
    "ubuntu.14.04-x64": {},
    "osx.10.11-x64": {}
  }
}

A list of current valid rid's, which can be used in the runtimes section can be found here.

Hope that helps.

Thanks for answers.
But, apparently, has no runtime for linux arm: https://github.com/dotnet/corefx/blob/master/pkg/Microsoft.NETCore.Platforms/runtime.json
I saw only arm runtimes for windows (ex. "win8-arm"), but for linux only x64.

@neyromant check it once again, recent commit added linux arm runtimes

@neyromant did you manage to run the dotnet core app on raspberry pi ?

@arkadiuszwojcik , @ahmed-sherien No. I created a simple project:

Program.cs:

```C#
using System;
namespace TestConsole
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello, world!");
Console.WriteLine("This is a .net core app!");
}
}
}

project.json:

```json
{
  "version": "1.0.0-*",
  "buildOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    //"Microsoft.NETCore.Runtime.CoreCLR-arm": "1.0.1-beta-23225",
    "Microsoft.NETCore.Runtime.CoreCLR": "1.1.0",
    "Microsoft.NETCore.DotNetHostPolicy": "1.2.0-beta-001299-00",
    //"System.Console": "4.3.0"
    "system.console": {
      "version": "4.4.0-beta-24911-08"
    }
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": "dnxcore50"
    }
  },

  "runtimes": {
    "win10-x64": {},
    "linux-arm": {}
  }
}
dotnet build

Project TestConsole (.NETCoreApp,Version=v1.0) will be compiled because inputs were modified
Compiling TestConsole for .NETCoreApp,Version=v1.0

Compilation succeeded.
    0 Warning(s)
    0 Error(s)

Time elapsed 00:00:00.9394322

When compiling for ARM linux i get an error:

dotnet build -r linux-arm

Project TestConsole (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
Compiling TestConsole for .NETCoreApp,Version=v1.0

Compilation succeeded.
    0 Warning(s)
    0 Error(s)

Time elapsed 00:00:00.9334337

Failed to make the following project runnable: TestConsole (.NETCoreApp,Version=v1.0) reason: Expected coreclr library not found in package graph. Please try running dotnet restore again.

@neyromant
Doing dotnet restore with linux-arm shows:

System.Diagnostics.Process 4.1.0 provides a compile-time reference assembly for System.Diagnostics.Process on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with linux-arm.
System.Globalization.Extensions 4.0.1 provides a compile-time reference assembly for System.Globalization.Extensions on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with linux-arm.
System.IO.FileSystem.Watcher 4.0.0 provides a compile-time reference assembly for System.IO.FileSystem.Watcher on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with linux-arm.
System.IO.MemoryMappedFiles 4.0.0 provides a compile-time reference assembly for System.IO.MemoryMappedFiles on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with linux-arm.
System.Net.NameResolution 4.0.0 provides a compile-time reference assembly for System.Net.NameResolution on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with linux-arm.
...

Suggest that those dependencies has no build yet

Was this page helpful?
0 / 5 - 0 ratings