djkingsley
Posts: 12
Joined: Wed Dec 04, 2013 12:39 pm

Mono 3.2.7 with hard float

Wed Dec 04, 2013 12:59 pm

Yesterday, Alex Petersen checked in the arm hard float support for Mono 3.2.7 to the official Mono git repository. I was able to compile and install Mono 3.2.7 without any issues on a Raspbian system, and as I write this message the unit tests for Mono are nearly complete without error.

This is a big step forward allowing developers to target the .Net 4 and 4.5 runtime engines on the Mono platform.

dkingsley@raspberrypi ~ $ mono --version
Mono Runtime Engine version 3.2.7 (master/1cf4b6f Tue Dec 3 21:09:40 EST 2013)
Copyright (C) 2002-2013 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: normal
Notifications: epoll
Architecture: armel,vfp+hard
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 17565
Joined: Sat Jul 30, 2011 7:41 pm

Re: Mono 3.2.7 with hard float

Wed Dec 04, 2013 1:47 pm

Good news - thanks for the heads up.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

thedo
Posts: 13
Joined: Sun Jan 22, 2012 6:25 pm

Re: Mono 3.2.7 with hard float

Thu Dec 05, 2013 10:38 pm

This is amazing news!!!

zezba9000
Posts: 35
Joined: Wed Jan 16, 2013 2:59 am

Re: Mono 3.2.7 with hard float

Fri Dec 06, 2013 11:06 pm

This is bloody awesome mates!!!
Did you have to cross compile? Or can you compile everything right on the device itself??

deandob
Posts: 12
Joined: Thu Aug 15, 2013 10:44 am

Re: Mono 3.2.7 with hard float

Sat Dec 07, 2013 7:40 pm

Any tips on compiling?

PiPaul
Posts: 4
Joined: Sat Mar 09, 2013 5:53 pm

Re: Mono 3.2.7 with hard float

Sun Dec 08, 2013 10:24 am

Try the instructions on this page:
http://www.mono-project.com/Compiling_Mono_From_Git

zezba9000
Posts: 35
Joined: Wed Jan 16, 2013 2:59 am

Re: Mono 3.2.7 with hard float

Sun Dec 08, 2013 11:01 pm

I was told by Alex you can just compile on the device... which I plan on trying very soon.

It would rock to get Mono part of the main repo now. Or at least plan on it when the next official version of mono that supports it comes out.

djkingsley
Posts: 12
Joined: Wed Dec 04, 2013 12:39 pm

Re: Mono 3.2.7 with hard float

Mon Dec 09, 2013 2:04 pm

I have a pretty well developed script that I use on my work Cluster that I was able to use nearly unmodified to compile Mono from the Git repository. I am building directly on my first generation Pi, it takes about 6 hours. I have it setup as a cron job that runs every night now. If your network does not support the git:// protocol, you will have to let the script fail then cd into the mono directory and modify the .gitmodules file and change the git:// to https:// and in the mono/.git directory the config file and perform the same change.

The script has been included below, and at the bottom I have a portion of my .bashrc file that shows how we adjust the path to run the new mono instead of the one from raspbian.

You will need a approximately 2 GB of flash/disk space for the compile operation.

Edited to fix the script.

Code: Select all

#!/bin/sh

# setup some variables, monodir is where Mono will be installed, topDir is where Mono will be cloned to.
export monodir=`pwd`/mono3.2.7
export topdir=`pwd`

# if gcc48 is not the default gcc set these variables
#export CC=gcc48
#export CXX=g++48
#export CFLAGS="-I$monodir/include -m64"
#export LDFLAGS="-L/$monodir/lib -m64 -L/<gcc48Libs>/lib64"

# libgdi 
cd $topdir

# get and build libgdi first.
git clone http://github.com/mono/libgdiplus.git
cd libgdiplus
./autogen.sh --prefix=$monodir  --enable-shared=yes --with-libgif=$monodir
make 
make install

# git mono sources
cd $topdir

# get clone the mono repo, if ./mono exists this will fail and the git pull will take over.
git clone http://github.com/mono/mono
cd mono
git pull
git checkout master

# on my systems the -Wnone flag is not supported by autotools
# find all the -Wnone macros and remove them
sed -i 's/-Wnone/ /g' ./libgc/autogen.sh
sed -i 's/-Wnone/ /g' ./autogen.sh

