Setting up a modern .NET stack on ARM devices


These are my (work-in-progress) notes on setting up a bleeding-edge Mono runtime and ASP.NET vNext on Raspberry Pi and ODROID devices with hardware floating point.

Building Mono from Source

# I'm going to do everything as root
su -
# grab minimal dependencies
apt-get install build-essential mono-runtime autoconf libtool automake
# import required certificates
mozroots --import --ask-remove --machine

# Now check out the Mono tree (this alone will take ages if you have a slow SD card)
git clone git://github.com/mono/mono.git
cd mono
./autogen.sh --prefix=/usr/local
# grab the bootstrap compiler
make get-monolite-latest
# now is a nice time to go off and take a long stroll by the beach
make 
# use this instead if you have distcc like me, it will speed up building the native bits: 
# DISTCC_NODES=“node1 node2 node3 node4 localhost” make -j5 CC=distcc
# now install it locally
make install
# Should report 3.10.1 (or above) and hardware floating point
mono --version

Here’s my current sample output on a Pi:

Mono JIT compiler version 3.10.1 (master/8da186e Sat Oct 25 19:32:35 WEST 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug 
        LLVM:          supported, not enabled.
        GC:            sgen

A Note on LLVM support

It’s possible to set up the Mono LLVM fork to have Mono use LLVM instead of its built-in JIT, but it requires picking the right Git branch and passing both --enable-llvm=yes to autogen.sh and --llvm to mono itself and is not very useful on the Pi, since the trade-offs in RAM/performance are debatable. Start up time, in particular, seems to take a sizable hit.

vNext

This uses myget.org to fetch the nightly vNext package builds (by Eilon Lipton, who works at Microsoft), so your mileage may vary depending on how stable the nightlies are.

# grab K tools
curl https://raw.githubusercontent.com/aspnet/Home/master/kvminstall.sh | sh && source ~/.kre/kvm/kvm.sh 
kvm upgrade

# add the package repo certificates
sudo certmgr -ssl -m https://nuget.org
sudo certmgr -ssl -m https://www.myget.org
mozroots --import --sync
# run the samples
git clone https://github.com/aspnet/home
cd cd home/samples/HelloWeb
kpm restore -s https://www.myget.org/F/aspnetvnext/