Installing Emacs on Solaris

I tried to install emacs on a Solaris 10 system earlier today and ran into trouble along the way. It wasn’t anything major but I was not able to find the solution on the web so I’m publishing my comments here.

The Problem

I downloaded, unpacked and installed the emacs binaries (version 22.0.91) as well as all specified dependencies from sunfreeware.com but when I tried to run emacs from the command-line after installling, I got the following error:

ld.so.1: emacs: fatal: /usr/local/lib/libpng.so.3: wrong ELF class: ELFCLASS64

It turns out that the latest version of the libpng library (1.2.21) was built as 64-bit library but all of the other dependencies of emacs that I downloaded (including emacs itself) were built as 32-bit files. Naturally, a 32-bit application cannot load a 64-bit library and thus the error above.

The Solution

The solution was as simple as reverting to an earlier version of the libpng library (1.2.20) which seems to have been built in 32-bit. I was able to download this from ftp://ftp.sunfreeware.com/pub/freeware/sparc/10