echo "Install mono into: $monodir"
echo "TopDir: $topdir"

./autogen.sh --prefix=$monodir --with-sgen=yes --with-large-heap=yes --with-xen_opt=no --enable-parallel-mark --with-libgdiplus=$monodir/lib

# get the mono-lite to perform bootstrap builds
make get-monolite-latest

cd $topdir/mono

# use the following line to use the new boot strap code.
make EXTERNAL_MCS=${PWD}/mcs/class/lib/monolite/gmcs.exe
make
make install
in my .bashrc I have setup paths to find the newly installed Mono

Code: Select all

export MyMonoBin=/home/<username>/mono3.2.7/bin:
export MyMonoLib=/home/<username>/mono3.2.7/lib:
export MyMonoMan=/home/<username>/mono3.2.7/man:

# notice we poke the new mono path in front of the existing path so that the new mono is found first.
export PATH=$MyMonoBin:$PATH

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MyMonoLib
export LD_RUN_PATH=$LD_RUN_PATH:$MyMonoLib
export MANPATH=$MANPATH:$MyMonoMan


zezba9000
Posts: 35
Joined: Wed Jan 16, 2013 2:59 am

Re: Mono 3.2.7 with hard float

Tue Dec 10, 2013 2:07 am

Just did a build, took very long to do(All night).
You can just build normally on the Pi via. "config, make, make install"...

In my benchmark this mono version is consistently faster about 10 sec faster then 2.11.4.
https://github.com/zezba9000/RayTraceBenchmark

djkingsley
Posts: 12
Joined: Wed Dec 04, 2013 12:39 pm

Re: Mono 3.2.7 with hard float

Tue Dec 10, 2013 7:15 pm

zezba9000 wrote:Just did a build, took very long to do(All night).
You can just build normally on the Pi via. "config, make, make install"...

In my benchmark this mono version is consistently faster about 10 sec faster then 2.11.4.
https://github.com/zezba9000/RayTraceBenchmark
"config, make, make install" will do if you have a working mono installed on the system. Otherwise you have to go through the bootstrap process as done in my script. Also, the script I provided installs the newly compiled Mono in the users account and does not over-write the system installed version if it exists.

Most of the performance gains you are seeing are likely related to garbage collection were serious efforts were made by the mono developers early in 3.x.

thedo
Posts: 13
Joined: Sun Jan 22, 2012 6:25 pm

Re: Mono 3.2.7 with hard float

Tue Dec 10, 2013 10:25 pm

*shameless plug*

I managed to build this on a clean raspbian install, but there were a couple of gaps in the install instructions, so I wrote my findings here - http://neildanson.wordpress.com/2013/12 ... ard-float/

Hopefully of use to someone (at least until it gets put in the packages repo :))

tpitman
Posts: 16
Joined: Thu Dec 12, 2013 4:29 pm

Re: Mono 3.2.7 with hard float

Thu Dec 12, 2013 4:32 pm

I successfully built the 3.2.7 source code on the Pi, but am having trouble building the libgdiplus. The error that I get when i run ./autogen.sh --prefix=/usr/local (according to the mono web page) is pkg-config doesn't like glib-2.0. Says it is missing.

So I did sudo apt-get install glib-2.0 and it installed the package. I still get the error, however.

The error message talks about setting up pkg-config, but I can't find a glib-2.0.pc file anywhere on the system. Not sure what apt-get install glib-2.0 installed, but if I run it again it says it is already installed, so I don't know what to do now.

Suggestions?

djkingsley
Posts: 12
Joined: Wed Dec 04, 2013 12:39 pm

Re: Mono 3.2.7 with hard float

Thu Dec 12, 2013 7:00 pm

tpitman wrote:I successfully built the 3.2.7 source code on the Pi, but am having trouble building the libgdiplus. The error that I get when i run ./autogen.sh --prefix=/usr/local (according to the mono web page) is pkg-config doesn't like glib-2.0. Says it is missing.

So I did sudo apt-get install glib-2.0 and it installed the package. I still get the error, however.

The error message talks about setting up pkg-config, but I can't find a glib-2.0.pc file anywhere on the system. Not sure what apt-get install glib-2.0 installed, but if I run it again it says it is already installed, so I don't know what to do now.

