This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 7938 - mono doesn't work on hard float abi on ARM
: mono doesn't work on hard float abi on ARM
Status: NEW
Product: Runtime
Classification: Mono
Component: JIT
: unspecified
: Other Linux
: --- normal
: ---
Assigned To: Alex Rønne Petersen
:
:
:
:
  Show dependency treegraph
 
Reported: 2012-10-23 05:33 EDT by Thomas Klose
Modified: 2014-04-24 12:52 EDT (History)
34 users (show)

See Also:
Tags:
Test Case URL:
External Submit: ---


Attachments

Description Thomas Klose 2012-10-23 05:33:37 EDT
Steps to reproduce: Start Mono shell (csharp).

  pi@raspberrypi ~ $ date
  Tue Oct 23 11:31:44 CEST 2012
  pi@raspberrypi ~ $ csharp 
  Mono C# Shell, type "help;" for help

  Enter statements below.
  csharp> DateTime.Now;
  734799/00/0001 11:31:58

(the same occurs in actual (compiled) csharp programs.)

Actual results: invalid year, month, and day is returned

Expected results: current date (2012/10/23) should be returned

Platform:
  Hardware platform: ARM (RaspberryPi)
  Mono Version: 2.10.8.1 (Debian 2.10.8.1-5)  in Raspbian (Wheezy)
  Linux kernel: Linux raspberrypi 3.2.27+ #160 PREEMPT Mon Sep 17 23:18:42 BST
2012 armv6l GNU/Linux

Does not occur on other hardware platforms (x86, x86-64) with same Mono version
Comment 1 Zoltan Varga 2012-11-07 00:19:23 EST
This probably happens because the system is using hardfp, which is not
supported by mono 2.10.

http://liliputing.com/2012/07/raspbian-linux-now-available-for-raspberry-pi-up-to-40-percent-faster-than-debian.html
Comment 2 Thomas Klose 2012-11-07 05:13:22 EST
Yes. We used Raspian which is using hardfp.

I also tried this with standard Debian Wheezy (softfp). Here the problem does
not seem to occur.

Will Mono support hardfp in the future?
Comment 3 Zoltan Varga 2012-11-07 10:46:31 EST
Probably yes, there are some patches here:
https://github.com/directhex/mono-1/commit/3a28afb60e21428dc6a773aaed5153f0dbef4f28
Comment 4 Zoltan Varga 2012-11-07 11:07:46 EST
*** Bug 8250 has been marked as a duplicate of this bug. ***
Comment 5 Zoltan Varga 2012-11-07 11:08:04 EST
*** Bug 7937 has been marked as a duplicate of this bug. ***
Comment 6 Jozef Mlich 2013-04-18 04:40:56 EDT
The bug was reported 6 months ago. Is there any patch or workaround? The test
case seems to be very clear.

I can confirm this problem on OpenSuse 12.3 / armv7hl with mono 3.0.4

Is this bug resolved in 3.0.6 or in git?
Comment 7 Andres G. Aragoneses 2013-04-18 04:47:58 EDT
Jozef: the patch is linked in comment#3. AFAIK it's not going to be included
upstream because of licensing conflicts.
Comment 8 Dylan Borg 2013-08-07 09:18:46 EDT
hard float is becoming the standard arm flavour, its a shame that mono does not
support it.
Comment 9 Andres G. Aragoneses 2013-08-07 09:20:20 EDT
It's coming: http://blog.alexrp.com/
Comment 10 Dylan Borg 2013-08-23 15:46:46 EDT
Thanks, I will test it on my pandaboard (ARM v7a) when it comes out in master.
Comment 11 Dylan Borg 2013-09-02 10:35:45 EDT
development seems to have seized over at alexrp/mono armhf branch.
Comment 12 Ruslan Shakirov 2013-09-18 13:12:02 EDT
+1
We (developers) need armhf version.
Comment 13 Rodrigo Kumpera 2013-09-18 13:40:29 EDT
Just use debian with soft-float or help Alex finishing it.
Comment 14 deus.verus 2013-11-13 09:28:48 EST
+1
This is increasingly an issue with newer ARM devices
Comment 15 kerschl.alexander 2013-11-13 13:43:10 EST
This issue stops us from sharing code between different platforms. We would
like  to use same backend code on smartphones and embedded ARM devices.
Unfortunately most modern devices are delivered with a hard float Image...
Any ideas if we can hope for a fix or should we choose another technology?
Comment 16 Alex Rønne Petersen 2013-11-22 05:59:54 EST
I have resumed work on armhf support lately. Single-precision and
double-precision arguments work, and the runtime seems to run fine on the
various CPU/FPU configurations I've tried.

