<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>centriment &#187; open-source</title>
	<atom:link href="http://www.centriment.com/tag/open-source/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.centriment.com</link>
	<description>stories of the spirit living inside the computer</description>
	<lastBuildDate>Sun, 26 Jul 2009 12:29:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Building Mono 2.4 from source on Ubuntu 8.10</title>
		<link>http://www.centriment.com/2009/04/01/building-mono-24-from-source-on-ubuntu-810/</link>
		<comments>http://www.centriment.com/2009/04/01/building-mono-24-from-source-on-ubuntu-810/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 10:14:11 +0000</pubDate>
		<dc:creator>Jan Dzik</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mono/.NET]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c-sharp]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[monodevelop]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[repl]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.centriment.com/?p=72</guid>
		<description><![CDATA[Sad to say that the latest versions of Ubuntu and Debian do not provide the latest packages of Mono preferring stability over bleeding edge. Also, according to the packagers&#8217;  mailing list it is not an easy task to provide packages for mono and all the software that binds to it.
I am a sucker for bleeding [...]]]></description>
			<content:encoded><![CDATA[<p>Sad to say that the latest versions of Ubuntu and Debian do not provide the latest packages of Mono preferring stability over bleeding edge. Also, according to the packagers&#8217;  mailing list it is not an easy task to provide packages for mono and all the software that binds to it.</p>
<p>I am a sucker for bleeding edge, especially when it comes to thinks like Mono. The latest stable release of Mono, version 2.4 has a lot of new features like the C# interactive repl shell, SIMD extensions and better support for C# 3/.NET 3.5 features, like extension methods and LINQ. See the release notes <a title="Mono 2.4 Release notes" href="http://www.mono-project.com/Release_Notes_Mono_2.4" target="_blank">here</a>. I was disappointed when the most recent version of mono debian packages I could find were for the 2.0.1 version on third-party repositories.</p>
<p>What to do then? Download the source, configure and build to run in parallel to the version of mono installed in my Ubuntu desktop (the mono run-time is always installed on Ubuntu by default, even the live CD runs it, since it is needed to run .NET applications, like F-Spot, that have become a standard in the GNOME desktop). It turns out that it&#8217;s not that difficult as it sounds.</p>
<h2>Step 1: Install prerequisites for compilation.</h2>
<p><span style="font-weight: normal;">First of all, you will need to setup the appropriate tools for configuring and compiling source code. You can install these through the Synaptic package manager but for the sake of speed let&#8217;s use some command line magik <img src='http://www.centriment.com/wp-content/plugins/tango-smileys-extended/tango/wink.png' alt='Wink' class='tse-smiley' /></span></p>
<p><span style="font-weight: normal;">Open a console and type in the following to install the gcc compiler, and development header files needed to compile the mono compilers, tools and library stack.</span></p>
<pre>user@system$&gt; sudo apt-get update
user@system$&gt; sudo apt-get install build-essential autoconf automake \
bison flex gtk-sharp2-gapi boo gdb valac libfontconfig1-dev \
libcairo2-dev libpango1.0-dev libfreetype6-dev libexif-dev \
libjpeg62-dev libtiff4-dev libgif-dev zlib1g-dev libatk1.0-dev \
libglib2.0-dev libgtk2.0-dev libglade2-dev libart-2.0-dev \
libgnomevfs2-dev libgnome-desktop-dev libgnome2-dev libgnomecanvas2-dev \
libgnomeui-dev libgnomeprint2.2-dev libgnomeprintui2.2-dev \
libpanel-applet2-dev libnautilus-burn-dev librsvg2-dev \
libgtkhtml3.14-dev libgtksourceview2.0-dev libgtksourceview-dev \
libvte-dev libwnck-dev libnspr4-dev libnss3-dev libxul-dev \
libwebkit-dev libvala-dev</pre>
<p>This should install all the necessary software and development headers needed for the compilation.</p>
<h2>Step 2: Download mono 2.4 source archives.</h2>
<p>Go to <a href="http://ftp.novell.com/pub/mono/sources-stable/">http://ftp.novell.com/pub/mono/sources-stable/</a> . You don&#8217;t need every archive in that list.<br />
In this guide we will use: <a href="http://ftp.novell.com/pub/mono/sources/mono/mono-2.4.tar.bz2">mono-2.4.tar.bz2</a>, <a href="http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.4.tar.bz2">libgdiplus-2.4.tar.bz2</a>, <a href="http://ftp.novell.com/pub/mono/sources/gluezilla/gluezilla-2.4.tar.bz2">gluezilla-2.4.tar.bz2</a>, <a href="http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.4.tar.bz2">xsp-2.4.tar.bz2</a>, <a href="http://ftp.novell.com/pub/mono/sources/mono-tools/mono-tools-2.4.tar.bz2">mono-tools-2.4.tar.bz2</a>, <a href="http://ftp.novell.com/pub/mono/sources/gecko-sharp2/gecko-sharp-2.0-0.13.tar.bz2">gecko-sharp-2.0-0.13.tar.bz2</a>, <a href="http://ftp.novell.com/pub/mono/sources/mono-debugger/mono-debugger-2.4.tar.bz2">mono-debugger-2.4.tar.bz2</a>, <a href="http://ftp.novell.com/pub/mono/sources/mono-addins/mono-addins-0.4.zip">mono-addins-0.4.zip</a>, <a href="http://ftp.novell.com/pub/mono/sources/gtk-sharp212/gtk-sharp-2.12.8.tar.bz2">gtk-sharp-2.12.8.tar.bz2</a>, <a href="http://ftp.novell.com/pub/mono/sources/gnome-sharp220/gnome-sharp-2.20.1.tar.bz2">gnome-sharp-2.20.1.tar.bz2</a>, <a href="http://ftp.novell.com/pub/mono/sources/gnome-desktop-sharp2/gnome-desktop-sharp-2.20.1.tar.bz2">gnome-desktop-sharp-2.20.1.tar.bz2</a>, <a href="http://ftp.novell.com/pub/mono/sources/webkit-sharp/webkit-sharp-0.2.tar.bz2">webkit-sharp-0.2.tar.bz2</a></p>
<p>Also go to the MonoDevelop <a href="http://monodevelop.com/Download" target="_blank">website</a> and download the sources for monodevelop 2.0: <a href="http://ftp.novell.com/pub/mono/sources/monodevelop/monodevelop-2.0.tar.bz2">monodevelop-2.0</a>, <a href="http://ftp.novell.com/pub/mono/sources/monodevelop-debugger-mdb/monodevelop-debugger-mdb-2.0.tar.bz2">monodevelop-debugger-mdb-2.0</a>, <a href="http://ftp.novell.com/pub/mono/sources/monodevelop-debugger-gdb/monodevelop-debugger-gdb-2.0.tar.bz2">monodevelop-debugger-gdb-2.0</a>, <a href="http://ftp.novell.com/pub/mono/sources/monodevelop-database/monodevelop-database-2.0.tar.bz2">monodevelop-database-2.0</a>, <a href="http://ftp.novell.com/pub/mono/sources/monodevelop-java/monodevelop-java-2.0.tar.bz2">monodevelop-java-2.0</a>, <a href="http://ftp.novell.com/pub/mono/sources/monodevelop-vala/monodevelop-vala-2.0.tar.bz2">monodevelop-vala-2.0</a></p>
<p>Create a directory in your home directory for the extracted sources, e.g. <em>src/mono-2.4</em>.</p>
<pre>user@system$&gt; mkdir -p src/mono-2.4; cd src/mono-2.4</pre>
<p>Extract the downloaded archives to that directory.</p>
<h2>Step 3: Prepare the parallel environment</h2>
<p>Now it&#8217;s time to prepare our system for two versions of the mono runtime. A good idea is to install everything related to mono 2.2 to some path like /opt/mono-2.2 and create shell script to load an environment that will use the version located in that path instead of the default installation. That way you will not render your existing mono installation unstable or broken.</p>
<p>Now create a script that will load the separate mono-2.4 environment.</p>
<pre>user@system$&gt; cat &gt; mono-2.4-environment
#!/bin/bash
MONO_PREFIX=/opt/mono-2.4
GNOME_PREFIX=/opt/gnome-2.4
export DYLD_LIBRARY_PATH=$MONO_PREFIX/lib:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$MONO_PREFIX/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=$MONO_PREFIX/include:$GNOME_PREFIX/include
export ACLOCAL_PATH=$MONO_PREFIX/share/aclocal
export PKG_CONFIG_PATH=$MONO_PREFIX/lib/pkgconfig:$GNOME_PREFIX/lib/pkgconfig
PATH=$MONO_PREFIX/bin:$PATH
PS1="[mono-2.4] \w @ "</pre>
<p>[Press Ctrl+D for EOF to write the file and get back to the prompt]</p>
<pre>user@system$&gt; sudo mv mono-2.4-environment /usr/local/bin
user@system$&gt; sudo chmod +x /usr/local/bin/mono-2.4-environment</pre>
<p>And create a second script that will load the environment and execute its argurments.</p>
<pre>user@system$&gt; cat &gt; mono-2.4
#!/bin/bash
MONO_PREFIX=/opt/mono-2.4
GNOME_PREFIX=/opt/gnome-2.4
export DYLD_LIBRARY_PATH=$MONO_PREFIX/lib:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$MONO_PREFIX/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=$MONO_PREFIX/include:$GNOME_PREFIX/include
export ACLOCAL_PATH=$MONO_PREFIX/share/aclocal
export PKG_CONFIG_PATH=$MONO_PREFIX/lib/pkgconfig:$GNOME_PREFIX/lib/pkgconfig
PATH=$MONO_PREFIX/bin:$PATH

exec "$@"</pre>
<p>[Press Ctrl+D for EOF to write the file and get back to the prompt]</p>
<pre>user@system$&gt; sudo mv mono-2.4 /usr/local/bin
user@system$&gt; sudo chmod +x /usr/local/bin/mono-2.4</pre>
<p>Load the environment:</p>
<pre>user@system$&gt; source mono-2.4-environment</pre>
<p>After this command, the prompt should change and contain <em>[mono-2.4] </em>to indicate that you are operating in a Mono 2.4 environment.</p>
<pre>[mono-2.4] ~ @ cd ~/src/mono-2.4</pre>
<p><strong>NOTE!</strong> For the sake of readability the prompt indication in the instructions will remain the generic <em>user@system$&gt;</em> but for the rest of the guide you must make sure that you follow each step while in the 2.4 environment.</p>
<p>And now create the directory where everything will be installed:</p>
<pre>user@system$&gt; sudo mkdir -p /opt/mono-2.4</pre>
<h2>Step 4: libgdiplus</h2>
<p>Before compiling the main sources of mono we must compile libgdiplus if we want to have an implementation of the System.Drawing namespace.</p>
<pre>user@system$&gt; cd libgdiplus-2.4
user@system$&gt; ./configure --prefix=/opt/mono-2.4 --with-pango</pre>
<p>The output of the configure script should be something like this:</p>
<pre>---
Configuration summary

   * Installation prefix = /opt/mono-2.4
   * Cairo = 1.8.0 (system)
   * Text = pango
   * EXIF tags = yes
   * Codecs supported:

      - TIFF: yes
      - JPEG: yes
      - GIF: yes
      - PNG: yes
      NOTE: if any of the above say 'no' you may install the
            corresponding development packages for them, rerun
            autogen.sh to include them in the build.

---</pre>
<p>If any of the options say no then you have a missing dependency. You might want to use the Synaptic package manager to find the appropriate package to install. However, these dependencies are optional.</p>
<p>Now it&#8217;s time to build the source.</p>
<pre>user@system$&gt; make
user@system$&gt; sudo make install</pre>
<h2>Step 5: mono-2.4</h2>
<p>Now it&#8217;s time to compile mono&#8217;s main sources which will produce, among others, the c# compilers and the base class libraries.</p>
<pre>user@system$&gt; cd ../mono-2.4
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install</pre>
<p>Verify that the mono compilers have been installed:</p>
<pre>user@system$&gt; which gmcs</pre>
<p>This should output: <em>/opt/mono-2.4/bin/gmcs<br />
</em>Your existing mono installation will be preserved since everything is installed to the /opt/mono-2.4 directory.</p>
<h2>Step 6: gtk+ and gnome</h2>
<p>Now it&#8217;s turn to compile libraries needed for desktop environment, namely gtk-sharp, gnome-sharp, gnome-desktop-sharp, gtksourceview-sharp.</p>
<pre>user@system$&gt; cd ../gtk-sharp-2.12.8
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install
user@system$&gt; cd ../gnome-sharp-2.20.1
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install
user@system$&gt; cd ../gnome-desktop-sharp-2.20.1
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install</pre>
<h2>Step 7: gluezilla, gecko-sharp, webkit-sharp</h2>
<p>Now lets compile libraries for embedding the gecko and webkit html rendering engines.</p>
<pre>user@system$&gt; cd ../gluezilla-2.4
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install
user@system$&gt; cd ../gecko-sharp-2.0-0.13
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install
user@system$&gt; cd ../webkit-sharp-0.2
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install</pre>
<h2>Step 8: build Mono.Addins</h2>
<p>Turn to compile the Mono.Addins libraries:</p>
<pre>user@system$&gt; cd ../mono-addins-0.4
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install</pre>
<h2>Step 9: build Mono tools</h2>
<p>Now it&#8217;s turn to compile the marvelous collection of Mono tools, including Gendarme and GSharp (the C# interactive shell).</p>
<pre>user@system$&gt; cd ../mono-tools-2.4
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install</pre>
<p>After this you have installed the gsharp tool. Test it out:</p>
<pre>user@system$&gt; gsharp</pre>
<p>Play a little with the C# repl <img src='http://www.centriment.com/wp-content/plugins/tango-smileys-extended/tango/smile.png' alt='Smile' class='tse-smiley' /> Type quit; when you&#8217;re done.</p>
<h2>Step 10: build Mono XSP</h2>
<p>This is actually something very useful. XSP is a standalone web server developed in C#. It can be run through the command line or even embedded into your application by referencing the Mono.WebServer assembly.</p>
<pre>user@system$&gt; cd ../xsp-2.4
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install</pre>
<h2>Step 11: build the Mono Debugger</h2>
<p>Getting closer to the end of our compilation session, let&#8217;s build the mono debugger allowing us to debug the faulty software we write.</p>
<pre>user@system$&gt; cd ../mono-debugger-2.4
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install</pre>
<h2>Step 12: build MonoDevelop 2.0</h2>
<p>Now what would all this be without a nice IDE? MonoDevelop 2.0 brings us finally debugger support!</p>
<pre>user@system$&gt; cd ../monodevelop-2.0
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install
user@system$&gt; cd ../monodevelop-debugger-mdb-2.0
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install
user@system$&gt; cd ../monodevelop-debugger-gdb-2.0
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install
user@system$&gt; cd ../monodevelop-database-2.0
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install
user@system$&gt; cd ../monodevelop-java-2.0
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install
user@system$&gt; cd ../monodevelop-vala-2.0
user@system$&gt; ./configure --prefix=/opt/mono-2.4
user@system$&gt; make
user@system$&gt; sudo make install</pre>
<p>And&#8230; That&#8217;s it. You now have a working mono-2.4 environment and an excellent IDE to work with.</p>
<p>You can launch any .NET program with Mono 2.4 with:</p>
<pre>user@system$&gt; mono-2.4 PATH_TO_THE_PROGRAM_AND_ITS_ARGUMENTS_IF_ANY</pre>
<p>For example to launch MonoDevelop 2.0:</p>
<pre>user@system#&gt; mono-2.4 monodevelop</pre>
<p><strong>NOTE!</strong> This will work only for shell scripts that are normally distributed with mono applications. If you look at<em> /opt/mono-2.4/bin/monodevelop</em> you will see that it is a shell script that essentially runs something like this: <em>mono /opt/mono-2.4/lib/monodevelop/bin/MonoDevelop.exe</em>. Trying to execute a .NET application, e.g. called main.exe, by typing <em>mono-2.4 main.exe</em> will fail. You sould type <em>mono-2.4 mono main.exe </em>instead.</p>
<p>Enjoy hacking!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.centriment.com/2009/04/01/building-mono-24-from-source-on-ubuntu-810/feed/</wfw:commentRss>
		<slash:comments>74</slash:comments>
		</item>
	</channel>
</rss>