Suggestions?
When I run "pkg-config --modversion glib-2.0" I get 2.36.4 and I am able to build libgdiplus. Are you cloning the Git repository for libgdiplus at http://github.com/mono/libgdiplus.git, I had tried with a tar ball of libgdiplus earlier and had trouble.

tpitman
Posts: 16
Joined: Thu Dec 12, 2013 4:29 pm

Re: Mono 3.2.7 with hard float

Thu Dec 12, 2013 7:14 pm

I am cloning from there. I will try it all again from scratch to see what happens.

When I type pkg-config --modversion glib-2.0 I get:

Package glib-2.0 was not found int he pkg-config search path.
Perhaps you should add the directory containing 'glib-2.0.pc' to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found

I search the entire file system and didn't find any glib-2.0.pc file anywhere.

If you look in my original post I also indicated that I had done a sudo apt-get glib-2.0 and it installed. If I do it again I am told it already exists and is the latest version.

djkingsley
Posts: 12
Joined: Wed Dec 04, 2013 12:39 pm

Re: Mono 3.2.7 with hard float

Thu Dec 12, 2013 9:33 pm

The glib-2.0.pc on my machine is found in "/usr/lib/arm-linux-gnueabihf/pkgconfig/glib-2.0.pc", you might want to use the -f option on apt-get. I have never had the need to use it but it sounds like it might work "-f Attempt to correct a system with broken dependencies in place"

tpitman
Posts: 16
Joined: Thu Dec 12, 2013 4:29 pm

Re: Mono 3.2.7 with hard float

Thu Dec 12, 2013 11:10 pm

What command did you use to install glib-2.0 in the first place? I started with a clean install of the latest NOOBS and chose Raspbian.

I tried to build libgdi once right away and got the missing glib-2.0 error.

I then ran sudo apt-get install glib-2.0. It found several things that were already at the latest and then installed 1 more.

I looked in that same folder and have a couple of .pc files, but no glib like yours.

Is it a special pkg-config install for glib that I have to do or is it a apt-get install?

Thanks for your help.

jmn
Posts: 7
Joined: Fri Dec 13, 2013 9:57 am

Re: Mono 3.2.7 with hard float

Fri Dec 13, 2013 10:09 am

Hello
Same config (NOOBS+Raspbian 3.10.23+) and same issue thant tpitman with lidgdiplus
Plus that I haven't gcc48 install on it but only gcc4.7 (and 4.6's the default).

Thx for your help
jmn - Grenoble, France

djkingsley
Posts: 12
Joined: Wed Dec 04, 2013 12:39 pm

Re: Mono 3.2.7 with hard float

Fri Dec 13, 2013 2:14 pm

I started with the very first Raspbian image that was released and updated it ever since, so I have no experience with NOOBs.

Have you installed the dev package for glib-2.0? If you have then I am not sure where to point you to. Building glib from source is a real pain to get all the dependencies correct.

With respect gcc48, I believe its the default: "gcc (Raspbian 4.8.2-1+rpi1) 4.8.2". I usually need to build gcc48 on my other machines I was pleasantly surprised to find it already installed. Gcc47 works fine for the most part, I found Mono ran 5-10% faster when compiled with gcc48 on my other machines.

tpitman
Posts: 16
Joined: Thu Dec 12, 2013 4:29 pm

Re: Mono 3.2.7 with hard float

Fri Dec 13, 2013 2:36 pm

I did a fresh install of the RPi using NOOBS and Raspbian. The gcc version is 4.6.3-14+rpil when I do gcc --version.

tpitman
Posts: 16
Joined: Thu Dec 12, 2013 4:29 pm

Re: Mono 3.2.7 with hard float

Fri Dec 13, 2013 3:25 pm

I figured it out. This is going to show what a noob I am to linus dev.

Turns out I needed to sudo apt-get install libglib2.0-dev (note the -dev). I was poking around and read a post on how when you install libraries often you need to install the -dev version of the library if you are trying to build stuff. Now I know...

I am now running into additional errors. The latest is:

./configure: line 13442: test: too many arguments
configure: error: "Failed to compile with X11/xlib.h include. You must fix your complier paths"

djkingsley
Posts: 12
Joined: Wed Dec 04, 2013 12:39 pm

Re: Mono 3.2.7 with hard float

Fri Dec 13, 2013 3:44 pm

This is the same type of problem, you will need the dev libraries for x11 and several others.

tpitman
Posts: 16
Joined: Thu Dec 12, 2013 4:29 pm