We still need support for homogeneous floating point aggregates, but this only
matters for P/Invoke when passing structs of pure float/double fields.

Branch is here: https://github.com/alexrp/mono/tree/armhf

Please post on this bug if you run into any issues with it.
Comment 17 Ruslan Shakirov 2013-11-22 16:46:31 EST
Thank you very much! It's great news!
Comment 18 kerschl.alexander 2013-11-23 04:19:30 EST
Thanks a lot!

Just a quick question: Due to P/Invoke limitations, does this mean the current
version is not capable of running winforms or GTK applications?
Comment 19 Alex Rønne Petersen 2013-11-23 12:23:19 EST
I don't know if the lack of HFPA support for P/Invoke affects WinForms or GTK#.
I work on headless boards when doing armhf work, so I can't test.
Comment 20 John Masseria 2013-11-27 18:14:45 EST
Hello, 

Sorry in advance for the newbie question/problem.  

I'm trying to build the branch posted by Alex that supports armhf for my
Raspberry Pi.  I'm using Ubuntu 12.10 as my build machine.  I'm following the
instructions posted at http://www.mono-project.com/Mono:ARM, however I'm using
scratchbox2.

I followed these instructions
http://russelldavis.org/2011/09/07/setting-up-scratchbox2-from-scratch-for-the-raspberry-pi/
for setting up sb2 to build for the Raspberry Pi.  This uses the codesourcery
ARM toolchain.

I get the following errors shown below when building mono inside sb2.

Does anyone have any suggestions or guidance?

Is there an easier way to do this?

  CC     mach_dep.lo
  CCLD   libmonogc.la
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 879: X--tag=CC:
command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 912: libtool:
ignoring unknown tag : command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 879:
X--mode=link: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 1046: ***
Warning: inferring the mode of operation is deprecated.: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 1047: *** Future
versions of Libtool will require --mode=MODE be specified.: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2291: X-g:
command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xallchblk.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328: Xalloc.lo:
command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xblacklst.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xchecksums.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xdbg_mlc.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xdyn_load.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xfinalize.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xgc_dlopen.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xgcj_mlc.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xheaders.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328: Xmalloc.lo:
command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xmallocx.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328: Xmark.lo:
command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xmark_rts.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328: Xmisc.lo:
command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xnew_hblk.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xobj_map.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328: Xos_dep.lo:
command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xpcr_interface.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xptr_chck.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xreal_malloc.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xreclaim.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xsolaris_pthreads.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xsolaris_threads.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xspecific.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xstubborn.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xtypd_mlc.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xbackgraph.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xwin32_threads.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xpthread_support.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xpthread_stop_world.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xdarwin_stop_world.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xopenbsd_stop_world.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2328:
Xmach_dep.lo: command not found
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2460:
Xlibmonogc.la: command not found
ERROR: ld.so: object 'libsb2.so.1' from LD_PRELOAD cannot be preloaded:
ignored.
X: user not authorized to run the X server, aborting.
/home/johnma/RaspberryPi/devel/cross/mono/libgc/libtool: line 2472:
Xlibmonogc.la: command not found
mkdir: cannot create directory `/.libs': Permission denied
make[3]: *** [libmonogc.la] Error 1
make[3]: Leaving directory `/home/johnma/RaspberryPi/devel/cross/mono/libgc'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/johnma/RaspberryPi/devel/cross/mono/libgc'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/johnma/RaspberryPi/devel/cross/mono'
make: *** [all] Error 2

Thank you
Comment 21 Michael Ayvazyan 2013-12-02 11:29:23 EST
I tried to build it directly on a Raspberry Pi running latest available
Raspbian.
It fails with the "hardfp-abi not yet supported" error.
Would you please advise on this?

make[3]: Leaving directory `/home/git/mono/mono/metadata'
Making all in mini
make[3]: Entering directory `/home/git/mono/mono/mini'
if test -d ../../.git; then \
                (cd ../..; \
                        LANG=C; export LANG; \
                        branch=`git branch | grep '^\*' | cut -d ' ' -f 2`; \
                        version=`git log --no-color --first-parent -n1
--pretty=format:%h`; \
                        echo "#define FULL_VERSION \"$branch/$version\""; \
                ); \
        else \
                echo "#define FULL_VERSION \"tarball\""; \
        fi > version.h
  CC     genmdesc-genmdesc.o
