OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENTAL)

Thu Mar 14, 2013 11:07 pm

Here is an experimental version of Mono 2.11.4 compiled for *HARD FLOAT*:

(Note: Installs to /usr/local. There is no uninstall so make sure you have a backup of your SD card. No warranty.)

[Procedure updated 2013-06-24]
This is the procedure for installing a working version of Mono on Raspbian that includes everything needed to use WinForms:

Code: Select all

# To install on pi
cd ~
wget https://www.dropbox.com/s/sask17flot3zqlg/mono_2_11_4_armv6hf_binary.tgz
cd /
sudo tar zxvf ~/mono_2_11_4_armv6hf_binary.tgz
sudo ldconfig
sudo apt-get install libgdiplus
Source code is here: https://www.dropbox.com/s/928wudgutlup6 ... hf_src.tgz
Mono JIT compiler version 2.11.4 (tarball Thu Mar 14 14:32:54 CDT 2013)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. http://www.mono-project.com
TLS: __thread
SIGSEGV: normal
Notifications: epoll
Architecture: armel,vfp(hardfp-abi)
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC and Parallel Mark)
I have tested it on Rasbian 2013-02-09 from the download page.

Note that you must be running X11 (startx) for System.Windows.Forms to display. Also note that System.Windows.Forms is designed for operation on Windows by Microsoft and does not always function as expected on linux systems. Also, I can not provide support for this so if it does not work for you then I recommend you continue to use the packaged mono on soft-float wheezy or wait for an official package for hard-float.

---------------------
Edit 2013-06-24:

The following should compile and install GTK Sharp 2:

Code: Select all

# Note: Mono must be installed before proceeding

# Install build depencies (some or all of the packages may already be present)
sudo apt-get install git-core
sudo apt-get install automake
sudo apt-get install libtool
sudo apt-get install libpango1.0-dev
sudo apt-get install libatk1.0-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libglade2-dev

# Install Gtk-Sharp2
# Change to the home folder, download, build and install gtk-sharp2 (this takes a long time)
cd ~
wget http://ftp.gnome.org/pub/gnome/sources/gtk-sharp/2.12/gtk-sharp-2.12.10.tar.gz
tar zxvf gtk-sharp-2.12.10.tar.gz
cd gtk-sharp-2.12.10/
./configure
make
sudo make install
Last edited by OtherCrashOverride on Tue Jun 25, 2013 4:55 am, edited 4 times in total.

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Thu Mar 14, 2013 11:18 pm

Just noticed that the source package extracts to 'mono_2_10_armv6hf'. It a packaging error and is actually 2.11.4.

3gws
Posts: 49
Joined: Sat Oct 20, 2012 10:32 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Sat Mar 16, 2013 4:25 pm

OtherCrashOverride , thanks for this update.

Will libgdiplus.so be included at some later date ?

Regards

3gws

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Sat Mar 16, 2013 5:03 pm

You can use the libgdiplus from the Raspbian repo.

Code: Select all

sudo apt-get install libgdiplus
Note that you must be running X11 (startx) for System.Windows.Forms to display.

Spid
Posts: 525
Joined: Sat Jan 19, 2013 12:47 pm

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Sun Mar 17, 2013 3:05 pm

MONO Is available for Arch Linux Arm aka alarmpi

armv6 extra mono 2.10.8-2 Free implementation of the .NET platform including runtime and compiler

pacman -Syu
pacman -S momo
pacman -S mono-basic

https://wiki.archlinux.org/index.php/Mono
I will always assume you are running Raspbian for desktop and Raspbmc for XMBC !

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Sun Mar 17, 2013 9:27 pm

Mono is also available for Rasbian. The issue is that there is not a *working* version of mono on armv6 *hard-float* until now. The distribution repos install a broken version of mono on hard-float platforms. There are many threads discussing the issues with mono and hard-float.

I hope this post makes it clear that mono installed from the repository on a hard-float distro such as Rasbian will indeed install, however, IT DOES NOT WORK. The package provided here does. Please do not direct people to install mono from their distro repository as it only leads to confusion and frustration.

Cloudcentric
Posts: 1277
Joined: Fri Sep 14, 2012 9:13 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Sun Mar 17, 2013 10:13 pm

