Boris
Boris

Reputation: 8911

Compiling Mono 3.x on Raspberry Pi

To get rid of the soft float vs. hard float ABI problem I tried to install an up-to-date version of mono on my Raspberry Pi with

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

The make command fails. The errors are as follows:

make[6]: gmcs: Command not found
make[6]: *** [build/deps/basic-profile-check.exe] Error 127
*** The compiler 'gmcs' doesn't appear to be usable.
*** You need Mono version 2.4 or better installed to build MCS
*** Check mono README for information on how to bootstrap a Mono installation.
make[5]: *** [do-profile-check] Error 1
make[4]: *** [profile-do--basic--all] Error 2
make[3]: *** [profiles-do--all] Error 2
make[2]: *** [all-local] Error 2
make[2]: Leaving directory `/home/pi/mono/runtime'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/pi/mono'

To fix this I tried to install mono with "sudo apt-get install mono-runtime" and then start the make again. But the error remains.

Is it possible to get Mono 3.x working on ARM (the Raspberry Pi)?

Upvotes: 3

Views: 2962

Answers (2)

tomfanning
tomfanning

Reputation: 9660

To expand on the other answer, I had to do the following to get today's Mono to compile on on today's Raspbian on the original Raspberry Pi:

apt-get install automake libtool build-essential git python

apt-get install mono-runtime # don't think this is necessary due 
                             # to 'make get-monolite-latest'

umount /tmp                  # to allow the process to use the SD card as temp space-
                             # it's too small otherwise. Resets after reboot.

# create a swap file because you run out of RAM and you'll need to swap
dd if=/dev/zero of=/var/swapfile bs=1M count=1024
mkswap /var/swapfile
swapon /var/swapfile
chmod 0600 /var/swapfile

Then:

git clone git://github.com/mono/mono.git
cd mono
./autogen.sh --prefix=/usr/local --enable-nls=no
make get-monolite-latest
make
make install
ldconfig          # apparently necessary.

Delete the swap file after reboot.

Result:

root@pi:~/mono# mono --version
Mono JIT compiler version 4.5.1 (master/5377700 Sat May 28 15:57:46 UTC 2016)
Copyright (C) 2002-2014 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

ref https://neildanson.wordpress.com/2013/12/10/building-mono-on-a-raspberry-pi-hard-float/

Upvotes: 0

knocte
knocte

Reputation: 17919

There are two possible solutions to this:

  1. Compile mono from a tarball, not from git. A tarball is just a compressed package that contains all the sources ready to be compiled in a standalone way. For mono, you can find the tarballs if you go to http://www.go-mono.com/mono-downloads/ and click on the "Mono sources" link, which links to http://download.mono-project.com/sources/mono/. You would need mono 3.2.8 or newer because that is the first version to implement HardFloat support for ARM.
  2. Keep cloning from git, but use make get-monolite-latest command before make. More details here.

Upvotes: 7

Related Questions