Building Sage on Solaris 10 (SPARC)

Sage has been reliably on Solaris 10 on the SPARC architecture since around the start of 2010. This Wiki page describes building Sage on SPARC hardware. For building Sage on Solaris x86, see

Sage has been built on several Solaris 10 SPARC systems, ranging from old machines to current models and from the first release of Solaris 10 (03/2005 edition) to (05/2009 edition). It should build on latest Solaris 10 too. Unlike Linux, Solaris has excellent backwards compatibility, so if a version build on one release of Solaris, it is almost guaranteed to build on a more recent version. Specific hardware/software combinations on which Sage has been built are

Sage will run in a Solaris zone, so if you want to make a public access server like, with negligible security risks, then you can do so.

There are a couple of problems with the build on Solaris 10 SPARC, all of which we hope to resolve.

Stage `1 - 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 believe the binary from Sunfreeware does not support Fortran). If you do not have gcc >= 4.0.1 with Fortran support, you will need to:

gcc 4.5 or later also needs the MPC library.

Very old releases of releases of Solaris 10 ship with a pretty broken gcc in /usr/sfw/bin. You might need to apply patch 123647 on old (pre 2007) releases before you can even build a later gcc to build. Exactly how old, and what version of the patch is not known, but anything released during mid-2008 or later should be fine. It is highly recommended that you configure gcc >4.0.1 to use both the Sun linker and Sun assembler, though Sage should build if the GNU tools are used. A configuration which is known to work is:

[email protected]:~$ gcc -v
Using built-in specs.
Target: sparc-sun-solaris2.10
Configured with: ../gcc-4.4.2/configure --prefix=/opt/kirkby/gcc-4.4.2/ 
--with-gmp=/usr/local/ --with-mpfr=/usr/local 
--with-build-time-tools=/usr/ccs/bin --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.4.2 (GCC) 

Stage 2 Set up a build environment.

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

When gcc is configured, it can be built to use either the Sun or the GNU linker and assembler. Lots of code in Sage builds shared libraries, which need appropriate compiler and linker options. , All the options for building shared libraries are different between the GNU and Sun linkers. The sage build process makes the assumption that whatever linker gcc is configured to use, will be the first linker in your path So if you use the GNU linker (not recommended), which is likely to be installed somewhere like /usr/local/bin, then it's essential that /usr/local/bin is your path before /usr/ccs/bin. Conversely, if your gcc is configured to use the Sun linker (which we recommend), then it's essential that /usr/ccs/bin is in your path before anywhere that might contain a GNU linker.

The easiest way to find out what linker your gcc uses is to type

[email protected]:[~] $ gcc -v
Using built-in specs.
Target: sparc-sun-solaris2.10
Configured with: ../gcc-4.4.1/configure --prefix=/usr/local/gcc-4.4.1-sun-linker/ 
--with-as=/usr/ccs/bin/as --without-gnu-as 
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++,fortran 
--with-mpfr-include=/usr/local/include --with-mpfr-lib=/usr/local/lib 
--with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib 
CC=/usr/sfw/bin/gcc CXX=/usr/sfw/bin/g++
Thread model: posix
gcc version 4.4.1 (GCC) 

Note in the above the linker is /usr/ccs/bin/ld.

Sage uses the Fortran compiler, which itself uses a library called The location of which will be in the lib directory under the prefix were gcc was installed. (so in the above case, there will be the file /usr/local/gcc-4.4.1-sun-linker/lib/ Next type:

$ export SAGE_FORTRAN=/usr/local/gcc-4.4.1-sun-linker/bin/gfortran
$ export SAGE_FORTRAN_LIB=usr/local/gcc-4.4.1-sun-linker/lib/

Stage 3 Type 'make' and wait for Sage to build

$ make

Building Sage will take a long time, particularly on the sun4v machines, as one part of sage (ATLAS) spends ages tuning itself to run on sun4v machines. It has some defaults for sun4u, but not sun4v. We hope to get some defaults into ATLAS at some point, which should dramatically reduce the time to build Sage on sun4v machines. Some very rough estimates of build times for Solaris hardware are:


Time to build (days)

Sun Blade 2000, 2 x 1.2 GHz


Sun T5240, 16 core, 1167 MHz


Sun Netra T1, 500 MHz


As you can see, building Sage is not quick!!

Stage 4. Start sage, and verify it works. But wait until you have tested Sage before doing anything serious.

[email protected]:[~/sage-4.5.1-Solaris_10_SPARC-sun4u-SunOS] $ ./sage
| Sage Version 4.5.1, Release Date: 2010-07-19                       |
| Type notebook() for the GUI, and license() for information.        |
Setting permissions of DOT_SAGE directory so only you can read and write it.
sage: notebook()
The notebook files are stored in: sage_notebook.sagenb

Please choose a new password for the Sage Notebook 'admin' user.
Do _not_ choose a stupid password, since anybody who could guess your password
and connect to your machine could access or delete your files.
NOTE: Only the md5 hash of the password you type is stored by Sage.
You can change your password by typing notebook(reset=True).

Enter new password: ******

Retype new password: ******

Please login to the notebook with the username 'admin' and the above password.
Password changed for user 'admin'.
*                                                *
* Open your web browser to http://localhost:8000 *
*                                                *
2010-07-29 13:48:00-0700 [-] Log opened.
2010-07-29 13:48:00-0700 [-] twistd 9.0.0 (/rootpool2/local/kirkby/sage-4.5.1-Solaris_10_SPARC-sun4u-SunOS/local/bin/python 2.6.4) starting up.
2010-07-29 13:48:00-0700 [-] reactor class: twisted.internet.selectreactor.SelectReactor.
2010-07-29 13:48:00-0700 [-] starting on 8000
2010-07-29 13:48:00-0700 [-] Starting factory < instance at 0x45ca800>

Open your browser at http://localhost:8000 where hopefully you should be able to create accounts and start using sage. Sage is a complex bit of Software, so do not expect to learn to use it in 5 minutes.

Stage 5 Testing Sage

Sage has an extensive test suite, which will be executed if you type one of the following

$ make test       # Standard tests. One process. 
$ make ptest      # Standard tests run in parallel - only useful on multi-processor machines. 
$ make testlong   # Standard tests + some that take a long time
$ make ptestlong  # As above, but run in parallel - only useful on multi-processor machines. 

On slower hardware, you will probably find many tests time-out. To stop this you will need to increase the values of SAGE_TIMEOUT and SAGE_TIMEOUT_LONG before running the test suite. The following are acceptable for a Sun Blade 1000 with 2 GB RAM and a pair of 900 MHz CPUs. On slower hardware, you may have to increase these further.


Solaris-on-SPARC (last edited 2011-03-10 13:14:44 by DavidKirkby)