Blogs Blogs

« Back

Building Mono from Source

Installing  Mono on Ubuntu is easy:

$ apt-get install mono-2.0-devel

Unfortunately even the latest version of Ubuntu 9.04 only comes with Mono 2.0.1.  To install a newer (or different) version a solution would be to build Mono from source.

Download the desire version from the Mono website and extract the packaged file.

$ wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.4.tar.bz2
$ tar -xf mono-2.4.tar.bz2

 

To compile and install Mono execute the following

$ cd mono-2.4
$ configure --prefix=/opt/mono-2.4

 

Where --prefix option indicates which directory to installation should be; for more option run

$ configure --help

 

If anything is missing from the system, configure will throw an error, install the missing package with apt-get and try running it again.  Then execute the compilation and installation to complete the build.

$ make
$ make install

Compiling Error with Mono 1.9.1

If you are compiling Mono 1.9.1 the following error might be encountered:

wapi_glob.c: In function 'globextend':
wapi_glob.c:303: error: 'ARG_MAX' undeclared (first use in this function)
wapi_glob.c:303: error: (Each undeclared identifier is reported only once
wapi_glob.c:303: error: for each function it appears in.)

 

The problems is due to the newer versions of GLib no longer defines ARG_MAX. To fix this issue, add the following to mono/io-layer/wapi_glob.c in the Mono source directory:

#include <unistd.h>
#if defined(_SC_ARG_MAX)
# if defined(ARG_MAX)
#    undef ARG_MAX
# endif
# define ARG_MAX sysconf (_SC_ARG_MAX)
#endif

 

#include "wapi_glob.h"