crazysnake
crazysnake

Reputation: 481

compiling mono 3.10.0 on Centos 6.6 fails

I'm trying to compile a mono release 3.10.0 onto a clean Centos server. I'd rather not try the master, looks like it's build is failing every time I look at it.

So I tried to compile mono like this:

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

This is when I got an error about a missing monolite tarball (more info here: https://bugzilla.xamarin.com/show_bug.cgi?id=16687)

So I found a working url (according to previous link it should work with mono 3.10.0) for one so this is how I continued:

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

Anyway, this resulted in error:

/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

So, why "cannot execute binary file" and what can I do about it? I'm running as root so there shouldn't be any permission issues. Also:

# 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

What's wrong here?


EDIT:

Some progress, I was able to achieve a almost-working mono installation. I needed to do the following steps:

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

When cloning a 3.10.0 branch the clone is incomplete, some submodules are missing. You need to run git submodule init and git submodule update to get mono compiling.

These steps had mono compiling and installing without errors, but running .Net software is a whole different matter. I still get exceptions when trying to run my console application:

System.InvalidProgramException: Invalid IL code in System.ComponentModel.Composition.Hosting.DirectoryCatalog:.ctor (string): method body is empty.

Well, the compiling part of the question has been resolved so I guess this can be marked as answered.

Upvotes: 1

Views: 820

Answers (1)

crazysnake
crazysnake

Reputation: 481

Got mono compiling according to my edit in the question. I think I had messed something with either file permissions or the basic.exe had not been there in the first place.

The steps I gave in my edit got my installation working.

Upvotes: 2

Related Questions