Saturday, December 18, 2010

installink XEphem on Ubuntu

had I found this link earlier, i wouldn't have wasted so much time and effort:

http://www.tc.umn.edu/~brams006/xephem_ubuntu.html

How to Compile XEphem on Ubuntu Linux

Following is a (hopefully) painless guide to compiling the excellent astronomy program named XEphem (http://www.clearskyinstitute.com/xephem/) on the Ubuntu linux distribution. Though we now have Stellarium and KStars, XEphem has some unique features and the source code is free for personal/educational use (check the URL for precise terms). In addition, it doesn't require a higher-end OpenGL graphics card. It'll run well on a fairly modest machine. I've tested these steps on Ubuntu 10.04 Lucid Lynx and they worked for me without any trouble.

(1) Preliminaries & Packages.

Use either "sudo apt-get install" or Synaptic to pull down (or verify that you already have) the following packages installed:

gcc
lesstif2-dev
libc6-dev
libxmu-dev
make

Since I embarked on this document (perhaps in 2005), I've noticed a couple changes with the Ubuntu packages. When you install the gcc compiler it sets up a symlink automatically from /usr/bin/gcc to the /usr/bin/gcc-{version number} executable. In the past, you may have needed to create this symlink yourself. For the newbies: 'cd /usr/bin', then 'ln -s gcc-4.4 gcc' or whatever was the gcc version.

If you'd rather compile with libmotif3 and libmotif3-dev (instead of the lesstif2 and lesstif2-dev respectively), you'll need to go into Synaptic (or edit /etc/apt/source.list manually), enable the Non-free Multiverse repository, and install those packages instead. There are some licensing politics surrounding motif.

In any case, I've successfully compiled XEphem 3.7.4 with gcc-4.x and the LGPL lesstif2/lesstif2-dev Ubuntu maintained packages, as well as the libmotif3/libmotif3-dev alternative.

(2) Get the XEphem source code.

Go here: http://www.clearskyinstitute.com/xephem/. Download it to a directory, for instance your user directory, and ungzip/untar it. It'll be in a directory named "xephem-3.7.4" (depending on version number).

(3) Make a change to the xephem-3.7.4/libz/Makefile

This file may initially be read-only, so be sure to chmod +w it if necessary. I noticed this issue with the source for XEphem 3.7.1 and 3.7.2 as well. There's a couple things missing from the makefile in the xephem-3.7.4/libz/Makefile file. Make sure the top of that file includes this:

CC = gcc
CLDFLAGS = -g
CFLAGS = $(CLDFLAGS) -Wall -O2
LDFLAGS =

And the bottom of the file needs to have "gcc" specified rather than cc.:

testzlib: testzlib.o libz.a
gcc $(LDFLAGS) -o testzlib testzlib.o libz.a

(4) Compile XEphem.

Whether you're using motif or lesstif, the XEphem makefiles expect some value for "MOTIF=" in order to compile. Go to the xephem-3.7.4/GUI/xephem directory. Issue this:

make MOTIF=/usr/lib/

XEphem should now successfully compile after a minute or so, depending on the speed of your hardware.

(5) Run and test.

Go to /xephem-3.7.4/GUI/xephem and type "./xephem" to execute. The first things you might want to do is to set the observer location to your own and confirm that your time/zone information is correctly indicated.

I like to create a KDE desktop icon for XEphem. From the KDE desktop, right-click and create a new link to an application. Go to the directory /xephem-3.7.4/GUI/xephem and select the xephem executable, change the icon to the XEphem.png file there. Then make sure the working directory is set to /xephem-3.7.4/GUI/xephem (or wherever you actually installed it).

As of Ubuntu 10.04 I decided to switch to Gnome. I see that the Gnome desktop application launcher doesn't include a "working directory" setting. Unless XEphem is executed from the path it resides in, some components may be improperly pathed. Being less experienced with Gnome, I'm not sure if this is the best approach, but it was awfully simple:

In the ~/xephem3.7.4/ directory I created a simple script called xephem.sh, and chmod +x to it. Here's the contents of the script:

cd /home/{my user directory}/xephem-3.7.4/GUI/xephem
./xephem

I then aimed the Gnome desktop launcher at this script, and used the icon here: /xephem-3.7.4/GUI/xephem/XEphem.png.

Enjoy!


The views and opinions expressed in this page are strictly those of the page author.
The contents of this page have not been reviewed or approved by the University of Minnesota.

No comments:

Post a Comment