Wed Oct 8, 2008
Currently the Mono project does not release Ubuntu binary packages so if you want the latest version of Mono you need to compile and install yourself. I use the Xubuntu, Here are the steps I took to install Mono 2.0 on Xubuntu 7.10:
Download mono and libgdiplus tarballs from http://ftp.novell.com/pub/mono/sources-stable/.
$ wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.0.1.tar.bz2 $ wget http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.0.tar.bz2
Install libglib2 development headers:
$ sudo apt-get install libglib2.0-dev
Install libfontconfig1 development headers (without this ./configure emits configure: error: Cairo requires at least one font backend):
$ sudo apt-get install libfontconfig1-dev
Compile and install libgdiplus. libgdiplus is required for Winforms, if you don’t use Winforms you can skip this step and use ./configure –with-libgdiplus=no when you compile Mono.
$ tar -xjf libgdiplus-2.0.tar.bz2 $ cd libgdiplus-2.0 $ ./configure $ make $ sudo make install
The libraries were installed in /usr/local/lib.
$ sudo apt-get install bison
$ tar -xjf mono-2.0.tar.bz2 $ cd mono-2.0 $ ./configure $ make $ sudo make install
If you want to compile or run GUI applications using GTK bindings instead of WinForms you need to download and compile Gtk#:
First install the following packages to ensure the necessary headers:
$ sudo apt-get install libpango1.0-dev $ sudo apt-get install libatk1.0-dev $ sudo apt-get install libgtk2.0-dev
Download Gtk# source tarball from http://www.mono-project.com/GtkSharp
Extract, compile and install Gtk#:
$ tar -zxf gtk-sharp-2.12.0.tar.gz $ cd cd gtk-sharp-2.12.0 $ ./configure $ make $ sudo make install
One last point, the following packages were already installed on my machine: fontconfig, fontconfig-config, libfontconfig1_ – not sure if they are _‘libgdiplus’ compilation dependents but if you have problems these may be what are required. My machine already had a number of development tools and utilities installed, so there may be other dependencies I’ve missed for an “out of the box” Xubuntu install.
You need to tell Mono where to find it’s libraries:
$ export LD_LIBRARY_PATH=/usr/local/lib
Next compile and run the Hello Worlds as described in Mono Basics.
If you have problems turn on debugging by setting MONO_LOG_LEVEL the environment variable. For example:
$ MONO_LOG_LEVEL=debug mono hello.exe
I like the idea of WinForms as a way of writing desktop apps that run on both Windows and Linux and I like to use Linux for development, problem at the moment is that there’s no SharpDevelop-like IDE for creating WinForm UIs on Linux (MonoDevelop uses GTK). There is a WinForms Designer that runs under Linux but it’s not a full IDE and currently is more a “proof of concept” thing.