Building Mono on Raspberry Pi
The precompiled mono version you can get in raspbian is very old (version 3.something) and we currently have version 18.104.22.168. If you want to have a more up to date version you need to compile it yourself from the source. In this post I will write the steps I have used to build it.
You can find the general mono build information here: Building mono from a release package
I use raspbian jessie lite on a Raspberry Pi 3, and as always, first you should make sure your Linux is fully updated:
sudo apt-get update
sudo apt-get upgrade
Some additional packages are required:
sudo apt-get install libtool gettext cmake automake autoconf build-essential
The compile process is long so if you connect with ssh it is a good idea to use screen, so you can detach from the pi while it is compiling.
sudo apt-get install screen
to start screen simple write “screen” enter. To detach use ctrl+a d. To reattach again use “screen -r”
Get and unpack the source
Make a folder to hold the mono source:
Get the mono source:
To find the latest version number go to this web page:
And find the latest in the list.
Unpack the file:
tar -jxf mono-22.214.171.124.tar.bz2
If you want see progress add a v to the options, it takes a few minutes to unpack the file (mostly depending of the speed of your SD-card). the progress may make it a bit slower to unpack.
Configure, Build and install
It will take about 10 minutes to complete. Now build it:
This will take hours to complete (about 3 hours on raspberry pi 3, but not sure exactly because i did not sit and watch it compile!). Once the compilation is done you can install:
sudo make install
Mono is now installed and ready to use. To uninstall use:
sudo make uninstall
Verify the version
Mono JIT compiler version 126.96.36.199 (tarball Sun 18 Jun 11:49:14 UTC 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
LLVM: supported, not enabled.
GC: sgen (concurrent by default)