[Mono-dev] Building Mono on Solaris 10

Elamide timothy.l.smith at accenture.com
Mon Aug 3 12:35:37 EDT 2009


I was asked for a HowTo and a new thread seemed best...

This has worked for Mono version 2.0.1 with 1 failure during the check
phase.

Mono versions 2.4.2.2 and 2.4.2.3 both fail to complete the check phase but
they install and start my multithreaded application.

I have not been to get a clean build of the SVN head but I'm still trying.

The server I use is a Solaris Zone:

bash-4.0# uname -a
SunOS psdmmfs099 5.10 Generic_127111-08 sun4v sparc SUNW,Sun-Fire-T200
Solaris

Sources used to develop this recipe:
http://www.opensubscriber.com/message/mono-list@lists.ximian.com/11142201.html
http://galactus.ximian.com/pipermail/mono-list/2009-January/040860.html
http://developer.mindtouch.com/User:Yasuaki/Mono/Mono-2.0_installation_guide_for_SPARC_Solaris_10
http://lists.ximian.com/pipermail/mono-list/2007-January/034101.html
http://go-mono.com/forums/#nabble-td22587130|a22587130

--------

Get root access to a Sparc Solaris 10 server that has not had any Sun
development tools loaded. All of this was done as root since I needed to
install packages as the process failed and I need to build a mono package at
the end of it. I didn't have the X11 development libraries added so I had to
build those dependencies myself, it may work with the standard X11 dev
libraries.

I use a directory called mono_build as the root directory for all of my mono
building.

Install the following SUN packages:
system      SUNWlibm  Math & Microtasking Library Headers & Lint Files (Usr)
system      SUNWlibmr Math Library Lint Files (Root)
system      SUNWtoo   Programming Tools

Install the following packages from sunfreeware.com

autoconf-2.63-sol10-sparc-local
automake-1.11-sol10-sparc-local
bash-4.0-sol10-sparc-local
binutils-2.19-sol10-sparc-local
bison-2.4.1-sol10-sparc-local
bzip2-1.0.5-sol10-sparc-local
coreutils-7.4-sol10-sparc-local
expat-2.0.1-sol10-sparc-local
flex-2.5.35-sol10-sparc-local
fontconfig-2.4.2-sol10-sparc-local
freetype-2.3.9-sol10-sparc-local
gawk-3.1.6-sol10-sparc-local
gcc-3.4.6-sol10-sparc-local
glib-2.14.1-sol10-sparc-local
gmp-4.2.1-sol10-sparc-local
grep-2.5.4-sol10-sparc-local
gzip-1.3.12-sol10-sparc-local
jpeg-6b-sol10-sparc-local
libexif-0.6.16-sol10-sparc-local
libgcc-3.4.6-sol10-sparc-local
libgcrypt-1.2.4-sol10-sparc-local
libgpgerror-1.5-sol10-sparc-local
libiconv-1.11-sol10-sparc-local
libintl-3.4.0-sol10-sparc-local
libpng-1.2.38-sol10-sparc-local
libsigsegv-2.6-sol10-sparc-local
libtool-1.5.24-sol10-sparc-local
libxml2-2.6.31-sol10-sparc-local
libxslt-1.1.22-sol10-sparc-local
m4-1.4.12-sol10-sparc-local
make-3.81-sol10-sparc-local
pcre-7.9-sol10-sparc-local
pkgconfig-0.23-sol10-sparc-local
python-2.5.1-sol10-sparc-local
sed-4.2.1-sol10-sparc-local
tar-1.21-sol10-sparc-local
tiff-3.8.2-sol10-sparc-local
zlib-1.2.3-sol10-sparc-local

Get into a bash shell, I use the following script.

    PATH=/usr/local/bin:/usr/local/sbin:${PATH}
    bash

Install and/or build the following packages from your favorite source, most
of these are from XOrg.

inputproto-1.4.4.tar
kbproto-1.0.3.tar
libX11-1.1.5.tar
libXau-1.0.4.tar
libpthread-stubs-0.1.tar
libxcb-1.1.tar
xcb-proto-1.1.tar
xextproto-7.0.3.tar
xproto-7.0.13.tar
xtrans-1.2.1.tar