In file included from mini-arch.h:21:0,
                 from mini.h:36,
                 from genmdesc.c:9:
mini-arm.h:23:2: error: #error "hardfp-abi not yet supported."
make[3]: *** [genmdesc-genmdesc.o] Error 1
make[3]: Leaving directory `/home/git/mono/mono/mini'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/git/mono/mono'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/git/mono'
make: *** [all] Error 2
Comment 22 Alex Rønne Petersen 2013-12-02 12:37:46 EST
You are not using my armhf branch if you are getting that #error when
compiling.
Comment 23 John Masseria 2013-12-02 15:54:42 EST
Alex,

Are we able to build your version on an armhf Raspberry Pi?

Will the mono package in the Raspbian distribution be able to compile the C#
code in mono?

Or does the mono C# compiler not use any floating point?
Comment 24 Michael Ayvazyan 2013-12-02 15:59:09 EST
Alex,
Thank you very much for the quick response! 
You are right I forget to switch branch :(
Also thank you for making Mono to support hard float!

John,
It's still compiling on Pi. I'll update this thread with results.
Comment 25 Michael Ayvazyan 2013-12-03 12:56:36 EST
It's working on a Raspberry Pi! 
I didn't do much testing yet, but at least basic hello world example is
working.

Unfortunatally I had to use "make -k" to bypass the following error. 
(export CFLAGS="-Wno-error" didn't do the trick)
Any help on this will be very appreciated! :)

CC     test_sgen_qsort-test-sgen-qsort.o
test-sgen-qsort.c: In function Б─≤mainБ─≥:
test-sgen-qsort.c:89:2: error: implicit declaration of function
Б─≤srandomdevБ─≥ [-Werror=implicit-function-declaration]
test-sgen-qsort.c:89:2: warning: nested extern declaration of Б─≤srandomdevБ─≥
[-Wnested-externs]
cc1: some warnings being treated as errors
make[3]: *** [test_sgen_qsort-test-sgen-qsort.o] Error 1
make[3]: Leaving directory `/home/git/mono/mono/metadata'
make[2]: *** [all-recursive] Error 1

After that I ran "make -k install".
I was able to compile & run basic .NET application
Console.WriteLine ("Hello Mono World" + DateTime.Now);

