Richy1989
Richy1989

Reputation: 97

Build Mono on Raspberry Pi 3

I try desperately to build Mono on a Raspberry Pi 3. I installed Mono from the Repo first. Then I tried to build the newest tarball or the git master. Neither worked.

I always end up with this message:

make install-local
make[7]: Entering directory '/home/pi/mono-5.9.0.415/mcs/class/corlib'
CSC     [basic] mscorlib.dll
/home/pi/mono-5.9.0.415/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs(5918,45): error CS0246: The type or namespace name 'Task<>' could not be found (are you missing a using directive or an assembly reference?)
/home/pi/mono-5.9.0.415/external/corefx/src/System.Memory/src/System/ReadOnlySpan.cs(85,42): warning CS3001: Argument type 'void*' is not CLS-compliant
/home/pi/mono-5.9.0.415/external/corefx/src/System.Memory/src/System/Span.cs(90,34): warning CS3001: Argument type 'void*' is not CLS-compliant
../../build/library.make:329: recipe for target '../../class/lib/basic/mscorlib.dll' failed
make[7]: *** [../../class/lib/basic/mscorlib.dll] Error 1
make[7]: Leaving directory '/home/pi/mono-5.9.0.415/mcs/class/corlib'
../../build/rules.make:211: recipe for target 'do-install' failed
make[6]: *** [do-install] Error 2
make[6]: Leaving directory '/home/pi/mono-5.9.0.415/mcs/class/corlib'
../build/rules.make:232: recipe for target 'install-recursive' failed
make[5]: *** [install-recursive] Error 1
make[5]: Leaving directory '/home/pi/mono-5.9.0.415/mcs/class'
build/rules.make:232: recipe for target 'install-recursive' failed
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory '/home/pi/mono-5.9.0.415/mcs'
Makefile:54: recipe for target 'profile-do--basic--install' failed
make[3]: *** [profile-do--basic--install] Error 2
make[3]: Leaving directory '/home/pi/mono-5.9.0.415/mcs'
Makefile:50: recipe for target 'profiles-do--install' failed
make[2]: *** [profiles-do--install] Error 2
make[2]: Leaving directory '/home/pi/mono-5.9.0.415/mcs'
Makefile:600: recipe for target 'install-exec' failed
make[1]: *** [install-exec] Error 2
make[1]: Leaving directory '/home/pi/mono-5.9.0.415/runtime'
Makefile:541: recipe for target 'install-recursive' failed
make: *** [install-recursive] Error 1

This is the Script I used for the Tarball build:

PREFIX=/home/pi/.myMono
VERSION=5.9.0.415
tar xvf mono-$VERSION.tar.bz2
cd mono-$VERSION
./configure --prefix=$PREFIX
make
make install

Does anyone have the same problem? Or some suggestions how to make it build correctly?

Upvotes: 0

Views: 976

Answers (1)

omahena
omahena

Reputation: 808

Since it isn't clear if the question is particularly about getting mono version 5.9.0.415 running on Raspberry Pi 3 or mono in general, I will presume that the question is about mono in general.

From my experience there appears to be a compatibility issue with mono 5 and the armv7l platform (armv7l-unknown-linux-gnueabihf).

I have tried to build the following mono release packages:

  • 5.0.0.100
  • 5.0.1.1
  • 5.2.0.104
  • 5.2.0.224
  • 5.9.0.398
  • 5.9.0.415

Compilation fails at the point where build process tires to use the generated csc binary. There appears to be a NullPointerException in the compile section somewhere in a call made from CompileMethodBodies.

The problem first appears in Mono 5 with the introduction of Roslyn. The good news is that mono release 4.8.1 is not affected by the new Roslyn code and will compile and run without significant issues on Raspberry Pi 3.

You can compile mono like this:

wget https://download.mono-project.com/sources/mono/mono-4.8.1.0.tar.bz2
tar xvf mono-4.8.1.0.tar.bz2
cd mono-4.8.1.0
./configure --prefix=/home/pi/.myMono
make
make install

Additionally it is worth mentioning that if you wish to take advantage of all the 4 CPU cores during mono compile on your Raspberry Pi 3, you can do so by starting make like this: make -j4. This will cut down the compile time significantly.

And if you wish to skip the generation of libmono you can do so by configuring the build with the --disable-libraries parameter: ./configure --disable-libraries --prefix=/home/pi/.myMono. But as you will need the libraries to run any application... This will only help with consecutive rebuilds of the mono runtime only (once you have already once installed the monolib).

What I noticed, but wasn't able to verify is that there may be some mono 5 packages for Raspberry Pi 3 out there after all. This post claims there is a 5.2 package available for download. As does the mono download page.

As a side note I would like to mention that installation of mono into /home/pi/.myMono may be a bad choice. But I guess it should still work... A more classical approach would be the /usr/local or the /opt folders. Here are some thoughts on these alternate locations.

Upvotes: 3

Related Questions