Sdk: How to use dotnet cli in debian linux on arm.

Created on 23 May 2016  路  9Comments  路  Source: dotnet/sdk

Steps to reproduce

sudo apt-get install curl
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
sudo ln -s ~/dotnet/dotnet /usr/local/bin

dotnet restore

Expected behavior

run dotnet restore command properly.

Actual behavior

dotnet restore
-bash: /usr/local/bin/dotnet: cannot execute binary file: Exec format error

Description

On RC1, I could install dnvm with below script and run properly with dnx451 option.

curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
apt-get install libunwind8 gettext libssl-dev libcurl4-openssl-dev zlib1g libicu-dev uuid-dev

On RC2, official script(https://www.microsoft.com/net/core#debian) tried to install binary for x64 not arm, so doesn't work. I just want to run with net451 option on mono. Is there any method to run rc2 project with mono. I used raspberry pi and banana pi debian linux.

question

Most helpful comment

Then, how can I run asp.net core rc2 project which only use net451(mono) in arm linux machine, such as raspberry pi? It was working properly on RC1.

All 9 comments

There are no builds of the SDK for ARM currently (and I'm pretty sure that .NET Core is also not being built for that arch; @brthor am I right?) so this is by design. The script is trying to download the only SDK for Debian it can.

Then, how can I run asp.net core rc2 project which only use net451(mono) in arm linux machine, such as raspberry pi? It was working properly on RC1.

Indeed with the new CLI we cannot use .NET on Arm hosts. What should we expect regarding an ARM build?

I found the workaround for running Asp.net core RC2 on arm debian linux, such as raspberry pi.

1. add the code in startup.cs like below.

services.AddMvc().AddRazorOptions(options =>
            {
                if (Type.GetType("Mono.Runtime") != null)
                {
                    var myAssemblyPaths = new[] {
                 "/usr/lib/mono/4.5/mscorlib.dll",
                 "/usr/lib/mono/4.5/System.Core.dll",
                 "/usr/lib/mono/4.5/Microsoft.CSharp.dll"
                 };
                    var previous = options.CompilationCallback;
                    options.CompilationCallback = (context) =>
                    {
                        if (previous != null)
                        {
                            previous(context);
                        }

                        var references = myAssemblyPaths.Select(p => MetadataReference.CreateFromFile(p)).ToArray();
                        context.Compilation = context.Compilation.AddReferences(references);
                    };
                }
            });

2. build on windows machine

3. copy all the web project to linux target including output files.

4. run the app using mono.
"/root/AspNetCoreMonoTest" folder should have project.json
cd /root/AspNetCoreMonoTest && mono bin/Debug/net451/win7-x64/AspNetCoreMonoTest.exe

I used mono version 4.4.0. and refered to https://github.com/aspnet/Mvc/issues/4818#issuecomment-224775503

+1 for running on ARM devices

Looking at the roadmap over at https://blogs.msdn.microsoft.com/dotnet/2016/07/15/net-core-roadmap/ this is supposed be in the Q4'16 oder Q1'17 release

i download dotnet-linux-arm.latest.tar.gz on 12/10 and im getting a
robot@ev3dev:~/dotnetlinux$ ./dotnet
-bash: ./dotnet: No such file or directory

i installed it in a local directory as well as
robot@ev3dev:~$ /usr/bin/dotnet/dotnet
-bash: /usr/bin/dotnet/dotnet: No such file or directory

is there some preinstallation i need to install?
i did a sudo apt-get upgrade before trying.

here are some diagnostics from my linux system
cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=ev3dev
ID_LIKE=debian
HOME_URL="http://www.ev3dev.org/"
SUPPORT_URL="http://www.ev3dev.org/support"
BUG_REPORT_URL="https://github.com/ev3dev/ev3dev/issues"
robot@ev3dev:$ cat /etc/debian_version
8.5
robot@ev3dev:$

robot@ev3dev:~$ lscpu
Architecture: armv5tejl
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
Model name: ARM926EJ-S rev 5 (v5l)

Where did you download it from? What are the contents in you are seeing in that tarball? Also, notice that only the runtime is available for arm, not the SDK, so, while you will be able to dotnet .dll to run your app, you won't be able to dotnet build it or dotnet publish directly in the arm device.

ive since been told that dotnet needs at least arm7 to run.. and even though my processor is ARM9 its actually running the arm5 instruction set so im dead in the water. just bought the brickpi and raspberrypi to unblock thanks for your response.

Was this page helpful?
0 / 5 - 0 ratings