OtherCrashOverride wrote:Mono is also available for Rasbian. The issue is that there is not a *working* version of mono on armv6 *hard-float* until now. The distribution repos install a broken version of mono on hard-float platforms. There are many threads discussing the issues with mono and hard-float.

I hope this post makes it clear that mono installed from the repository on a hard-float distro such as Rasbian will indeed install, however, IT DOES NOT WORK. The package provided here does. Please do not direct people to install mono from their distro repository as it only leads to confusion and frustration.
Be great when Debian 7 comes out of testing and Mono 3 is implemented.................................
.
.

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Sun Mar 17, 2013 10:27 pm

This thread is about a working implementation *now*. There are other threads where speculation regarding the future of mono is discussed. A bird in hand ...

andylh
Posts: 6
Joined: Thu Apr 26, 2012 5:32 pm

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Mon Mar 18, 2013 8:08 pm

I have tried this and I got an error in my programme that the library libMonoPosixHelper.so was not found, but it indeed is there.

I had to set in the running environment LD_LIBRARY_PATH=/usr/local/lib

The app then started but with other errors,

Unhandled Exception:
System.InvalidOperationException: Operation is not valid due to the current state of the object
at System.Collections.Queue.Dequeue () [0x00000] in <filename unknown>:0
at dvrptr.myQueue.GetPacket () [0x00000] in <filename unknown>:0
at dvrptr.mainqueuehandler.mqloop () [0x00000] in <filename unknown>:0
at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: Operation is not valid due to the current state of the object
at System.Collections.Queue.Dequeue () [0x00000] in <filename unknown>:0
at dvrptr.myQueue.GetPacket () [0x00000] in <filename unknown>:0
at dvrptr.mainqueuehandler.mqloop () [0x00000] in <filename unknown>:0
at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0


I am not looking for help, but just advising on the environment situation on not correctly finding a library file which is in fact there. I have no idea what filename is being looked for, it is not my application.

Thanks for creating a hardfp version of mono.

Andy

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Mon Mar 18, 2013 8:38 pm

System.InvalidOperationException happens there when a request to de-queue an item is made and no items have been en-queued.

https://github.com/mono/mono/blob/maste ... ue.cs#L174

zhangster
Posts: 5
Joined: Tue Mar 19, 2013 4:14 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Tue Mar 19, 2013 4:17 am

awesome. however.. i noticed that this doesn't come with mono-fastcgi-server. how can i get this version of mono to run with lighttpd?

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Tue Mar 19, 2013 5:57 pm

The following will compile and install XSP (with fast-cgi)

Code: Select all

# Install git if it not already present
sudo apt-get install git-core

# Install automake/autotools
sudo apt-get install automake

# Change to the home folder and clone XSP
cd ~
git clone git://github.com/mono/xsp.git

# Build and install XSP
# Compiling takes a little less than 10 minutes on Pi
cd xsp
./autogen.sh
make
sudo make install
xsp-2.11

Build Environment
Install prefix: /usr/local
Datadir: /usr/local/share
Libdir: /usr/local/lib
Build documentation: yes
Mono 2.0 compiler: /usr/local/bin/gmcs
Mono 4.0 compiler: /usr/local/bin/dmcs
Target frameworks: .NET 2.0, .NET 4.0
Build SQLite samples: yes

zhangster
Posts: 5
Joined: Tue Mar 19, 2013 4:14 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Wed Mar 20, 2013 4:43 am

did't work. :( autogen.sh did not link gmcs/dmcs correctly, even when using --prefix=/usr/local


xsp-2.11

Build Environment
Install prefix: /usr/local
Datadir: /usr/local/share
Libdir: /usr/local/lib
Build documentation: yes
Mono 2.0 compiler: /usr/bin/gmcs
Mono 4.0 compiler: /usr/bin/dmcs
Target frameworks: .NET 2.0, .NET 4.0
Build SQLite samples: yes
pi@raspberrypi ~/xsp $ make
Making all in build
Making all in m4
Making all in man
Making all in src
Making all in Mono.WebServer
GMCS /out:2.0/Mono.WebServer2.dll
Cannot open assembly '/usr/lib/mono/2.0/gmcs.exe': No such file or directory.
make[2]: *** [2.0/Mono.WebServer2.dll] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Wed Mar 20, 2013 4:54 am

