Samstag, 7. April 2012

[Dreamplug] Debian Squeeze Mono 2.10

Because installing mono-complete via apt-get fails (there are problems with xpath while installing monodoc), I decided to build Mono 2.10 from source directly on Dreamplug running Debian Squeeze (Initial Distro got from

First of all, you have to make sure you're using latest compiler and header stuff:

 root@debian:~# apt-get update   
 root@debian:~# apt-get install gcc libtool bison pkg-config libglib2.0-dev gettext make bzip2 g++  

Afterwards create a working directory, I created /src and download Mono Sources there. Mono 2.10 Source is available at (07.04.2012)

 root@debian:~# mkdir /src  
 root@debian:~# cd /src  
 root@debian:/src# wget  

Now we have to create a directory where we can extract the source files to. I created monoSource and extracted the Sourcefiles from mono-2.10.tar.bz2 there. This works best (in my opinion) through unzipping to stdout (option -cd stands for decompress to stdout) and pipe this output into tar (option -xv stands vor extract verbose).

The extraction process may take a few minutes as there are loads of files...

 root@debian:/src# mkdir monoSource  
 root@debian:/src# cd monoSource  
 root@debian:/src/monoSource# bzip2 -cd ../mono-2.10.tar.bz2 | tar -xv  

Last step before compiling is to configure the source package. To do so, move to the folder tar made for you and run configure with long option --prefix=/usr. This defines the installation path of the whole mono package, it'll be located in /usr/mono respectivly /usr/lib/mono mostly then.

Further the configure process checks if all building utilities that'll be used later on are available on your system. If not, something went wrong in the first step when updating/installing build tools. Further it builds a lot of makefiles and does some other things for you in order to prepare the compilation process.

 root@debian:/src/monoSource# cd mono-2.10  
 root@debian:/src/monoSource/mono-2.10# ./configure --prefix=/usr  

After configuration is done, you simply type make to start compilation. After that it's time for a cup of coffee, some outdoor activity (if the weather is better than whilst writing this) or other stuff. Dreamplug will be busy for several hours with compiling Mono...

 root@debian:/src/monoSource/mono-2.10# make  

If you get a glimps every now and then at the terminal output while compiling framework files (*.cs, compiling here is already done with mono-compiler!) you may recognize a lot of warnings of unreachable code and unused variables... That's nothing you should worry about too much.

When compilation succeeded finally, type make install to transplant the fresh compiled mono framework into your system. The Installation process shouldn't take too long, just long enough to make me nervous whether this whole thing may be successful or not.

 root@debian:/src/monoSource/mono-2.10# make install  

After this last step has completed, Mono is successfully installed on your operating system. You may check installation by checking mono --version or executing some .NET applications.

 root@debian:/src/monoSource/mono-2.10# mono -- version  

Please note, .NET applications couldn't be started like normal executables, but have to be passed to mono as a parameter, e.g. if you want to start an executable named "testMono.exe", you type

 root@debian:~# mono testMono.exe 

Also note, Console.ReadLine() or Console.ReadKey does not work as you may expect it to. With these methods you read something else, but not the input from BASH. If your programm contains such lines, you are going to freeze complete BASH, because everything you enter (include CTRL+C) and stuff is "absorbed" by the mono application and the application get's stuck with it's not existing virtual Console.

I'm planning to do an article on that next week... Link may be found here soon

Keine Kommentare:

Kommentar veröffentlichen