Building Sage on OpenSolaris, Solaris 10 or Solaris 11 Express on x86

This page describes how to build Sage on either

This page does NOT cover building Sage on SPARC processors - for information about building on SPARC, see http://wiki.sagemath.org/Solaris-on-SPARC

Building Sage on the above systems is not particularly difficult, but you do need to do a bit of preparation before extracting the tar file and typing 'make'. The basic requires you need to have are:

You must ensure that:

Step 1 - set up the environment so you have the proper versions of make and tar in your path

This is a bit tricky. It's easier to do than explain, but I'll try to explain how to do it.

Sage needs the GNU versions of make and tar to build. They must be called make and tar too, and not gmake or gtar. You do not need particularly new versions of these tools, so those in /usr/sfw/bin will be fine. It is suggested you do this as follows

$ mkdir $HOME/bins-for-sage
$ cp /usr/sfw/bin/gmake $HOME/bins-for-sage/make
$ cp /usr/sfw/bin/gtar $HOME/bins-for-sage/tar
$ export PATH=$HOME/bins-for-sage:$PATH
$ export PATH

Although these are old version of tar and make, they appear to work fone for building Sage.

Step 2 - make sure you have a suitable gcc, if not build one or download one

Sage has been built on Solaris with gcc 4.4.1, 4.4.2, 4.4.4 & 4.5.0 but should work with any gcc >= 4.0.1 built with support for C, C++ and Fortran. Although I've not used it myself, many say gcc 4.3.4 is the most stable gcc, but all test pass with other versions of gcc.

Solaris 10 only ships with an old version of gcc (3.4.3), which is not built with Fortran support. Sage needs a newer version of gcc than that, and it must be configured to support Fortran. I suggest you use the latest versions of all these tools.

GMP, MPFR, MPC, Binutils and finally GCC can all be built with the gcc 3.4.3 supplied with Solaris. That normally resides in /usr/sfw/bin.

I would suggest you don't stuff everything in /usr/local/bin, but instead put things in directory specific to the version of gcc you use. Assuming you use the latest versions of these tools, the following should work, and assumes you have all the sources in your home directory. If not, you will have to change things a bit.

2.1 Build and install the latest binutils

$ cd # Just to change to the home directory.
$ tar xf binutils-2.21.tar.bz2  
$ cd binutils-2.21
$ ./configure --prefix=/usr/local/binutls-2.21
$ make
$ su
# make install # You might need to ensure GNU make is first in your path as root too. 
# exit # Don't remain root longer than necessary.

2.2 Build and install the latest GMP

$ cd
$ LD_OPTIONS=/usr/local/gcc-4.5.1/lib
$ export LD_OPTIONS
$ tar xf gmp-5.0.1.tar.bz2
$ cd gmp-5.0.1
$ ./configure --prefix=/usr/local/gcc-4.5.1 ABI=32
$ make
$ make check # ALL tests should pass. 
$ su
# make install # You might need to ensure GNU make is first in your path as root too. 
# exit # Don't remain root longer than necessary.

2.3 Build and install the latest MPFR

$ cd 
$ tar xf mpfr-3.0.0.tar.bz2
$ cd mpfr-3.0.0
$ configure --prefix=/usr/local/gcc-4.5.1 --with=gmp=/usr/local/gcc-4.5.1/lib
$ make
$ make check
$ su
# make install

2.4 Build and install the latest MPC

$ cd 
$ tar xf mpc-0.9.tar.gz
$ cd mpc-0.9
$ ./configure --prefix==/usr/local/gcc-4.5.1 --with=gmp=/usr/local/gcc-4.5.1/ --with-mpfr=/usr/local/gcc-4.5.1/
$ make 
$ make check
$ su
# make install

2,5 Finally build GCC

One must create a temporary directory to build gcc - you should not build gcc in the same directory as the source. I'll call the directory gcc-build.

$ cd
$ mkdir gcc-build
$ cd gcc-build
$ ../gcc-4.5.1/configure --prefix==/usr/local/gcc-4.5.1 --with=gmp=/usr/local/gcc-4.5.1/ --with-mpfr=/usr/local/gcc-4.5.1/ --with-mpc=/usr/local/gcc-4.5.1/ --with-gnu-as --with-as=/usr/local/binutils-2.21/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-languages=c,c++,fortran
$ make
$ su
# make install

Step 3 Configure a few environment variables for building Sage

You might as well put these in a startup file, so they are read each time you do anything.

$ SAGE_FORTRAN=/usr/local/gcc-4.4.1-sun-linker/bin/gfortran
$ export SAGE_FORTRAN
$ SAGE_FORTRAN_LIB=usr/local/gcc-4.5.1/lib/libgfortran.so
$ export SAGE_FORTRAN_LIB
$ SAGE_PORT=yes
$ export SAGE_PORT
$ LD_OPTIONS=/usr/local/gcc-4.5.1/lib
$ export LD_OPTIONS

To attempt a 64-bit build, which will currently fail, then one should change the location of SAGE_FORTRAN_LIB and additionally set SAGE64=yes.

$ SAGE_FORTRAN_LIB=usr/local/gcc-4.5.1/lib/amd64/libgfortran.so
$ export SAGE_FORTRAN_LIB
$ SAGE64=yes
$ export SAGE64

Step 4 Build Sage

$ LD_OPTIONS=/usr/local/gcc-4.5.1/lib
$ export LD_OPTIONS
$ tar xf sage-4.6.1.tar
$ cd sage-4.6.1
$ make
$ make ptestlong

Solaris86 (last edited 2011-03-10 15:42:44 by DavidKirkby)