I did the above today on a fresh Raspian install and everything worked. Also tested that the XSP (ASP.Net) server functioned properly with the test. The only caveat is that you will have to install libgdiplus as mentioned above.
Cannot open assembly '/usr/lib/mono/2.0/gmcs.exe': No such file or directory.
This probably means you have some remnant of the distro version of mono, so make sure any mono packages are completely uninstalled. The path should be /usr/local/lib/mono/2.0/gmcs.exe.

zhangster
Posts: 5
Joined: Tue Mar 19, 2013 4:14 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Wed Mar 20, 2013 9:24 am

got it working. except now its even slower than the soft float version, although its returning the right numbers :P

Generoso
Posts: 11
Joined: Thu Sep 20, 2012 8:01 pm

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Thu Mar 21, 2013 12:04 am

Thank you very much for this =)
I unpacked the bundle to a fresh raspbian install and worked perfectly. I am using it with my home automation server that could run only under soft float systems till now. So, now, it can also take advantage of chromium browser for local display, since it's UI is web based.

cheers,
g.

3gws
Posts: 49
Joined: Sat Oct 20, 2012 10:32 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Sun Mar 24, 2013 12:35 am

'O.C.O'

I have just got over the worst case of 'Man Flu' my wife has ever seen !!!!!

This separated me from my 'Man Shed' but tonight I finally plucked up the strength and made it into it and I prepared a Brand New 8gb SD Card with Raspbian 09-02-13 and followed your instructions to the 'T'. including the installation of LIBGDIPLUS.

After which I uploaded a few C# Console/Winform apps I had developed for the Soft Float version to the Pi.

I ran a simple Multi-Threading App from the console window and it worked just fine. (Still Running) I then ran STARTX and executed one of my winforms to communicate with an FTP server across my own Internal network and I was surprised to find it finished faster than I thought it would and on further investigation I found it had completed the Task successfully and to celebrate your excellent work I poured my self a Glass of very Fine Irish Single Malt Whiskey of which I am now enjoying.

I am looking forward to starting some serious work on the R-Pi using Classes, MultiThreading and to top it off access to the GPIO using a Library from "David's Blog" libpigpio shared C library.
http://www.codehosting.net/blog/BlogEngine/?tag=/Mono.

I have spent a total of € 75 (R-Pi, SD Card,150N USB Wireless Stick and a 2100mA PSU) on this wonderful piece of Kit , the payback was ages ago but this will be the Icing on the Cake and when I get it working together with the Ultra Cheap Arduino UNO R3 a few Transistors, Relays, LED's and C# with HFP support !!!!!

Once again 'Thank you' for your work on this projectand sharing it with us other 'Mono C#' Fans.

I hope your efforts bring more user of C# to the R-Pi.

Regards

3gws.

bamPi
Posts: 4
Joined: Sun Mar 24, 2013 4:27 pm
Location: Berkshire, England

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Sun Mar 24, 2013 4:43 pm

OtherCrashOverride wrote:Here is an experimental version of Mono 2.11.4 compiled for *HARD FLOAT*:

I have tested it on Rasbian 2013-02-09 from the download page.
Nice job OtherCrashOverride.
I've just tested this on my Arch distro and it works brilliantly.

Code: Select all

$ csharp
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> DateTime.Now
3/24/2013 4:34:51 PM
I've also done a more comprehensive test with an app I'm writing which uses the raspberrypidotnet DLL's and it's working a treat.

Many thanks.

matrixxx
Posts: 1
Joined: Sun Mar 24, 2013 7:08 pm
Location: Nuremberg, germany

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Sun Mar 24, 2013 7:18 pm

bamPi wrote:
OtherCrashOverride wrote:Here is an experimental version of Mono 2.11.4 compiled for *HARD FLOAT*:

I have tested it on Rasbian 2013-02-09 from the download page.
Nice job OtherCrashOverride.
I've just tested this on my Arch distro and it works brilliantly.

Code: Select all

$ csharp
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> DateTime.Now
3/24/2013 4:34:51 PM
I've also done a more comprehensive test with an app I'm writing which uses the raspberrypidotnet DLL's and it's working a treat.

This sounds so great - so i bought my raspberry pi 5min ago :) Hope i can get C# running :) Hey bampi - perhaps you can send me a private msg - or anyone else to help me a little if i have questions... Great to be part of the raspberry pis :)

mike.

