Raspbian vs Wheezy (beta) Mono support


213 posts   Page 2 of 9   1, 2, 3, 4, 5 ... 9
by ProjectMayu » Fri Jul 20, 2012 5:04 pm
does apt-get save a log some where?
Posts: 17
Joined: Sun Jul 01, 2012 8:58 am
by mpthompson » Sat Jul 21, 2012 1:19 am
OK, I reported this bug occurring in Debian Wheezy armhf upstream to Debian. It can be viewed and tracked at the following URL:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=682284

This is about as far as I can push this issue. Hopefully a future update of Mono will fix this issue and we can pull it into Raspbian.
User avatar
Forum Moderator
Forum Moderator
Posts: 620
Joined: Fri Feb 03, 2012 7:18 pm
Location: San Carlos, CA
by ProjectMayu » Sat Jul 21, 2012 4:59 am
How come Mono works fine in Debian Wheezy beta, but not in Raspbian Wheezy beta?
What are all the differences between the two? Is there some where we can look-up the changes?
Posts: 17
Joined: Sun Jul 01, 2012 8:58 am
by jui-feng » Sat Jul 21, 2012 8:37 am
ProjectMayu wrote:How come Mono works fine in Debian Wheezy beta, but not in Raspbian Wheezy beta?


As I understand it, Raspbian uses a different "calling convention", so floating point numbers are "transferred" on the CPU in a different way. All compilers must create machine code that uses the Raspbian calling convention.
It's no problem for software compiled with GCC, as it is configured to use that calling convention by default.

However, when using less common compilers (like the mono CLI -> machine code just-in-time compiler), things are not quite working yet.
The mono JIT compiler apparently uses the old calling convention for everything it compiles, because no one has implemented the new calling convention in mono yet. That's fine as long as the mono code doesn't call into some non-mono code, but breaks as soon as you use a native library.

The details in this are probably wrong, but maybe it describes the problem in general. :mrgreen:

Edit: And just to make this clear, the "Raspbian calling convention" is nothing specially created for raspbian. It's the same as in debian armhf and (I think) any other linux that uses armhf.
Posts: 57
Joined: Sun Mar 04, 2012 11:02 am
by mpthompson » Sat Jul 21, 2012 8:01 pm
ProjectMayu wrote:How come Mono works fine in Debian Wheezy beta, but not in Raspbian Wheezy beta?


A more accurate question would be: "How come Mono works fine in Debian Wheezy armel (soft float ABI), but not in Debian Wheezy armhf (hard float ABI)?"

As jui-feng indicates, this is primarily an issue with the way that floating point values are passed between function within code using the hard float ABI. Basically, Mono doesn't support this mechanism, although hacks have been implemented that gets things partially working. Fully resolving this still seems to be an issue within the Debian community.

The following chain of emails explains the issues in further detail as of earlier this year, and it doesn't seem that it's been fully resolved yet:

https://groups.google.com/forum/#!topic ... O2Fc0TfGXw
User avatar
Forum Moderator
Forum Moderator
Posts: 620
Joined: Fri Feb 03, 2012 7:18 pm
Location: San Carlos, CA
by jools » Sun Jul 22, 2012 6:27 am
Possibly for the same reasons (?) as put here I can't compile mono on Raspbian. (I was able to do this flawlessly on Squeezy):-


sudo ./configure --prefix=/usr/local ; sudo make ; sudo make install
goes fine until make then ............

