4 Dec 2017 Update
I ran into some issues building the latest github versions of Mono and MonoDevelop on the PINE64, and I guess the same may apply here. If you encounter any difficulty building either Mono or MonoDevelop, you can try using the specific versions listed below. You can checkout the specific tags immediately after cloning the corresponding repositories before you start building.
Mono 4.8.1.0 –git checkout tags/mono-4.8.1.0
MonoDevelop 6.1.0.5441 –git checkout tags/monodevelop-6.1.0.5441
Since I will be using C# for most of my development (with a combination of C for some native system functionality), I decided to go with Mono. This guide is based on the assumption that you’re running the May 2016 Raspbian Jessie Lite image. The easiest way to get MonoDevelop up and running would be to run sudo apt-get install monodevelop
which would also handle all the necessary dependencies including the Mono runtime. However, the versions in the repository are pretty old, and I want to be able to make use of .NET 4 features.
Another option for .NET development on Linux is .NET Core. Version 1.0 was officially announced by Microsoft a few days ago, but there aren’t ARM binaries available and I haven’t been able to successfully build it for the Pi, yet.
Git
The Mono project code is hosted on Github, so the first thing to be done is to install git.
1 | sudo apt-get install git |
Build Mono
Obtain the source code from the Github repository using the command
1 | git clone https://github.com/mono/mono |
Then install the Mono build process prerequisites.
1 | sudo apt-get install autoconf autotool libtool libtool-bin |
You can follow the build instructions in the README.md
for the repository at https://github.com/mono/mono/blob/master/README.md. To summarise, change to the source root directory (cd mono
) and run the following commands.
1 2 3 4 | ./autogen.sh --prefix=/usr make get-monolite-latest make sudo make install |
If you wish to run the mono and mcs test suites, you can do a make check
before make install
. The build will take quite a while, so you have to be patient. I didn’t time my build, but my best guess would be about 3 to 4 hours.
Build FSharp
MonoDevelop apparently requires the F# compiler to be installed. First thing to do is to import trusted root certificates required by the NuGet package manager into the machine store. The NuGet package manager retrieves certain required packages as part of the build process, so this is required.
1 2 | sudo mozroots --import --sync sudo certmgr -ssl -m https://nuget.org |
Next, we clone the FSharp git repository and build.
1 2 3 4 5 | git clone https://github.com/fsharp/fsharp cd fsharp ./autogen.sh --prefix=/usr make sudo make install |
Build additional MonoDevelop dependencies
MonoDevelop also requires gtk-sharp and gnome-sharp to be installed on the system. The first step is to install the rest of the apt dependencies for all three packages.
1 | sudo apt-get install cmake libgtk2.0-dev libglade2-dev libgnomecanvas2-dev libgnome2-dev libgnomeui-dev libssh2-1-dev devscripts |
devscripts
will be used to create a package of PCL Assemblies which is required for the MonoDevelop build process.
Once the dependencies have been installed, gtk-sharp should be built first and then gnome-sharp.
To build gtk-sharp
1 2 3 4 5 | git clone -b gtk-sharp-2-12-branch --single-branch https://github.com/mono/gtk-sharp cd gtk-sharp ./bootstrap-2.12 --prefix=/usr make sudo make install |
And gnome-sharp
1 2 3 4 5 | git clone https://github.com/mono/gnome-sharp cd gnome-sharp ./bootstrap-2.24 --prefix=/usr make sudo make install |
Build MonoDevelop
If you made it through all of that, you can finally proceed to build MonoDevelop. But there are a few caveats which we’ll cover in a bit.
1 2 3 4 | git clone https://github.com/mono/monodevelop cd monodevelop git submodule update --init --recursive ./configure --prefix=/usr --profile=stable --disable-nls |
The first error I encountered after I running make
was an issue with NuGet not finding a number of packages. To fix this while your current directory is the monodevelop
directory, run the following commands and then run make
again (if you’ve run it previously).
1 2 3 | cd main/.nuget mono NuGet.exe update -self cd ../../ |
The next error stated that certain PCL Assemblies were missing. To sort this out
1 2 3 | git clone http://github.com/directhex/xamarin-referenceassemblies-pcl cd xamarin-referenceassemblies-pcl/debian nano control |
Remove mono-xbuild
from the list of dependencies in the control
file, save and close. Then continue with the following commands.
1 2 3 4 | cd .. debuild -i -us -uc -b cd .. sudo dpkg -i referenceassemblies-pcl_2014.04.14-1_all.deb |
The final error had to do with the fsharpbinding
regarding missing references in a particular assembly. Since I don’t need the F# bindings, and it’s not a required feature, I removed it from the build process using the following steps (assuming the monodevelop
source directory is the working directory).
1 2 | cd main nano Makefile.am |
Remove the external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpBinding.addin.xml \
line, save the file and close.
1 2 | rm -r external/fsharpbinding cd ../ |
Finally, you can build and install.
1 2 | make sudo make install |
This build will also take a bit of time, so sit back, relax and rest easy. Once the installation is complete, you can simply run it by typing monodevelop
at the command line (assuming you have X11 forwarding enabled in your SSH session).