Apostolos\’ Daily Plate

Compiling Mono on OpenSolaris

Posted in OpenSolaris by asyropoulos on Φεβρουαρίου 19, 2010

Compiling mono on OpenSolaris is not a straightforward task so I have decided to explain what one has to do in order to compile it. The «recipe» is based on the following explanation.

https://bugzilla.novell.com/show_bug.cgi?id=353874

In order to build mono I have used gcc-4.3.2, which is part of package developer/gcc/gcc-432. First of all, one needs to build  libgdiplus-x.y. After uncompressing the source code, enter the following  commands to build this library.:

CC=gcc-4.3.2 ./configure --prefix=/opt/mono
make


If you prefer a different installation folder, you should use this alternative folder in the --prefix=
Now download and uncompress mono-2.x.y.tar.bz2 Inside the source tree create a file which must contain the following:

ulimit -Hs $((10*1024))
#
prctl -s -t basic -n process.max-stack-size -v 8MB $$
prctl -s -t privileged -n process.max-stack-size -v 128MB $$
#
CC=gcc-4.3.2 CXX=g++-4.3.2 CFLAGS="-I/opt/mono/include" \
LDFLAGS="-L/opt/mono/lib -R/opt/mono" \
./configure --prefix=/opt/mono  --with-jit=yes \
--with-large-heap=yes --with-tls=pthread
#
gmake

Then execute this script and it will build mono.  In the installation phase it might be necessary to create a similar script. Next we need to build mono-basic-x.y.tar.bz2. As in the previous case, download and uncompress the source and inside the source tree create another script that will contain the following lines:

ulimit -Hs $((10*1024))
#
prctl -s -t basic -n process.max-stack-size -v 8MB $$
prctl -s -t privileged -n process.max-stack-size -v 128MB $$
PATH=/opt/mono/bin:$PATH
CC=gcc-4.3.2 CXX=g++-4.3.2 CFLAGS="-I/opt/mono/include" \
LDFLAGS="-L/opt/mono/lib -R/opt/mono/lib" ./configure --prefix=/opt/mono-2.6.1
#
gmake

One should be able to build gnome-sharp-x.y.z, gtk-sharp-x.y.z, and gnome-desktop-sharp-x.y.z. with similar scripts. That’s all.

The latest version of mono (i.e., version 2.10.1) compiles far more easily than the previous versions. I have managed to produce binaries for the i386-pc-solaris2.11 and   x86_64-pc-solaris2.11 platforms with essentially the same recipe. First of all, download the Boehm-Demers-Weiser conservative garbage collector and installed in the folder where you will install mono (e.g., /opt/mono). Then make sure you have the various binaries from the GNU-tool-chain. For the i386-pc-solaris2.11 platform you can used the following command to configure compilation:

CFLAGS="-I/opt/mono-2.10.1/include" \
LDFLAGS="-L/opt/mono/lib -R/opt/mono/lib" \
./configure   --prefix=/opt/mono --disable-dtrace \
--with-gc=boehm --with-sigaltstack=no

When configuration finishes, you need to edit file mono/profiler/Makefile. In particular, you need to modify the -D_FILE_OFFSET_BITS=64 preprocessor flag (see the CPPFLAGS section) and make it -D_FILE_OFFSET_BITS=32. Now, you can build mono. For the x86_64-pc-solaris2.11 you can used the following command:

CC=x86_64-pc-solaris2.11-gcc CXX=x86_64-pc-solaris2.11-g++  \
CFLAGS="-I/opt/mono/include" LDFLAGS="-m64 -L/opt/mono/lib -R/opt/mono/lib" \
./configure --with-gc=boehm --prefix=/opt/mono --disable-dtrace --with-sigaltstack=no

Here x86_64-pc-solaris2.11-gcc and x86_64-pc-solaris2.11-g++ are scripts that call the correspodning compiler in 64-bit more. For example, the contents of x86_64-pc-solaris2.11-gcc follow:

#! /bin/bash
exec /usr/bin/gcc -m64 "$@"

Building the other components is very easy! In fact, I have compiled pinta and the following scree-shot shows how it works in my system.

Advertisements

Σχολιάστε

Εισάγετε τα παρακάτω στοιχεία ή επιλέξτε ένα εικονίδιο για να συνδεθείτε:

Λογότυπο WordPress.com

Σχολιάζετε χρησιμοποιώντας τον λογαριασμό WordPress.com. Αποσύνδεση / Αλλαγή )

Φωτογραφία Twitter

Σχολιάζετε χρησιμοποιώντας τον λογαριασμό Twitter. Αποσύνδεση / Αλλαγή )

Φωτογραφία Facebook

Σχολιάζετε χρησιμοποιώντας τον λογαριασμό Facebook. Αποσύνδεση / Αλλαγή )

Φωτογραφία Google+

Σχολιάζετε χρησιμοποιώντας τον λογαριασμό Google+. Αποσύνδεση / Αλλαγή )

Σύνδεση με %s

Αρέσει σε %d bloggers: