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.

Download


# 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

Verify

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


Extract


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


Prerequisites

# 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/libgfortran.so.3

# 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 sagemath.org 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

Links

7 comments:

  1. by the way, it's very unclear what you meant by
    aria2c http://..src../sage-x.y.z.tar.metalink

    a concrete example would help...

    ReplyDelete
  2. @dimpase, well, just the metalink url from the link.
    concrete example:
    $ aria2c http://www.sagemath.org/mirror/src/meta/sage-4.3.2.tar.metalink

    ReplyDelete
  3. How long does it take the compilation part? In my netbook, previous versions took at least 4 hours (I do not know exactly since I had to leave it on overnight).

    ReplyDelete
  4. i don't look on the clock, but i think it's a bit more than 4. running the tests also takes quite a long time ...

    ReplyDelete
  5. Have you ever considered adding more videos to your blog posts to keep the readers more entertained? I mean I just read through the entire article of yours and it was quite good but since I'm more of a visual learner,I found that to be more helpful.

    ReplyDelete
  6. Great information, I was looking for some way of doing it, and put so clear and easy. Thanks for sharing.

    ReplyDelete
  7. Hi Harald, many many thanks for sharing. Only one note: on my dell mini 10v with Dell-Ubuntu 8.04 the compilation part take 16 hours!!!!

    ReplyDelete