So we're going to have to build from scratch. Before we start, you will need to:
This article was pulled together from multiple sources - but Brad's post was particularly useful.
Setting up the Prerequisites
We want the latest version of all build components, plus the Extra Packages For Enterprise Linux for which yum is already configured but which is disabled by default. So, edit the repository definition to enable the first EPEL entry (which is the run-time) by entering the following commands:
cd /etc/yum.repos.d sed '0,/^enabled=0/s/enabled=1/' <epel.repo >/tmp/epel.repo sudo cp /tmp/epel.repo .Now we can update all repositories to their latest versions:
sudo yum updateAnd get some build tools that aren't installed by default:
sudo yum install autoconf libtool gettext make automake gcc gcc-c++
Getting the Sources
Install git so that we can download the sources (the git install at time of writing is about 10MB):
sudo yum install gitMake somewhere to download the Mono sources and download them (be cognisant of the size):
mkdir src cd src git clone https://github.com/mono/mono
Compiling the Sources
Build the Mono bootstrapper:
cd mono ./autogen.sh --prefix=/usr/local make get-monolite-latestUse the bootstrapper to build Mono, then install it:
make EXTERNAL_MCS="${PWD}/mcs/class/lib/monolite/basic.exe"
sudo make install
But that's not enough. If you were to return to the source tree and make check you would find that one or two of the tests fail - in particular, one around unhandled exceptions in mscorlib. We can't accept that but at least the newly installed Mono is better than the monolite version. So let's clean up and compile again: this time with our newly built version as the compiler.make clean ./autogen.sh --prefix=/usr/local make sudo make installYou should make check now if you have time, just to prove that the new version is clean.
If you wish to try out your new toy, copy the text below into a file called HelloWorld.cs:
public class HelloWorld {
public static void Main() {
System.Console.WriteLine("Hello World");
}
}
Then compile and execute, by:mcs HelloWorld.c mono HelloWorld.exe
No comments:
Post a Comment