Sunday, June 17, 2007
Getting eclipse working on solaris
Why is it so painful to set up eclipse on solaris?
I have recently started working with java and although
java on MicrosoftWindows is very nice I have to have java
working on Solaris. Hence I thought, "let's get eclipse
on solaris so I can use its great debugging facility".
I put a request in with the helpdesk and left it at that.
A couple of weeks later eclipse still hadn't arrived
so I thought, "I'll do it myself, how hard can it be?".
I have an ancient Ultra5 at home running Solaris 7 so
I thought I would install it on that and bring it in on
a small USB drive.
It turns out the eclipse executable you download from the
sun website has all sorts of library dependencies that take
a while to get sorted out. But even when those are sorted
there are still pitfalls.
You would think that with solaris and java being invented
by Sun Microsystems the company would find ways to get the
things to work together. Well I say, "where's the evidence?".
I tried to get eclipse working on my Ultra5 for a couple of
weeks now. I just succeeded this weekend. Here is the long
and painful story of how I did it:
1) The first step had to to be to abandon using solaris 7.
The version of X11 that comes with solaris 7 is just too old.
Eclipse has all sorts of problems using the so-called ready-built
installs that are around, so there is some build from source
needed. However, it turns out that this is just too hard to do
on older versions of solaris due to X11 differences.
It is easier said than done to get an alternative version of
X11 installed. I tried building the latest X11 release 7.2 from
source and it will only build with the very latest GCC.
Unfortunately there are eclipse components that currently won't
build with that version of GCC. So after a week of trying to build
X11, install the right version of GCC and build the various parts
of GTK that eclipse depends on, I gave up and installed solaris 9.
This was also a painful experience but more due to bad luck than
anything else. The machine threw a wobbly during the solaris
install. I'll admit there was a thunderstorm at the time.
Solaris managed to get itself in a state where it tried
booting in CPR mode, then shutting down, then rebooting again,
only to shutdown again. Apparently, this is rare condition
with a very esoteric escape route. On the reboot, type STOP+A
to get to the ROM prompt, then enter the command:-
set-default boot-file
This broke the CPR boot cycle and the system eventually booted
normally. It was then I found the file system was corrupt.
One very tedious fsck later I was up and running again.
2) Use the famous Freeware for Solaris website, http://sunfreeware.com.
I used to take a macho pride in building all the GNU tools I needed
from source, and from knowing about the dependencies between the
packages. But the trouble is some packages have become so big and
complex that all the components required for a successful build
have to be at particular versions, requiring particular versions
of the GCC compiler. I can't cope any more. I made heavy use of
this wonderful website. I wrote a little shellscript that used
wget to suck all the pkgadd packages over in one go. Phew!
Then the installs started. Here are the steps I took:
a) create /usr/local, create other transfer dir someplace else.
b) ftp the unzippd gzip package to the transfer dir from my
linux machine (no openssh yet, so have to initiate ftp from
linux to solaris).
c) pkgadd -d gzipPackage to install into /usr/local/bin.
d) ftp all the other packages to the transfer dir
e) use gzip to unpack them all.
f) Did selective installs of these packages.
Started with bash (phew), bzip, gcc, zlib, tar, bison, flex,
automake, autoconf, binutils and make. Installed many others
that I won't mention here.
g) Installed some of the packages eclipse requires,
such as glib, atk, libtiff, pango and gtk.
h) Tried to start eclipse and found a few libraries
still missing, e.g. libglib-2.0, libgmodule-2.0 and
libgobject-2.0. Installed glib-2.13.0 which made this
problem go away. At last, doing an ldd on the eclipse executable
says that all libraries are found.
3) Build gtk+-2.2.4 from source.
This step was necessary because it turns out that the version
of gtk on the sun freeware site has been built wrongly.
Some of the symbols have internal linkage instead of
external linkage. This problems shows up as a fatal relocation
error, symbol gdk_font_equals not found when you try to run eclipse.
The first thing to realise is that when you have to build a GTK
component from source, do not make the mistake I did, which was
to try to use the most recent version. Use the one closest to
what you already have instead. I already tried using the latest
GTK components when I was on solaris 7 and there are just too
many problems. So I downloaded v2.2.4. It failed to configure.
I had pkgadd'd glib1.2.10 but gtk+-2.2.4 requires at least
glib-2.1.4. So I pkgadd'd glib-2.13.0 on top which seemed to work.
The next problem was configure did not spot that I had installed
freetype 2.3.1. This is because freetype changed the way you have
to include their header files. I had to hack the configure script
to cope, changing the include code to:
#include
#include FT_FREETYPE_H
Next the X11 check failed. This was because the test app was
failing to find gethostbyname but the configure script assumed
it must be failing to find the X11 symbols. I hacked configure
again to force -lsocket -lnsl.
Next, it failed to find libexpat. I pkgadd'd it and then, eventually,
configure succeeded. At last!
Doing a make at this point also failed but the failure was in
one of the demo programs. The libraries built so I did a 'make install'
and tried to run eclipse.
Eclipse said there were no fonts, but at least it ran.
4) Set up X11 fonts.
At first I thought the problem was do with the fontconfig install,
so I did a build from source of that. But it made no difference.
Eventually, I realised that the fontconfig configuration was
not being installed in the proper place and was not referring
to the X11 fonts that come with solaris. The tipoff is to use the
command "xlsfonts", which lists the fonts solaris-X11 knows about,
then give the command "fc-list" which gives the fonts fontconfig
knows about. The former gave a reasonable list,
the latter gave an empty list.
The fontconfig install creates the directory /usr/local/etc/fonts.
This needs to be symbolically linked to /etc/fonts (which didn't even
exist at this point). Then fonts.conf needs to be edited.
The command "xset q" shows where the solaris standard X11 install
puts its fonts. But beware! Do not add all of these to fonts.conf!
Only add the dirs that contain compressed pcf files. Do not mention
the directories with the TrueType fonts. If you do then fc-list
will hang and so will eclipse.
5) Get JDK1.5.0.
At this point eclipse ran but immediately produced an error
saying that the JRE is too old. Solaris 9 comes with JRE1.4.
This is not recent enough. Come on Sun! Eclipse is THE number 1
java development environment, so please make sure that your
downloadable solaris installs support it.
Tracking down suitable versions of the JDK is harder than
I thought it would be, thanks to sun's confusing website,
their mandatory registration proceedure, and the confusing
plethora of java environment names (jdk, sdk, j2ee, standard edition,
enterprise edition, java studio etc etc etc).
Eventually, after a number of false starts, I got hold of
jdk-1_5_0_12-solaris-sparc.sh which installed ok.
6) Take the rest of the day off.
That's it! With the right sun freeware packages installed,
with gtk+-2.2.4 built from source, the X11 fonts configured
and JDK1.5.0 installed, eclipse is now up and running.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment