我正在尝试将单声道版本 3.10.0 编译到干净的 Centos 服务器上。我宁愿不尝试大师,每次看它时,看起来它的构建都失败了。
所以我尝试像这样编译单声道:
wget https://github.com/mono/mono/archive/mono-3.10.0.tar.gz
tar xvfz mono-3.10.0.tar.gz
cd mono-mono-3.10.0/
./autogen.sh
make get-monolite-latest
这是我收到有关缺少单体压缩包的错误(更多信息在这里:https://bugzilla.xamarin.com/show_bug.cgi?id=16687)
所以我找到了一个工作网址(根据上一个链接,它应该适用于单声道 3.10.0),所以我继续这样做:
make get-monolite-latest monolite_url=http://storage.bos.xamarin.com/mono-dist-master/1b/1b41fd76350367453c8100f8bd0e7242105c6d39/monolite-111-latest.tar.gz
make EXTERNAL_MCS=${PWD}/mcs/class/lib/monolite/basic.exe
无论如何,这导致了错误:
/usr/local/src/mono-mono-3.10.0/mcs/class/lib/monolite/basic.exe: /usr/local/src/mono-mono-3.10.0/mcs/class/lib/monolite/basic.exe: cannot execute binary file
make[6]: *** [build/deps/basic-profile-check.exe] Error 126
*** The compiler '/usr/local/src/mono-mono-3.10.0/mcs/class/lib/monolite/basic.exe' doesn't appear to be usable.
*** Trying the 'monolite' directory.
Bootstrap compiler: Mono C# compiler version 3.6.1.0
./../jay/jay: 7 shift/reduce conflicts.
mkdir -p -- ../class/lib/basic/
make[7]: *** No rule to make target `../../external/ikvm/reflect/*.cs', needed by `../class/lib/basic/basic.exe'. Stop.
make[6]: *** [do-all] Error 2
make[5]: *** [all-recursive] 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 `/usr/local/src/mono-mono-3.10.0/runtime'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/mono-mono-3.10.0'
make: *** [all] Error 2
那么,为什么"无法执行二进制文件",我该怎么办?我以 root 身份运行,所以应该没有任何权限问题。也:
# ls -la /usr/local/src/mono-mono-3.10.0/mcs/class/lib/monolite/
total 8048
drwxr-xr-x 2 root root 4096 Jun 2 2014 .
drwxr-xr-x 3 root root 4096 Jan 9 16:21 ..
-rwxr-xr-x 1 root root 298496 Jun 2 2014 Mono.Security.dll
-rwxr-xr-x 1 root root 126464 Jun 2 2014 System.Configuration.dll
-rwxr-xr-x 1 root root 283136 Jun 2 2014 System.Core.dll
-rwxr-xr-x 1 root root 131072 Jun 2 2014 System.Security.dll
-rwxr-xr-x 1 root root 1291264 Jun 2 2014 System.Xml.dll
-rwxr-xr-x 1 root root 1681408 Jun 2 2014 System.dll
-rwxr-xr-x 1 root root 1743360 Jun 2 2014 basic.exe
-rwxr-xr-x 1 root root 2631168 Jun 2 2014 mscorlib.dll
这是怎么回事?
编辑:
取得了一些进展,我能够实现几乎可以工作的单声道安装。我需要执行以下步骤:
git clone -b mono-3.10.0-branch https://github.com/mono/mono.git
git submodule init
git submodule update
./autogen.sh --with-ikvm-native=no
make get-monolite-latest monolite_url=http://storage.bos.xamarin.com/mono-dist-master/1b/1b41fd76350367453c8100f8bd0e7242105c6d39/monolite-111-latest.tar.gz
make EXTERNAL_MCS=${PWD}/mcs/class/lib/monolite/basic.exe
克隆 3.10.0 分支时,克隆不完整,缺少一些子模块。你需要运行 git 子模块 init 和 git 子模块更新来获得单声道编译。
这些步骤具有单声道编译和安装而没有错误,但运行 .Net 软件是完全不同的事情。尝试运行控制台应用程序时仍然遇到异常:
System.InvalidProgramException: Invalid IL code in System.ComponentModel.Composition.Hosting.DirectoryCatalog:.ctor (string): method body is empty.
好吧,问题的编译部分已经解决,所以我想这可以标记为已回答。
我在问题中的编辑进行了单声道编译。我想我在文件权限或基本权限方面搞砸了一些东西.exe一开始就不在那里。
我在编辑中给出的步骤使我的安装正常工作。