3gws
Posts: 49
Joined: Sat Oct 20, 2012 10:32 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Mon Mar 25, 2013 11:41 am

I have just been trying some GDI Plus code and some simple apps have worked, line drawing, eclipses, Rectangles, Hatching.

I tried some blending code but it failed need to investigate further.

Regards

3gws

bamPi
Posts: 4
Joined: Sun Mar 24, 2013 4:27 pm
Location: Berkshire, England

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Fri Mar 29, 2013 9:48 am

matrixxx wrote: This sounds so great - so i bought my raspberry pi 5min ago :) Hope i can get C# running :) Hey bampi - perhaps you can send me a private msg - or anyone else to help me a little if i have questions... Great to be part of the raspberry pis :)

mike.
Hi mike, PM sent.

moelski
Posts: 64
Joined: Wed Jan 09, 2013 8:16 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Sat Apr 06, 2013 5:53 am

Hi !

This sounds to good to be true :)

What should I install before running apply your patch?
Just sudo apt-get install mono ?

Thx for this.
Dominik

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Sat Apr 06, 2013 6:29 am

Its not a patch. Its a complete binary build of mono provided in a tgz file so that other distributions can use it. It is important that you do not have any of your distribution provided mono packages installed as they will conflict.

Xeroxxx
Posts: 3
Joined: Mon Apr 08, 2013 9:07 pm

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Mon Apr 08, 2013 9:09 pm

There seems to be a problem with filewriters and serialization, can't get it to work.

Code: Select all

System.NullReferenceException: Object reference not set to an instance of an object
  at Server.BinaryFileWriter.Write (Double value) [0x00000] in <filename unknown>:0
  at Server.Mobiles.BaseCreature.Serialize (Server.GenericWriter writer) [0x00000] in <filename unknown>:0
  at Server.Engines.MLQuests.Definitions.Aurelia.Serialize (Server.GenericWriter writer) [0x00000] in <filename unknown>:0
  at Server.StandardSaveStrategy.SaveMobiles (Server.SaveMetrics metrics) [0x00000] in <filename unknown>:0
  at Server.StandardSaveStrategy.Save (Server.SaveMetrics metrics, Boolean permitBackgroundWrite) [0x00000] in <filename unknown>:0
  at Server.World.Save (Boolean message, Boolean permitBackgroundWrite) [0x00000] in <filename unknown>:0
  at Server.Misc.AutoSave.Save (Boolean permitBackgroundWrite) [0x00000] in <filename unknown>:0
  at Server.Misc.AutoSave.Save () [0x00000] in <filename unknown>:0
  at Server.Misc.AutoRestart.OnTick () [0x00000] in <filename unknown>:0
  at Server.Timer.Slice () [0x00000] in <filename unknown>:0
  at Server.Core.Main (System.String[] args) [0x00000] in <filename unknown>:0

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: Mono (C#) 2.11.4 hard-float for Raspberry Pi (EXPERIMENT

Mon Apr 08, 2013 10:08 pm

I tested with the following code:

Code: Select all

using System;
using System.IO;

namespace TestFileWriter
{
    class Program
    {
        static void Main(string[] args)
        {
            FileStream fs = File.Create("binary.dat", 2048, FileOptions.None);
            BinaryWriter bw = new BinaryWriter(fs);

            int i = 1234;
            float f = 4567;
            double d = 8901;

            // Write the data
            bw.Write(i);
            bw.Write(f);
            bw.Write(d);

            int i2;
            float f2;
            double d2;

            fs.Position = 0;
            BinaryReader br = new BinaryReader(fs);

            // Read the data back in
            i2 = br.ReadInt32();
            f2 = br.ReadSingle();
            d2 = br.ReadDouble();

           
                       
            fs.Close();


            Console.WriteLine("i={0} i2={1}", i, i2);
            Console.WriteLine("f={0} f2={1}", f, f2);
            Console.WriteLine("d={0} d2={1}", d, d2);

            //Console.ReadLine();
        }
    }
}
produces the following output:
i=1234 i2=1234
f=4567 f2=4567
d=8901 d2=8901
Which shows round trip writing and reading are operating correctly.

Ensure that none of the distribution provided mono packages are installed.

Code: Select all

mono --version
should report 2.11.4.

If you can provide a reproducible test case, I will look further into the issue.

Return to “Other programming languages”