在Raspberry Pi上编译Mono 3.x.

时间:2013-12-27 08:19:57

标签: mono makefile arm raspberry-pi raspbian

为了摆脱软浮动与硬浮动ABI问题,我尝试在我的Raspberry Pi上安装最新版本的mono

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

make命令失败。错误如下:

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'

要解决此问题,我尝试使用“sudo apt-get install mono-runtime”安装mono,然后再次启动make。但错误仍然存​​在。

是否可以让Mono 3.x使用ARM(Raspberry Pi)?

2 个答案:

答案 0 :(得分:7)

有两种可能的解决方案:

  1. 从tarball编译mono,而不是从git编译。 tarball只是一个压缩包,包含所有准备以独立方式编译的源代码。对于mono,如果你转到http://www.go-mono.com/mono-downloads/并点击链接到http://download.mono-project.com/sources/mono/的“Mono sources”链接,你可以找到tarball。您需要单声道3.2.8或更高版本,因为这是第一个实现对ARM的HardFloat支持的版本。
  2. 继续克隆git,但在make get-monolite-latest之前使用make命令。更多详情here

答案 1 :(得分:0)

为了扩展另一个答案,我必须做以下事情才能让今天的Mono在今天的原始Raspberry Pi上的Raspbian上编译:

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

然后:

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.

重启后删除交换文件。

结果:

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/