Thursday, April 14, 2005

 

Solaris 10 x86 and Mono

Edited 04/01/2006:

I have just setup a box with Solaris 5.11 snv_36 and as usual, after the installation was done, I ran a test if mono will build. Here's a few pointers from that venture:

1. Installed Blastwave's GNU build tool chain (gmake, automake, autoconf, gcc3, etc...)
2. Checked my PATH


PATH=/opt/csw/bin:/usr/sbin:/usr/bin:/usr/dt/bin: /usr/openwin/bin:/usr/ucb:/usr/ccs/bin



3. Ran the configure script with the following parameters/options/arguments/whatever:


MAKE=gmake CFLAGS="-g -O2" CC=/opt/csw/gcc3/bin/gcc ./configure --prefix=/opt/csw --with-tls=pthread --with-includes=/opt/csw/include/ --with-libs=/opt/csw/lib/



* Note:

--with-tls=pthread will save you alot of headaches ranging from libelf.h complaining about large files not supported and also some GC symbols undefined.

During the build of the actual runtime, I've encountered some semaphores error which complain about no more space available in the device. After doing some research, using ipcs, you can view those semaphore messages and to get rid of the error messages pertaining to this, i'ved used ipcrm -s . There's gotta be a better way to fix this. It's a small workaround but I'm sure there's a better way.

4. Build it.


gmake



5. And install, well, i've used CSWutils to build the package so I can install the new version using pkgadd


Edited 02/06/2006:

I'm now the mono package maintainer at Blastwave.org, so if you are a user of this great repositories, you can install the mono package using pkg-get -i mono

Edited 01/17/2006:

It's been quite a while since I've built mono on a Solaris x86 box, last version I built was mono 1.1.4 and it was back in April of 2005. So here I am again thanks to my vmware installation of Solaris giving you a mono package for Solaris x86.

Here's a few pointers on how I build Mono on my Solaris x86 box:

1. Set your PATH env var


export PATH=/opt/csw/bin:/opt/csw/sbin:/usr/bin:/bin: /usr/ucb:/usr/sfw/bin:/usr/ccs/bin:/usr/sbin:/sbin



2. Copy /usr/lib/pkgconfig/gthread-2.0.pc and /usr/lib/pkgconfig/glib-2.0.pc to your home directory

3. Edit gthread-2.0.pc and replace all occurences of -mt to -D_REENTRANT

4. Set your PKG_CONFIG_PATH (thanks to the guy who post a comment below) to include your home directory so it will pickup gthread-2.0.pc


export PKG_CONFIG_PATH=/path/to/home/directory:$PKG_CONFIG_PATH



5. Configure


CC=/path/to/gcc ./configure --prefix=/path/to/dest --with-libs=/opt/csw/lib --with-includes=/opt/csw/include



6. Edit support/mph.h and change the _GNUC_ line to #define MPH_INTERNAL

7. Build it


CC=/path/to/gcc CFLAGS='-D_POSIX_PTHREAD_SEMANTICS' gmake



8. Make coffee, watch tv, or sleep, it'll be a while, well, at least for me since I'm building on a vmware installation

9. Install it


gmake install



10. Smile

-- old stuff --
1. To build mono, I have to modfiy my CFLAGS to include -D_POSIX_PTHREAD_SEMANTICS
2. The Makefiles that you will have will include -mt in the following variables:

BUILD_GLIB_CFLAGS
BUILD_GLIB_LIBS
GLIB_CFLAGS
GLIB_LIBS

Since I'm using gcc, -mt is not recognized. -mt is actually a macro processor that translates to -D_REENTRANT, 2 ways to go around this is to fix it from the source of the problem:

As root, edit /usr/lib/pkgconfig/gthread-2.0.pc and change the last 2 lines from:


Libs: -L${libdir} -lgthread-2.0 -mt
Cflags: -mt

To:

Libs: -L${libdir} -lgthread-2.0 -D_REENTRANT -lthread
CFlags: -D_REENTRANT



[I also made changes to my /opt/csw/lib/pkgconfig/gthread-2.0.pc]

OR

You can also do what I usually do since I don't have root access in the box where I build Mono, at the prompt:


$ for a in `find ./ -name Makefile`; do cp $a $a.1; cat $a.1 | sed -e 's/-mt/-D_REENTRANT/' > $a; rm $a.1; done



and that should replaced all -mt occurences with -D_REENTRANT.

3. I also #define MPH_INTERNAL in support/mph.h to nothing. This pointer was actually from the guy who wrote that code.

4. When you're actually ready to build it, do:


$ CC=gcc gmake



Trust me, it'll help you down the line.

Comments:
Great tips...

The pointer to gthread-2.0.pc really helped me a lot while trying to build Mozilla on Solaris with gcc (the one from blastwave).

Thanks!
 
Hmm, even simpler is to copy glib-2.0.pc and gthread-2.0.pc to your home directory, fix them up, and point PKG_CONFIG_PATH to that.
 
Building 1.1.15, I had to add AR=gar, RANLIB=granlib, and for fun, STRIP=gstrip
 
Post a Comment





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]