root@raspberrypi:/home/git/testapp# mono -V
Mono Runtime Engine version 3.2.7 (armhf/00c3ee6 Tue Dec  3 02:58:38 UTC 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
Comment 26 Zoltan Varga 2013-12-03 13:00:00 EST
That test-sgen-qsort.c problem should already be fixed.
Comment 27 John Masseria 2013-12-04 16:59:08 EST
FYI, I got this error without the -k (keep going switch on make), just
restarted make with -k ...

  CC     test_gc_memfuncs-test-gc-memfuncs.o
test-gc-memfuncs.c: In function âmainâ:
test-gc-memfuncs.c:50:2: warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
test-gc-memfuncs.c:51:2: error: âforâ loop initial declarations are only
allowed in C99 mode
test-gc-memfuncs.c:51:2: note: use option -std=c99 or -std=gnu99 to compile
your code
test-gc-memfuncs.c:55:2: error: âforâ loop initial declarations are only
allowed in C99 mode
test-gc-memfuncs.c:56:3: error: âforâ loop initial declarations are only
allowed in C99 mode
test-gc-memfuncs.c:68:2: error: âforâ loop initial declarations are only
allowed in C99 mode
test-gc-memfuncs.c:69:3: error: âforâ loop initial declarations are only
allowed in C99 mode
test-gc-memfuncs.c:70:4: error: âforâ loop initial declarations are only
allowed in C99 mode
make[3]: *** [test_gc_memfuncs-test-gc-memfuncs.o] Error 1
make[3]: Leaving directory `/home/johnma/mono/mono/metadata'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/johnma/mono/mono'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/johnma/mono'
make: *** [all] Error 2
Comment 28 Zoltan Varga 2013-12-04 17:24:45 EST
Use master.
Comment 29 John Masseria 2013-12-04 19:57:13 EST
Hi Zoltan,

Sorry for the newbie question, but do you mean:

https://github.com/mono/mono.git

I take it that the armhf patches have been integrated into master?

Thank you again,
John
Comment 30 Zoltan Varga 2013-12-04 20:13:49 EST
Yes.
Comment 31 John Masseria 2013-12-05 09:58:21 EST
Any idea why I would get unknown option "--prefex" from configure when I tried
to perform: ./autogen.sh --prefex=/usr/local

I redid this command without the `--prefix` option.
Comment 32 Alex Rønne Petersen 2013-12-05 10:18:51 EST
--prefex != --prefix
Comment 33 John Masseria 2013-12-05 10:45:16 EST
Ah, duh ... sorry about that ... the "e" key isn't even close to the "i" key!
Comment 34 Peter 2013-12-06 08:08:21 EST
Would it perhaps be possible to explain to a raspberry newbie how to compile
the master branch for hard float support?

What prerequisites? And what actions to take?
Comment 35 Michael Ayvazyan 2013-12-06 08:28:43 EST
Peter,
It needs to run the following commands

git clone https://github.com/mono/mono.git
cd mono
git submodule init
git submodule update
./autogen.sh --prefix=/usr/local
make
make install


If you will see any complains about missing components you may install them
using apt-get.
Consider to run the following command first to refresh apt-get:
apt-get update

For example to install git you would run:
apt-get install git



By the way, I was able to build Alex's armhf branch.

I tried to build master and got the following error:
Microsoft.Build.BuildEngine/ConsoleLogger.cs(293,24): error CS0246: The type or
namespace name `IBuildEngine4' could not be found. Are you missing an assembly
reference?
Compilation failed: 1 error(s), 0 warnings
make[8]: *** [../../class/lib/net_2_0/Microsoft.Build.Engine.dll] Error 1
Comment 36 Zoltan Varga 2013-12-06 08:30:31 EST
Thats already fixed.
Comment 37 Peter 2013-12-06 08:34:10 EST
Thanks Michael,

I will give it a go. What is different when building Alex's branch? Only the
github URL?
Comment 38 Michael Ayvazyan 2013-12-06 08:40:35 EST
Zoltan, 
Thanks a lot! I'll give it a tray.

Peter,
Per Zoltan comment you would use master branch.
If you are still going to use Alex's branch please don't forget to switch the
branch: (cause by default it will be a master branch)
git checkout armhf
Comment 39 Zoltan Varga 2013-12-06 08:54:19 EST
Don't use the armhf branch, use master instead.
Comment 40 Michael Ayvazyan 2013-12-07 09:45:24 EST
Just FYI, it worked on PI.
Thanks!

root@raspberrypi:/home/pi/mono# mono -V
Mono Runtime Engine version 3.2.7 (master/6886a6e Fri Dec  6 17:37:26 UTC 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
Comment 41 Timo Dörr 2013-12-07 09:50:27 EST
I too can confirm: I could build latest git master on my RaspberryPi with
Raspbian. I also tested my software project with this build, and it worked
without any issues (see my blog post on it:
http://exceptionrethrown.wordpress.com/2013/12/07/running-rainy-on-raspbianarm-hf-on-my-raspberry-pi/).

I think this report can be closed. Thanks a lot to all the Xamarin staff making
RPi users happy :)
Comment 42 Torsten Harenberg 2013-12-08 07:10:22 EST
Maybe someone you compiled mono successfully can give me a hint what he did.

On 2 of my Pis I'm here:

if test -w /home/pi/mono/mcs; then :; else chmod -R +w /home/pi/mono/mcs; fi
cd /home/pi/mono/mcs && make --no-print-directory -s NO_DIR_CHECK=1
PROFILES='net_2_0 net_3_5 net_4_0 net_4_5  ' CC='gcc' all-profiles
Bootstrap compiler: Mono C# compiler version 2.10.8.1
./../jay/jay: 7 shift/reduce conflicts.
mkdir -p -- ../class/lib/basic/
MCS     [basic] basic.exe
mkdir -p -- ../../class/lib/basic/tmp/
MCS     [basic] mscorlib.dll
System/BitConverter.cs(45,38): error CS0589: Internal compiler error during
parsing
System/Convert.cs(887,42): error CS0589: Internal compiler error during parsing
System/DateTime.cs(83,60): error CS0589: Internal compiler error during parsing
System/Double.cs(45,69): error CS0589: Internal compiler error during parsing
System/Math.cs(41,61): error CS0589: Internal compiler error during parsing
System/NumberFormatter.cs(72,69): error CS0589: Internal compiler error during
parsing
System/Random.cs(143,47): error CS0589: Internal compiler error during parsing
System/Single.cs(42,53): error CS0589: Internal compiler error during parsing
System.Collections/Hashtable.cs(101,51): error CS0589: Internal compiler error
during parsing
System.Collections/Queue.cs(57,48): error CS0589: Internal compiler error
during parsing
System.Globalization/CalendricalCalculations.cs(48,46): error CS0589: Internal
compiler error during parsing
System.Globalization/CharUnicodeInfo.cs(166,43): error CS0589: Internal
compiler error during parsing
System.Runtime.Remoting.Metadata.W3cXsd2001/SoapDuration.cs(187,96): error
CS0589: Internal compiler error during parsing
Compilation failed: 13 error(s), 0 warnings
make[8]: *** [../../class/lib/basic/tmp/mscorlib.dll] Fehler 1
make[7]: *** [do-all] Fehler 2
make[6]: *** [all-recursive] Fehler 1
make[5]: *** [all-recursive] Fehler 1
make[4]: *** [profile-do--basic--all] Fehler 2
make[3]: *** [profiles-do--all] Fehler 2
make[2]: *** [all-local] Fehler 2
make[2]: Leaving directory `/home/pi/mono/runtime'
make[1]: *** [all-recursive] Fehler 1
make[1]: Leaving directory `/home/pi/mono'
make: *** [all] Fehler 2

What I did:

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

Maybe I missed something..

Thanks!
Comment 43 John Masseria 2013-12-08 10:32:51 EST
I too can confirm that the master version is working on my Raspberry Pi.  I
also built XSP from GIT and it now runs on my Pi with the updated armhf master.

Thank you Xamarin!
Comment 44 Peter 2013-12-08 11:15:16 EST
Torsten,

I am by no means an expert in this area, but I am trying the same as you,
compiling mono from master. It seems, based on your post, that you already have
mono 2.10.8.1 installed. And make uses this version of mono to compile.

However, you seem to need mono 2.4 or higher to compile mono itself.

I do not have mono installed on my raspberry pi yet but tried what the build
manual of mono suggested:

./autogen.sh --prefix=/usr/local
#then
make get-monolite-latest
#then
make

Now mono is compiled with the latest mono lite. And so far I do not see any
errors in the compile process.
a
So perhaps this can help you too :)
Comment 45 Timo Dörr 2013-12-08 11:23:47 EST
I did not use monolite to build form git but rather the mono-gmcs/mono-mcs that
comes with Raspbian, which is version 2.10.8.1. However I did not install
mono-complete, but only the required C# compiler by doing "apt-get install
mono-mcs mono-gmcs". Then checking out the mono git branch and it compiled
successfully.

FYI, the git commit that I checked out and compiled successfully is
e42840fdd9dc9b40d97ccaf91aef55cd2ed2407f.
Comment 46 Torsten Harenberg 2013-12-09 03:27:44 EST
Thanks Timo and Peter,

starting wih Timo's suggestion, I hit the same error again. As I couldn't
believe it, I digged a bit and when removing the (German) environment, builing
worked:

harenber@raspberrypi ~/mono $ echo $LANG
de_DE.UTF-8
harenber@raspberrypi ~/mono $ unset LANG

I have now mono installed (my application still doesn't run due to a missing
libgdiplus, but this is a different story).

I assume this is a different bug/problem, which hit me already > 1 year ago:

https://bugzilla.xamarin.com/show_bug.cgi?id=5358
Comment 47 Peter 2013-12-10 03:59:16 EST
I must admit I never use other languages than the default english language in
development/server environments, Torsten. Mainly to avoid these kind of
problems.

So I would never have guessed this was the problem you are facing :)

