Bug 37388 - Platform detection for Raspbian
Summary: Platform detection for Raspbian
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: Tools (show other bugs)
Version: 4.2.0 (C6)
Hardware: Other Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-01-04 19:51 UTC by Johannes Egger
Modified: 2016-04-21 07:03 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 37388 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Johannes Egger 2016-01-04 19:51:33 UTC
When detecting the platform version for ARM CPU's you check /proc/cpuinfo for a line that starts with "Processor" and then extract the version (see https://github.com/mono/mono/blob/51137702c64076f6f7af9a08c1bafc766f5cf6d2/mono/utils/mono-hwcap-arm.c#L114). On my Raspberry PI that runs OSMC /proc/cpuinfo looks like this:

processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 847.52
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 0010
Serial          : 0000000094e1d959

So it seems that the important line here doesn't start with "Processor" but with "model name".
So Mono obviously thinks that it runs on a different CPU and everytime I run a .NET application I just get "Illegal instruction" and the program exits.

There is a similar issue in nodejs (see https://github.com/nodejs/node/issues/283).
Comment 1 Johannes Egger 2016-01-04 20:09:28 UTC
I've installed mono according to http://www.mono-project.com/docs/getting-started/install/linux/, `apt-cache policy mono-complete` gives me:

mono-complete:
  Installed: 4.2.1.102-0xamarin1
  Candidate: 4.2.1.102-0xamarin1
  Version table:
 *** 4.2.1.102-0xamarin1 0
        500 http://download.mono-project.com/repo/debian/ wheezy/main armhf Packages
        100 /var/lib/dpkg/status
     3.2.8+dfsg-10 0
        500 http://mirrordirector.raspbian.org/raspbian/ jessie/main armhf Packages
Comment 2 Alex Rønne Petersen 2016-01-13 12:26:03 UTC
Do you have the auxv.h header on your system? If so, a relatively simple workaround is to build Mono yourself.

The problem is that we're building our armhf packages on Debian wheezy which doesn't have the header. So Mono gets built to use the /proc/cpuinfo method which is, as you've seen, not very well tested and kinda buggy.

We'll need to have a look at whether we can improve the packaging situation, but there's definitely a bug to be fixed in the code that parses /proc/cpuinfo.
Comment 3 Johannes Egger 2016-01-13 18:17:07 UTC
Thanks for your response.

I installed libc6-dev and now I have auxv.h.
So you mean if auxv.h is available /proc/cpuinfo is not needed and it should work when I build it myself without making any changes to the source code?
Comment 4 Alex Rønne Petersen 2016-01-13 23:58:17 UTC
That's correct. If Mono finds that header at build time, it'll use the getauxval () function from glibc instead of parsing any /proc files.
Comment 5 Johannes Egger 2016-01-16 19:11:04 UTC
Ok thanks for your help. Feel free to close this issue.
Comment 6 Jo Shields 2016-04-21 07:03:21 UTC
Hang on... which model of Pi is this?

SIGILL is correct for our Hard Float packages on Pi 1, which are compiled against a standard Debian armhf profile (i.e. ARMv7) and will not run on an ARMv6 chip