Building Mono From Source Code on Suse 10

Joe Audette


If you followed the first article in the series, you now have Suse 10 installed and you are able to access the internet hopefully you have looked around and tried a few things to get familiar with Linux.

If you are new to Linux you are probably surprised to find out how user-friendly the desktop environments are, things are really starting to come together in the Linux desktop space.

However, if you are serious about becoming proficient in the use of Linux you are going to have to warm up to the idea of using the command shell, once you learn some of the basics you will start to realize that using the command shell is easy when you know how and much more direct than a GUI in a lot of ways.

building mono

I’ve never been a guru of the DOS prompt myself, I know a few commands for network settings, telnet FTP, and SMTP commands, etc. but that’s about it I don’t write a lot of .bat files or anything, and what I do know I have learned out of necessity not joy. So my initial perception when I started learning Linux was oh great I have to learn some old-school ways because they don’t have a GUI for everything in Linux, oh well I’m not afraid but I’m not excited.

But let me tell you the Linux command shell is not your father’s DOS prompt, because the command shell is the culture in the Unix/Linux world they have taken it way beyond any DOS prompt on a Windows machine.

There are a zillion tools and the shell itself can even be visually customized, no boring black and white fixed-width console, try a full-screen translucent with the Suse lizard smiling through at you.

Now I am totally a command shell enthusiast apprentice, I am not an expert yet but I love it and want to learn as much as I can.

So hey before we get started on building mono let’s trick out your shell so the lizard smiles through while you build mono. Login to your machine using the KDE desktop and click the little icon in the bottom left of the screen that looks like a monitor with a DOS prompt to launch Konsole. (You can do the same thing later in the command shell using the Gnome desktop, poke around, and you’ll find it).

When Konsole opens maximize it and then choose Settings > Configure Konsole from the menu at the top. Click the tab that says “Schema”. In the Schema list as shown below choose Transparent, Dark Background then click the box that says “Set as Default Schema”.

You can also tweak the transparency with the slider in the bottom right if you want.  Click OK to finish.

Now type exit and hit the enter key to close the shell then click the icon in the lower left again to re-open it and now you have the translucent shell.

One more thing before we get started we need to make sure you installed the apache2 development libraries, we will need this for compiling mod_mono. It was not available from the cd install but there is a link in my previous article.

In any case, you can check and make sure it is there by browsing the menu in suse 10 to System > Control Center (YaST). You will be prompted for the root password. Next, Choose Software > Software Management from YaST and you will see a screen that allows you to search for installed software as shown below.

  • Search for Apache and make sure apache2-devel is installed. 
  • Open the File Manager -Super User mode again browse to the rpm file and right click and choose Actions > Install With YaST

All right now we’re well on our way, let’s get started with building mono so you can test ASP.NET using mod_mono and Apache while staying up with the latest bug fixes and improvements. We will be using the Subversion command line client svn to get the source code from the public mono repository, but to simplify things we will be using a bash script to automate the svn commands. 

I downloaded this script from Paul Johnson’s site and paired it down to just what is needed for ASP.NET. If you are interested in doing Forms applications or even building the MonoDevelop IDE from source code you should visit his site and check out his scripts, but for now, just download this zip file with the script I’ve prepared for this article.

When you get time look at the script to learn a little about SVN, there are only a few lines of code in the file.

code on screen

Close the Super User File Manager and click the House icon in the lower left corner to open a file manager in normal user mode. You are now in your home directory. Create a new folder for the mono source files Edit > Create New > Folder.

Name the folder monosrc or whatever you want. Now you need to extract the file from the zip file you downloaded above and place it in the new monosrc folder. Hint, you can right-click the .zip file and you should see an option to extract it.

Now go back to your command shell window and the fun can begin. I switched my background back to white to get better screenshots.

The first thing we need to do is mark the script file as executable by giving it execute permission. You should already be in your home folder in the command shell so just type
cd /monosrc

to switch to the folder with the script or you could use
cd /home/frodo/monosrc

replacing frodo with your user name. You have to hit the enter key after every command if that’s not obvious.

another handy command is
which lists the files in the current folder much like the dir command in DOS. Now to make the script executable type:

  • chmod +x
  • Then to execute the script type
  • ./

Let it run and it will get the files for compiling mono, MCS, libgdiplus, xsp, and mod_mono. I’m pretty sure ligdiplus is more important to WinForms development but I always get it anyway, it’s easy enough. When it’s done getting files use the ls command and you should see something like this.

Enter the command cd mono to switch to the mono folder then enter the command
./ –prefix=/usr
(note here that in subsequent runs you should run the command make clean before the autogen)
to start compiling the core mono libraries.

Be patient, and consider what it would be like to compile the whole .NET framework, you are basically doing the equivalent in this and the next few steps. After the above command completes you should see this.

After a good while it will finish then you enter the command
sudo make install
it will prompt you for the root password

Sweet, next we’ll compile xsp the mono web server, switch to the xsp directory by entering the command cd ../xsp
then we do just as we did in the mono directory, enter the command
./ –prefix=/usr

when it finishes type make, then of course sudo make install

next, as shown above we start the same process for mod_mono
cd ../mod_mono
./ –prefix=/usr

and finally – sudo make install

That’s all there is to it. You can repeat this process as often as you like to get the latest mono source code. On subsequent runs, it’s a good idea to use the make clean command before running
./ –prefix=/usr

Congratulations you’ve now compiled and installed several programs on Linux from source code.

Stay tuned for the next article where we will learn how to set up a Samba share to share files between Linux and Windows and after that, I will create a walkthrough tutorial to install mojoPortal and configure Virtual Hosts in Apache.