Luckily you found the solution and have joined the 'compile mono yourself'
family ;)
Comment 48 den_davy_1 2013-12-10 07:26:44 EST
I am attempting to compile, however I am getting this issue:


Bootstrap compiler: Mono C# compiler version 2.10.8.1
AOT     [build] mcs.exe.so
Cannot open assembly './../../class/lib/build/mcs.exe': File does not contain a
valid CIL image.
MCS     [net_2_0] mscorlib.dll
Cannot open assembly './../../class/lib/build/mcs.exe': File does not contain a
valid CIL image.
make[8]: *** [../../class/lib/net_2_0/tmp/mscorlib.dll] Error 2
make[7]: *** [do-all] Error 2
make[6]: *** [all-recursive] Error 1
make[5]: *** [all-recursive] Error 1
make[4]: *** [profile-do--net_2_0--all] Error 2
make[3]: *** [profiles-do--all] Error 2
make[2]: *** [all-local] Error 2
make[2]: Leaving directory `/home/pi/monoinstall/mono/runtime'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/pi/monoinstall/mono'
make: *** [all] Error 2


I have also attempted this with the monolite, but the same error showed up.
Anybody happens to know the solution to the "File does not contain a valid CIL
image problem?
Comment 49 Thomas Klose 2013-12-11 22:11:06 EST
Michael,

I built the package with your commands:
git clone https://github.com/mono/mono.git
cd mono
git submodule init
git submodule update
./autogen.sh --prefix=/usr/local
make
make install

fixed/installed 3 packages along the way

make or make all did not work
automake ran, but I don't know where to find the mono package.
What are the next steps to install this new mono package?

Thanks
Tom
Comment 50 Peter 2013-12-12 04:00:30 EST
Tom,

I think, with my limited knowlegde, that the last command, make install,
installs the compiled mono into your usr directory.

After I did a make and make install I could run mono:

mono -V

and it shows 

Mono Runtime Engine version 3.2.7 (master/bb44c68 Sat Dec  7 20:08:30 CET 2013)

So there is no next step :)
Comment 51 TomAde 2013-12-22 07:09:53 EST
Thank you Torsten Harenberg for the language suggestion. 

After setting my raspberry-pi to en_US.UTF-8 it finally managed to compile
properly.
Comment 52 Billy Birmingham 2013-12-25 02:37:55 EST
thanks all for this. I got mono compiled on my pi following the steps from
Michael@2013-12-06 08:28:43 EST.

Note the following:

* I needed to install mono for it to compile (is mono like yoghurt? :)
I did an 'apt-get install mono-complete' to get the autogen.sh step (I think it
was that step) to run without error

* I needed these packages:
apt-get install autoconf libtool gettext

* Before 'make install' I removed mono 2.10 via apt-get --purge remove

* 'make install' requires sudo prefix. git commands and make didn't need sudo.
Comment 53 Alex Rønne Petersen 2013-12-25 07:10:32 EST
You can just run 'make get-monolite-latest' before building to get the same
effect as installing Mono on the system via APT.
Comment 54 Thomas Klose 2013-12-30 08:56:10 EST
I succeeded in creating the package and installing. 
mono -V reports Mono 3.2.7.
Mono Runtime Engine version 3.2.7 (master/87e820d Mon Dec 30 00:15:43 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

I am now trying to configure Apache2 to load it
I need to add the following to the apache2.conf file
" Include /etc/apache2/mod_mono.conf" 

However, I can not locate where the mono install put the mod_mono.conf file??
I searched the entire linux system and can not find this file, therefore, I can
not configure the Apache2. 

Where do I find the mod_mono.conf file?
Comment 55 Peter Michael Green 2014-01-01 14:23:55 EST
I maintain a Debian derivative called Raspbian which aims to supply a hard
float system for the raspberry pi (and in principle other armv6 devices but in
practice the Pi is the only armv6 device anyone seems to care about).

Directhex pulled the armhf stuff into the 3.2 packages in debian experimental
and I in turn pulled those packages into raspbian wheezy and jessie.

The new version is MUCH better than what we had before but unfortunately it
seems to crash when using the windows.forms edit box. The original user report
(including a testcase) can be found at
http://www.raspberrypi.org/forum/viewtopic.php?f=66&t=11634&p=478459#p477499

Directhex thinks this may be related to the homogeneous aggregates issue.
Comment 56 Alex Rønne Petersen 2014-01-01 15:15:46 EST
Can you please file a separate bug for that and assign me? I'll have a look.
Comment 57 Peter Michael Green 2014-01-01 15:37:49 EST
I've filed the bug at https://bugzilla.xamarin.com/show_bug.cgi?id=17013 but I
can't seem to assign you.
Comment 58 Dylan Borg 2014-01-02 03:33:14 EST
Managed to compile and run on a Pandaboard ES (ARM v7A). However i had to pass
in SKIP_AOT=true during compilation and installation. AOT seems to be broken as
when an AOT's MCS and mscorlib get used by the makefiles the class libraries
fail to build due to an MCS crash. Without AOT it all went fine.
Comment 59 Alex Rønne Petersen 2014-01-02 03:44:55 EST
Please file a bug with info about the MCS crash. I can't reproduce it here.
Comment 60 Dylan Borg 2014-01-02 04:12:18 EST
make just says an error occurred without mentioning what it was. MCS has no
visible output either. You just see "MCS mscorlib.dll" and then make stops.
Without AOT compilation progresses.
Comment 61 Dylan Borg 2014-01-02 04:13:36 EST
i will retry with the latest code from master and see if it happens again.
Comment 62 Dylan Borg 2014-01-02 04:28:22 EST
It happened again. See bug 17017
Comment 63 Peter Edwards 2014-01-24 04:29:52 EST
FYI:

The latest master as of 62a953f compiles cleanly on an Odroid U3 with:
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug 
        LLVM:          supported, not enabled.
        GC:            sgen

The same textbox issue occurs.
Comment 65 Mauricio 2014-04-23 13:58:54 EDT
I have tried several times to compile mono on a PCDuino v1 with Ubuntu Linaro
Precise 12.07, without success in any of them. I will describe the efforts:

-First cloning directly from git branch master, to the NAND disk onboard.
Insufficient space.
-Using an EXT3 partition on a usb drive with exec permisions, let me clone from
git, but when running (after get monolite-latest) make EXTERNAL_MCS=... starts
compiling but stucks at 


  CC     libmonoruntime_la-object.lo
  CC     libmonoruntime_la-reflection.lo
*** glibc detected *** /usr/lib/gcc/arm-linux-gnueabihf/4.6/cc1: free():
invalid next size (fast): 0x00c44708 ***
reflection.c: In function ‘encode_cattr_value’:
reflection.c:9627:1: internal compiler error: Aborted
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
The bug is not reproducible, so it is likely a hardware or OS problem.
make[3]: *** [libmonoruntime_la-reflection.lo] Error 1
make[3]: Leaving directory `/media/memsd/mono-3.4.0/mono/metadata'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/media/memsd/mono-3.4.0/mono'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/media/memsd/mono-3.4.0'
make: *** [all] Error 2


