Thursday, January 21, 2010

Compiling Sage on my Atom N270 Netbook

Here are some notes to myself regarding compiling Sage on my HP Mini 2140 with an Atom N270 CPU. I'm running Linux Ubuntu 9.10. This successfully compiles Sage 4.3 and 4.3.1 and might also work for later version.


# using aria2, first get aria2
sudo apt-get install aria2
# go to a local directory and just use the .metalink link
aria2c http://server/path/sage-x.y.z.tar.metalink

# note, that aria2c doesn't stop when it has finished.
# it will start seeding the file to others via bittorrent.
# You can terminate this by hitting Ctrl-C


# or download via http/ftp from the download page


# If you think your download might have been corrupted, verify it:
aria2c -V http://server/path/sage-x.y.z.tar.metalink


# any local directory is fine
$ tar xf sage-x.y.z.tar


# You need some tools to compile Sage:
$ sudo apt-get install build-essential m4\
readline libreadline-dev gfortran texlive
# read more: Installation Guide

Setup Build Environment

$ cd sage-x.y.z

# get rid of some environment variables, unless
# you know what you do (i.e. ccache, ...)
unset CC
unset CXX

see README.txt if you need this
export SAGE_FAT_BINARY="yes"

# if you have gfortran library problems
# find your correct paths via $ locate gfortran
# setting these variables is necessary on Ubuntu 9.10
export SAGE_FORTRAN=/usr/bin/gfortran
$ export SAGE_FORTRAN_LIB=/usr/lib/

# note: do not start over compilation if that problem happens,
# you have to remove and clean up everything first

# there are two cores in the CPU
# use both of them in parallel!
export MAKE="make -j2"

Start Compilation

# in a resource friendly mode
$ ionice -c 3 nice make

Testing and Packaging

If compilation didn't end with an error (otherwise: search, sage-support and sage-devel or irc chat)

# Test the entire beast (2 for 2 CPU cores):
$ ./sage -tp 2 devel/sage-main
# or
$ ./sage -testall
# once again, please report problems

If you want to build a
binary distribution, upload it to us at or send it to a friend with a similar machine+system:

$ ./sage -bdist x.y.z-LinuxVersion;

On systems like Ubuntu, you can shrink the resulting archive much smaller using lzma compression. "trans-compress" it via:

$ zcat sage-x.y.z-...tar.gz | lzma -zv > sage-x.y.z-...tar.lzma

and to extract the tar.lzma later:

$ tar --lzma -xvf sage-x.y.z...tar.lzma