Re: Mono 3.2.7 with hard float

Fri Dec 13, 2013 4:34 pm

I just created a web page on my web site with the details of all the packages you have to install in order to build the libgdiplus stuff for Mono. Here is a link:

http://www.shatalmic.com/raspberry-pi-mono-libgdiplus

tonyhtp
Posts: 2
Joined: Sun Dec 15, 2013 9:27 am

Re: Mono 3.2.7 with hard float

Mon Dec 16, 2013 11:43 am

Tried to get a working Mono on my newly installed Rasperry by running:

git clone https://github.com/mono/mono.git
cd mono
git submodule init
git submodule update
sudo apt-get install mono-complete
sudo apt-get install automake
sudo apt-get install libtool
sudo apt-get install gettext
./autogen.sh --prefix=/usr/local
make
make install

(a couple of hours later it was done...)

Now I was hoping to see an updated version of mono so I run:
mono -V
...but it still shows I'm running 2.10.8.1?!? What am I doing wrong here?

Thanks in advance!
// Tony H

djkingsley
Posts: 12
Joined: Wed Dec 04, 2013 12:39 pm

Re: Mono 3.2.7 with hard float

Mon Dec 16, 2013 3:26 pm

tonyhtp wrote: ./autogen.sh --prefix=/usr/local
make
make install

(a couple of hours later it was done...)

Now I was hoping to see an updated version of mono so I run:
mono -V
...but it still shows I'm running 2.10.8.1?!? What am I doing wrong here?
You need to adjust your path so that the newly installed mono will be found first, and 2 other shell variables. I have a snippet of my .bashrc file at the bottom of this post http://www.raspberrypi.org/forum/viewto ... 63#p466363.

jmn
Posts: 7
Joined: Fri Dec 13, 2013 9:57 am

Re: Mono 3.2.7 with hard float

Mon Dec 16, 2013 9:10 pm

So, on my side, I can run the procedure of djkingsley until the "make EXTERNAL_MCS=${PWD}/mcs/class/lib/monolite/gmcs.exe"
Unfortunately, after 4 hours, I get this:
--------
mkdir -p -- build/deps
make[6]: /home/pi/monobuild/mono/mcs/class/lib/monolite/gmcs.exe : commande introuvable
make[6]: *** [build/deps/basic-profile-check.exe] Erreur 127
*** The compiler '/home/pi/monobuild/mono/mcs/class/lib/monolite/gmcs.exe' doesn't appear to be usable.
*** Trying the 'monolite' directory.
Bootstrap compiler: Mono C# compiler version 3.2.7.0
./../jay/jay: 7 shift/reduce conflicts.
mkdir -p -- ../class/lib/basic/
MCS [basic] basic.exe
warning CS8001: SDK path could not be resolved
Compilation succeeded - 1 warning(s)
mkdir -p -- ../../class/lib/basic/tmp/
MCS [basic] mscorlib.dll
System/BitConverter.cs(45,17): error CS0589: Internal compiler error during parsingSystem.FormatException: Input string was not in the correct format
at System.Double.Parse (System.String s, NumberStyles style, IFormatProvider provider) [0x00000] in <filename unknown>:0
at Mono.CSharp.Tokenizer.adjust_real (TypeCode t, Location loc) [0x00000] in <filename unknown>:0
at Mono.CSharp.Tokenizer.is_number (Int32 c, Boolean dotLead) [0x00000] in <filename unknown>:0
at Mono.CSharp.Tokenizer.xtoken () [0x00000] in <filename unknown>:0
at Mono.CSharp.Tokenizer.token () [0x00000] in <filename unknown>:0
at Mono.CSharp.CSharpParser.yyparse (yyInput yyLex) [0x00000] in <filename unknown>:0
at Mono.CSharp.CSharpParser.parse () [0x00000] in <filename unknown>:0
System/Convert.cs(887,14): error CS0589: Internal compiler error during parsingSystem.FormatException: Input string was not in the correct format
...
----------

Did I forget something? Any idea?
The gmcs.exe is really not in /home/pi/monobuild/mono/mcs/class/lib/monolite.
In this directory, I only have:
basic.exe Mono.Security.dll mscorlib.dll System.Core.dll System.dll System.Xml.dll
jmn - Grenoble, France

Return to “Other languages”

Who is online

Users browsing this forum: No registered users and 7 guests