-From a fresh install of ubuntu, doing it on a SDCard (ext3, exec) , same
result.
-From a fresh install of ubuntu, on an SDCard (ext3, exec) but downloading the
released tarball mono-3.4.0.tar.bz2, then doing tar -xjvf mono-X.XX.tar.bz2; cd
mono-X.XX;./configure --prefix=/usr/local; make    same result, so I am
guessing it is actually a bug.

I appreciate any guidance.
Comment 66 Alex Rønne Petersen 2014-04-23 14:11:33 EDT
You are running into a gcc (or glibc) bug. It's not a bug in Mono.
Comment 67 Mauricio 2014-04-24 12:39:41 EDT
Thanks Alex, yes, something is wrong with gcc but has something to do maybe
with overheating or a failure in the Allwinner A10, i tried to recompile as
suggested by gcc guys, and everything kept compiling well, but it got stucked
again now in this:


MCS     [build] mcs.exe
AOT     [build] mscorlib.dll.so
AOT     [build] mcs.exe.so
MCS     [build] gacutil.exe
MCS     [build] sn.exe
MCS     [build] culevel.exe
CompileUplevel.cs(943,34): warning CS0618:
`System.CodeDom.Compiler.CodeDomProvider.CreateGenerator()' is obsolete:
`ICodeGenerator is obsolete'
Compilation succeeded - 1 warning(s)
mkdir -p -- ../../class/lib/net_2_0/tmp/
MCS     [net_2_0] mscorlib.dll
make[8]: *** [../../class/lib/net_2_0/tmp/mscorlib.dll] Error 1
make[7]: *** [do-all] Error 2
make[6]: *** [all-recursive] Error 1
make[5]: *** [all-recursive] Error 1
make[4]: *** [profile-do--net_2_0--all] Error 2
make[3]: *** [profiles-do--all] Error 2
make[2]: *** [all-local] Error 2
make[2]: Leaving directory `/media/memsd/mono-3.4.0/runtime'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/media/memsd/mono-3.4.0'
make: *** [all] Error 2

I appreciate your guidance.
Comment 68 Alex Rønne Petersen 2014-04-24 12:52:49 EDT
Try doing

    $ echo 2 > /proc/cpu/alignment

and see if that changes anything. If not, you'll probably have to attach GDB to
the mono/mcs process and figure out what's causing it to fail with no output.

Note You need to log in before you can comment on or make changes to this bug.