ake[6]: Entering directory `/home/pi/mono-2.10.6/mcs/mcs'
Makefile:53: warning: overriding commands for target `csproj-local'
../build/executable.make:134: warning: ignoring old commands for target `csproj-local'
Makefile:65: warning: overriding commands for target `install-local'
../build/executable.make:44: warning: ignoring old commands for target `install-local'
MCS [basic] mcs.exe
/bin/sh: 1: gmcs: not found
make[6]: *** [../class/lib/basic/mcs.exe] Error 127
make[6]: Leaving directory `/home/pi/mono-2.10.6/mcs/mcs'
make[5]: *** [do-install] Error 2
make[5]: Leaving directory `/home/pi/mono-2.10.6/mcs/mcs'
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory `/home/pi/mono-2.10.6/mcs'
make[3]: *** [profile-do--basic--install] Error 2
make[3]: Leaving directory `/home/pi/mono-2.10.6/mcs'
make[2]: *** [profiles-do--install] Error 2
make[2]: Leaving directory `/home/pi/mono-2.10.6/mcs'
make[1]: *** [install-exec] Error 2
make[1]: Leaving directory `/home/pi/mono-2.10.6/runtime'
make: *** [install-recursive] Error 1


pi@raspberrypi ~/mono-2.10.6 $
Posts: 24
Joined: Sun Feb 19, 2012 9:47 pm
by tim124 » Tue Jul 31, 2012 8:54 pm
I suppose this is just waiting on somebody who knows mono well enough to have a look?
Posts: 9
Joined: Mon Feb 20, 2012 1:30 am
by emg » Tue Jul 31, 2012 10:09 pm
Looks that way...
Posts: 88
Joined: Wed Jan 11, 2012 11:01 pm
by MikeTylerJr » Thu Aug 02, 2012 7:36 pm
Add me to the list of very interested parties, hoping for a fix sooner rather than later :)
Posts: 2
Joined: Thu Aug 02, 2012 7:35 pm
by piglet138 » Sun Aug 05, 2012 6:36 pm
I think I am running into the same issue. I came across the problem with the following sample program:
Code: Select all
static void Main(string[] args)
{
    Console.WriteLine("Floor(1.5): " + System.Math.Floor(1.5));
}

The output for me is always:
Code: Select all
Floor(1.5): 0

The floor function maps to native code with:
Code: Select all
[MethodImplAttribute (MethodImplOptions.InternalCall)]
public extern static double Floor (double d);

and is implemented in sysmath.c as
Code: Select all
gdouble ves_icall_System_Math_Floor (gdouble x) {
   MONO_ARCH_SAVE_REGS;
   return floor(x);
}

The floor function in a sample program in C works fine, so I can only concur, that the issue seems to with the boundary between the .net code and native code.
Posts: 1
Joined: Sun Aug 05, 2012 6:22 pm
by amigarulez » Mon Aug 13, 2012 12:47 pm
mpthompson wrote:OK, I reported this bug occurring in Debian Wheezy armhf upstream to Debian. It can be viewed and tracked at the following URL:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=682284

This is about as far as I can push this issue. Hopefully a future update of Mono will fix this issue and we can pull it into Raspbian.

Any one reported to Xamarin?
https://bugzilla.xamarin.com

Perhaps similar issue that this guy is having:
https://bugzilla.xamarin.com/show_bug.cgi?id=5358
Posts: 42
Joined: Wed Jul 18, 2012 10:16 am
by MikeTylerJr » Mon Aug 13, 2012 11:17 pm
Does anyone know if any progress is being made on the mono bug? Anyone working on it at all?

Im going to need to switch over to Arch pretty soon, I think.
Posts: 2
Joined: Thu Aug 02, 2012 7:35 pm
by mpthompson » Wed Aug 15, 2012 6:21 am
As far as I'm aware, the issue requires a fix to Mono upstream in Debian Wheezy armhf. Does anyone know if this issue has been fixed in Debian Wheezy armhf? If so, I can pull down the sources and attempt a build for Raspbian and see how it turns out.

Also, does Arch have a working version of Mono for hard float? If so, we can look go see how the issue was fixed there and see if the patches can be applied to the build in our repository.
User avatar
Forum Moderator
Forum Moderator
Posts: 620
Joined: Fri Feb 03, 2012 7:18 pm
Location: San Carlos, CA
by amigarulez » Wed Aug 15, 2012 10:07 am
mpthompson wrote:Also, does Arch have a working version of Mono for hard float? If so, we can look go see how the issue was fixed there and see if the patches can be applied to the build in our repository.
No.
But perhaps Xamarin has some fixes 2.11.4 is the latest mono build from them.
Probably only Arm7 focus.
Posts: 42
Joined: Wed Jul 18, 2012 10:16 am
by mpthompson » Wed Aug 15, 2012 6:03 pm
amigarulez wrote:Probably only Arm7 focus.


As expected. That seems to be the biggest problem with armhf packages that aren't yet ported to Raspbian, particularly the ones with VMs. The ports are using armv7 specific code which is very often to difficult to work around unless you are intimately familiar with the software and ARM assembly code.
User avatar
Forum Moderator
Forum Moderator
Posts: 620
Joined: Fri Feb 03, 2012 7:18 pm
Location: San Carlos, CA
by amigarulez » Wed Aug 15, 2012 7:07 pm
Tweeted a little with Miguel de Icaza at Xamarin main contributor/maintainer of mono.

Has anyone reported a bug to:
http://bugzilla.xamarin.com/
?
Posts: 42
Joined: Wed Jul 18, 2012 10:16 am
by tim124 » Tue Aug 21, 2012 9:59 am
This is the only similar looking bug:
https://bugzilla.xamarin.com/show_bug.cgi?id=5358
Posts: 9
Joined: Mon Feb 20, 2012 1:30 am
by EdwinJ85 » Wed Aug 22, 2012 10:48 pm
Oh poo, I was wondering why I was getting a SIGSEGV error when trying to run my win forms apply in mono. This is pretty crushing, I guess I can no longer use Raspian but I'm too much of a noob for arch - is the older debian build for the pi still available?
Getting doom to run is my "Hello World".
Posts: 208
Joined: Wed Feb 01, 2012 4:44 pm
by tim124 » Wed Aug 22, 2012 11:42 pm
This appears to be a know issue requiring somebody to help:
https://groups.google.com/forum/#!topic ... O2Fc0TfGXw
Posts: 9
Joined: Mon Feb 20, 2012 1:30 am
by EdwinJ85 » Thu Aug 23, 2012 8:20 am
Damn. I don't know nearly enough about native code or mono to help with this one, I was using mono as a quick way to try to make a desktop app for the pi! I hear Java won't work either for the same reason (on raspbian, I think the old debian soft float may work)

Is there a fund to donate to to get this issue resolved? I'm a bit of a c# zealot and I really want the mono platform to have a future on the pi. If I can't help with skill maybe I can help in another way.
Getting doom to run is my "Hello World".
Posts: 208
Joined: Wed Feb 01, 2012 4:44 pm
by plugwash » Thu Aug 23, 2012 12:42 pm
Openjdk-6 will work on raspbian, it's just not very fast as it's running in interpreted mode. I haven't seen any reports on openjdk-7 yet.

Oracle are talking about a raspbian release of their own JRE but we don't have an ETA from them.
Forum Moderator
Forum Moderator
Posts: 2271
Joined: Wed Dec 28, 2011 11:45 pm
by tim124 » Thu Aug 23, 2012 12:52 pm
I thought about downloading the mono source, setting up a cross compiler and having a look at the issue and then I found the Google group discussion and realised that I'd be well out of my depth!
Posts: 9
Joined: Mon Feb 20, 2012 1:30 am
by mpthompson » Thu Aug 23, 2012 4:59 pm
EdwinJ85 wrote:Is there a fund to donate to to get this issue resolved? I'm a bit of a c# zealot and I really want the mono platform to have a future on the pi. If I can't help with skill maybe I can help in another way.


A C# zealot such as yourself sounds like just the person to keep track what the issues preventing a working mono on Raspbian and help work towards a mono solution for the broader Raspbian community.

I think the best bet would be to investigate and assist any efforts to get a fully working mono port on Debian Wheezy armhf. The Debian community is very broad and must have some very sharp mono developers who would be interested in seeing the mono work correctly on Debian armhf. Once that work is done hopefully the delta to a working Raspbian armv6 version wouldn't be too great. Who ever does the work for Debian armhf would hopefully be able to isolate the differences between an armv6+vfp and armv7+vfp3 CPU that the VM would have to account for.
User avatar
Forum Moderator
Forum Moderator
Posts: 620
Joined: Fri Feb 03, 2012 7:18 pm
Location: San Carlos, CA
by EdwinJ85 » Fri Aug 24, 2012 1:12 pm
I'm not sure how much I can do, but I will do my best. I've already publicly tweeting the Xamarin team about the issue but I'm not authorised to comment on the google groups case - I'm not a registered mono developer and to be honest, I'm not qualified enough to help there anyway. I know what low level/machine code is and even how to make it do a hello world but outside of that, I'm entirely a managed coder.

Good news on Oracle though, if they are giving us support maybe we can spur Xamarin into doing the same and make their rivalry reap us our own benefits!

Is the mono interpreter working yet? I've just installed debian to get around this issue so I can't test it on raspbian myself, but that could at least help non GUI applications if it were to work.
Getting doom to run is my "Hello World".
Posts: 208
Joined: Wed Feb 01, 2012 4:44 pm
by plugwash » Fri Aug 24, 2012 2:04 pm
AIUI the interpreter itself works but it doesn't know how to correctly pass floating point parameters to native code. So anything that tries to do that breaks horriblly.

Fixing this probablly isn't too difficult for someone who knows mono internals. It's a matter of finding someone who knows mono internals and is prepared to do the work.
Forum Moderator
Forum Moderator
Posts: 2271
Joined: Wed Dec 28, 2011 11:45 pm