Here are some notes which record how I got AIPS to build on my laptop. The official AIPS page is at NRAO AIPS. I also found this astronomy blog helpful.

The laptop is a Toshiba something or other, 64-bit. I currently have ubuntu-12.0.4 on it.

I wanted to build AIPS not as me, but under a separate account. So I created an account named aipsmgr and did all the following steps from that account.

Building gcc

AIPS is a little fussy about the version of gcc it builds with. So the first task is to build one of the 'AIPS-approved' versions of gcc. (See the GNU gcc home page.) I chose version 4.2.1. The version already installed on the laptop was 4.6.

gcc has several compilers, not all of which one needs to build AIPS. I had problems building the java compiler, so in the end I just chose to build the c, c++ and fortran compilers.

In fact I had a number of problems, googled about them, and adjusted the default build instructions accordingly. I'm just going to list the actual steps I took here without going into the whys and wherefores.

	sudo mkdir /usr/local/gcc-4.2.1
	# install libgmp-dev and libmpfr-dev via the synaptic package manager - I'm sure I could have used apt-get like the real linux hebos, but the SPM interface makes things just that bit more user-friendly.
	sudo apt-get install gcc-multilib
	# This may be unnecessary, since I later ended up disabling multilib.
	export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu

	# download the tar file gcc-4.2.1.tar.gz to ~/src/gnu/
	cd ~/src/gnu
	tar xvfz gcc-4.2.1.tar.gz
	mkdir build-4.2.1
	cd build-4.2.1
	../gcc-4.2.1/configure --prefix=/usr/local/gcc-4.2.1 --disable-multilib --enable-languages=c,c++,fortran
I got hold of dejagnu, expect and tcl like the gnu people recommend before running any test sets, then tried
	make -k check
However I have no clue how to interpret the output. ('Unexpected pass'? Is that a good or a bad thing?) I decided just to try to build AIPS and see how that went.

Building AIPS

This was also a process of some trial and error, of which I present here none of the sweat and the gory backtrackings, so be suitably grateful!

Note that I did a 'text install', which is much more elaborate. I did this because I want to do some hacks later. If all you want to do is run AIPS, you're much better off doing a 'binary install'.

So the first step was to get hold of the 31DEC13 source tarball for AIPS and store it in ~/src/aips.


The guy Colm in the astronomy blog already mentioned lists 8 packages which AIPS needs to build. Some of those I already had, but I had to install or upgrade the following:
	libx11-dev		upgrade
        x11proto-xext-dev	-
	libxext-dev		upgrade
        libxpm-dev		-
        libncurses5-dev		-
	libncursesw5-dev	install
	libbsd-dev		install
	libedit-dev		install
Your installation may be different.

Preliminary steps:

	export LD_LIBRARY_PATH=/usr/local/gcc-4.2.1/lib64
This assumes this envar doesn't already contain some directories vital to your system! In which case you rather want to do
	export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/gcc-4.2.1/lib64
Mine was unset (empty) from the start.
	mkdir AIPS
	sudo addgroup aipsuser
	sudo usermod -a -G aipsuser ims # so my normal account can run AIPS
	sudo usermod -a -G aipsuser aipsmgr
	# logged out and back in again to make these changes active. Can check the group membership with command 'groups'.
Now I ran the 'AIPS Wizard' script:
	cd src/aips
	chmod +x
	perl ./
This gives you a succession of numbered screens. I mostly accepted defaults, with the following exceptions:


The first big compile step is compiling the XAS, the TV server. That worked ok (eventually!). I continued, disabled the midnight job for now. The big INSTEP2 and INSTEP4 compile starts from screen 11.

*NOTE* that the AIPS people strongly recommend the Midnight Job. I have not (yet) dived into this, but that's just me. I don't recommend you to be similarly rash.

Final steps:

You should add the lines

        sssin          5000/tcp    SSSIN          # AIPS TV
        ssslock        5002/tcp    SSSLOCK        # AIPS TV Lock
        msgserv        5008/tcp    MSGSERV        # AIPS Message Server
        tekserv        5009/tcp    TEKSERV        # AIPS TekServer
        aipsmt0        5010/tcp    AIPSMT0
        aipsmt1        5011/tcp    AIPSMT1
        aipsmt2        5012/tcp    AIPSMT2
        aipsmt3        5013/tcp    AIPSMT3
        aipsmt4        5014/tcp    AIPSMT4
        aipsmt5        5015/tcp    AIPSMT5
        aipsmt6        5016/tcp    AIPSMT6
        aipsmt7        5017/tcp    AIPSMT7
to the /etc/services file (via 'sudo pico' or something similar). Note that there may already be some sort of wireless thingie already using port 5002, but according to the Wizard (or the doco for it on the NRAO AIPS site) you can comment that out without harm. You should find that the remainder are unused.

I skipped the advice about changing the config of X Windows to either 8-bit PseudoColor or 24-bit TrueColor, because the file they mention is not in /etc/X11. I haven't found any problems from that omission yet...

For a basic check, do

	aips notv tpok
If you get an AIPS prompt, type 'print 2+2' for a simple test.

All this is suggested to you on parting by the Wizard, but it doesn't hurt to repeat it here I guess.

Running AIPS

I switched back to my normal account for this.

AIPS needs to find the gcc-4.2.1 shared libraries, so you need to do

	export LD_LIBRARY_PATH=/usr/local/gcc-4.2.1/lib64
at some point before running AIPS. I put this line in my .bash_aliases to begin with, but I found that this caused a clash with some python modules. So what I plan to do is set up a small shell script which sets this envar, runs the AIPS login script (see below) and then runs the executable. Haven't done it yet but, for the moment I am doing things by hand.

In order for your shell to know where the AIPS executable is, you have to run the AIPS login:

	. ../aipsmgr/AIPS/LOGIN.SH
(I did have this at the end of my .bashrc but see comments just above.) Then if you do
	aips tv=local
it should all come up.

*NOTE* that userid=1 is reserved for the manager: if you choose this, you'll get asked for a password. Its default is AMANAGER. I just chose the next number, 2. There doesn't seem any reason to worry about numbers, only I am planning to access AIPS on this laptop.

Note also that, with the TV, the '?' prompt for userid can get a bit lost in other messages. If you don't get to the normal '>' AIPS command prompt (which you won't, without typing in a userid) but can't see the '?', just try typing '2' then carriage return anyway and see what happens. This should take you to the '>' prompt.

Developing in AIPS

I have not written this bit yet.