Samstag, 7. April 2012

[Dreamplug] Mono 2.6

As I developed a pretty bad-ass (IMHO) DLL in C# for RS485 communication and other funny things, I want to use that on my dreamplug for some industrial application.

Big problem: The provided Ubuntu and Debian distributions don't come with suitable mono-framework installed. So I had to get Mono working.

1. Problem: with Debian: Debian Squeeze for Dreamplug is available and also apt-get install mono-complete seems to be working - as long as the installation doesn't reach the point where monodoc is installed. There seems to be something in XPath missing. I cancelled installation there but I don't think that was a good idea...

2. Problem: because I was frustrated by Debian I gave Ubuntu 9.04 a try. Because this distribution is a few years old, it isn't longer supported by and also the latest available Framework for this distribution is Mono 2.0, which is also ooooold! So I downloaded sources for Mono 2.6 and compiled the framework on my own.

It seemed the only way out was to compile Mono Framework on the dreamplug from source to get an working copy of the framework running.

Before starting compilation you should make sure you use the latest available tools.

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

After update was done I performed the compilation itself according to an entry in by profnimrod:
1. Make sure the following package are already installed: bison, gcc, gettext, pkg-config glib-2.0.  There may be others required.  If the configuration step (4) fails the error message will indicate what package is missing;
2. Use 'wget' to download the mono-2.6.1.tar.gz from the Mono website;
3. Unzip with 'bzip2 -cd mono-2.6.1.tar.gz' | tar xvf -' in a directory of your choosing;
4. 'cd' into the Mono folder that is created, and execute './configure --prefix=/usr';
5. Execute 'make'.  This may take several hours;
6. Execute 'make install'.  All done.  Check version with 'mono -V' to make sure you are up to date.

Sources are available there:

After make install succeeded and initial checks were done, you may delete the sources and buildfiles in Folder /src. They aren't needed anymore.

Note #1: You can't run mono-applications from bash with ./executable.exe , you have to call a Mono-Application, let's say initialTest.exe as shown below:

 mono initialTest.exe  

Note #2: (later a post will follow...): Mono-Framework is a bit tricky if you want to read from bash. The C# System.ReadlLine() and System.ReadKey() is NOT linked to the GNU-Readline(). So for initial tests you should use console-applications without reading from C# console.

 namespace InitialTestMono  
      class Program  
           public static void Main(string[] args)  
                Console.WriteLine("Hello World!");  
                // TODO: Implement Functionality Here  
                Console.Write("Press any key to continue . . . ");  

This piece of code doesn't work, because there's the Console.ReadKey(true); If you run that program you freeze your Dreamplug because it get's stuck somewhere in Mono.Console.ReadKey(). If you attempt to terminate by pressing CTRL+C that's lost somewhere in Mono and not redirected to Bash, so you have no chance to get back to bash-prompt again. You have to cycle power on your Dreamplug...

Keine Kommentare:

Kommentar veröffentlichen