Modify /usr/ccs/bin as such, this is due to the sunfreeware version of gcc
being built to use the tools from /usr/ccs/bin.

    ar -> /usr/local/bin/ar
    grep -> /usr/local/bin/grep
    ld -> /usr/local/bin/ld
    make -> /usr/local/bin/make
    nm -> /usr/local/bin/nm
    ranlib -> /usr/local/bin/ranlib
    strip -> /usr/local/bin/strip

Edit /usr/local/lib/pkgconfig/gthread-2.0.pc as the following.

bash-4.0# diff gthread-2.0.pc.old gthread-2.0.pc
10,11c10,11
< Libs: -L${libdir} -lgthread-2.0 -lpthread -lthread -lrt -lrt
< Cflags: -D_REENTRANT -D_PTHREADS
---
> Libs: -L${libdir} -lgthread-2.0 -D_REENTRANT -lthread
> CFlags: -D_REENTRANT

Get the mono and libgdiplus source. Extract them. You should now have a
mono-<version> directory and a libgdiplus-* directory. Move them both into a
common sub-directory, say mono_build/mono-<version>.

Change directory to mono-<version>

Edit the mono configure script, mono-<version>/configure, to disable dtrace
for Solaris, it causes the build to fail in the metadata directory since
dtrace invokes ld with -Blocal and the GNU ld does not like it.

I use the following scripts to configure and build libgdiplus and mono.

mono_build/mono-<version>/exports
    export LDFLAGS="-L/opt/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib
-lstdc++"
    export CPPFLAGS="-I/opt/include -I/opt/local/include
-I/usr/local/include -I/usr/include"
    export
LD_LIBRARY_PATH=/opt/mono/lib:/opt/local/lib:/usr/local/lib:/usr/lib

mono_build/mono-<version>/cfg_gdi

    source ./exports

    cd libgdiplus-<gdi version>
    GREP=/usr/local/bin/grep MAKE=/usr/local/bin/make AR=/usr/local/bin/ar
RANLIB=/usr/local/bin/ranlib STRIP=/usr/local/bin/strip AS=/usr/local/bin/as
CC=/usr/local/bin/gcc ./configure --prefix=/opt/mono --without-libgif
--without-libexif

mono_build/mono-<version>/cgf_mono

    source ./exports
    cd mono-<mono version>
    GREP=/usr/local/bin/grep MAKE=/usr/local/bin/make AR=/usr/local/bin/ar
RANLIB=/usr/local/bin/ranlib STRIP=/usr/local/bin/strip AS=/usr/local/bin/as
CC=/usr/local/bin/gcc CFLAGS="-g -O2" ./configure --prefix=/opt/mono
--with-tls=pthread --with-includes=/usr/local/include/
--with-libs=/usr/local/lib/

mono_build/mono-<version>/build_mono

    source ./exports
    cd mono-<mono version>

    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 $$

    GREP=/usr/local/bin/grep MAKE=/usr/local/bin/make AR=/usr/local/bin/ar
RANLIB=/usr/local/bin/ranlib STRIP=/usr/local/bin/strip AS=/usr/local/bin/as
CC=/usr/local/bin/gcc CFLAGS="-g -O2" make $1


Just for clarity my directory structure is as:

mono_build/mono-139160
mono_build/mono-139160/libgdiplus-138878
mono_build/mono-139160/mono-139160
mono_build/mono-2.0.1
mono_build/mono-2.0.1/libgdiplus-2.0
mono_build/mono-2.0.1/mono-2.0.1
mono_build/mono-2.4.2.2
mono_build/mono-2.4.2.2/libgdiplus-2.4.2
mono_build/mono-2.4.2.2/mono-2.4.2.2
mono_build/mono-2.4.2.3
mono_build/mono-2.4.2.3/mono-2.4.2.3

The recipe now is, from the mono_build directory :

cd mono-<mono version>
./cfg_gdi
cd libgdiplus-<gdi version>
make
make install
cd ..
./cfg_mono
./build_mono
./build_mono check
./build_mono install

This installs mono into /opt/mono.


-- 
View this message in context: http://www.nabble.com/Building-Mono-on-Solaris-10-tp24793880p24793880.html
Sent from the Mono - Dev mailing list archive at Nabble.com.



More information about the Mono-devel-list mailing list