E-Mail:

Compiling Software from Source, Part IV

  • No Related Post

Compiling Software from Source, Part IV

So, I grabbed the latest non-beta TIFF libraries from ftp://ftp.remotesensing.org/pub/libtiff (tiff-v3.5.7.tar.gz), the latest PNG
libraries from ftp://swrinde.nde.swri.edu/pub/png/src/ (libpng-1.2.5.tar.bz2) and the latest
JPEG libraries from ftp://ftp.uu.net/graphics/jpeg/ (jpegsrc.v6b.tar.gz).

I start with tiff, uncompressing and unpackaging it. It’s an
Autoconf setup so I type ./configure and I’m off to the races. Then it’s make, then I su over to root, and then make install. What a relief, something worked
with no complaints. Just so you’ll know what it looks like, here’s
the end of this make install:

cd ..; /bin/sh ../port/install.sh -m 444    -F /usr/local/man/man3    -idb tiff.man.dev -src lib/TIFFWriteTile.3t -O
TIFFWriteTile.3t
make[2]: Leaving directory '/home/dee/Downloads/GNOME2.2.1/tiff-v3.5.7/man/lib'
make[1]: Leaving directory '/home/dee/Downloads/GNOME2.2.1/tiff-v3.5.7/man'

libpng has a much uglier
installation routine. First, I have to find two files: zlib.h and zconf.h. I already have zlib installed on my system but apparently I need to
copy them or add a symlink into the libpng directory. I type locate zlib.h and get:

$ locate zlib.h
/usr/X11R6/include/X11/extensions/lbxzlib.h
/usr/include/zlib.h
/usr/include/mozilla-1.4/zlib/zlib.h
/usr/include/mozilla-1.4/nss/jzlib.h
/usr/src/linux-2.4.20-18.9/arch/ppc/boot/include/zlib.h
/usr/src/linux-2.4.20-18.9/arch/ppc64/boot/zlib.h
/usr/src/linux-2.4.20-18.9/include/linux/zlib.h

I make a zlib directory in
the same directory that libpng is in (~/Downloads/GNOME2.2.1), and then I copy the /usr/include/zlib.h file into that
directory. Next, I use locate
zconf.h
and get:

$ locate zconf.h
/usr/include/zconf.h
/usr/include/mozilla-1.4/zlib/zconf.h
/usr/include/mozilla-1.4/nss/jzconf.h
/usr/src/linux-2.4.20-18.9/include/linux/zconf.h

After soft linking (ln -s)
/usr/include/zconf.h into
~/Downloads/GNOME2.2.1/zlib,
I return to the libpng
directory and, after reading the INSTALL file yet again, change to the scripts subdirectory. Here, I copy
the file makefile.linux into
the main libpng directory, renaming it along the way:

cp makefile.linux ../Makefile

Now, I cross my fingers and type make to start the library build process. If you think
this whole routine is a pain, remember that this was the only way
to do it “way back when!” It builds with no problem, so I type
make install to finish it
off. Phew. Now where in the heck was I? Oh yeah, I have to still
compile the JPEG libraries. I uncompress and unpackage them, and
discover in the install file
that I’m back to ./configure,
make, make install. The nice thing is that libraries are
relatively small, usually, so this process goes pretty fast.

Finally, I’m out of the detour. I go back and look at last week’s
article (isn’t that sad?) to find that it was gtk+ that I was
trying to build when I had to go off chasing libraries. Again, I
cross my fingers and type ./configure, hoping that this time it won’t complain.
But it does. After banging my head on my desk for a moment, I look
back to see where the JPEG library installed its files:

# make install
/usr/bin/install -c cjpeg /usr/local/bin/cjpeg
/usr/bin/install -c djpeg /usr/local/bin/djpeg
/usr/bin/install -c jpegtran /usr/local/bin/jpegtran
/usr/bin/install -c rdjpgcom /usr/local/bin/rdjpgcom
/usr/bin/install -c wrjpgcom /usr/local/bin/wrjpgcom
/usr/bin/install -c -m 644 ./cjpeg.1 /usr/local/man/man1/cjpeg.1
/usr/bin/install -c -m 644 ./djpeg.1 /usr/local/man/man1/djpeg.1
/usr/bin/install -c -m 644 ./jpegtran.1 /usr/local/man/man1/jpegtran.1
/usr/bin/install -c -m 644 ./rdjpgcom.1 /usr/local/man/man1/rdjpgcom.1
/usr/bin/install -c -m 644 ./wrjpgcom.1 /usr/local/man/man1/wrjpgcom.1

Uh oh. No source code was installed, just binaries. I look back in
the Makefile and down into the rules, and sure enough, the install target doesn’t include the
libraries or the headers. Here are the items I need:

install-lib: libjpeg.$(A) install-headers
        $(INSTALL_LIB) libjpeg.$(A) $(libdir)/$(binprefix)libjpeg.$(A)

install-headers: jconfig.h
        $(INSTALL_DATA) jconfig.h $(includedir)/jconfig.h
        $(INSTALL_DATA) $(srcdir)/jpeglib.h $(includedir)/jpeglib.h
        $(INSTALL_DATA) $(srcdir)/jmorecfg.h $(includedir)/jmorecfg.h
        $(INSTALL_DATA) $(srcdir)/jerror.h $(includedir)/jerror.h

I’ve bolded the interesting lines above. If I just do the headers,
I’ll have to then do the libraries, but I can do both at once by
using install-lib first. So:

# make install-lib
/usr/bin/install -c -m 644 jconfig.h /usr/local/include/jconfig.h
/usr/bin/install -c -m 644 ./jpeglib.h /usr/local/include/jpeglib.h
/usr/bin/install -c -m 644 ./jmorecfg.h /usr/local/include/jmorecfg.h
/usr/bin/install -c -m 644 ./jerror.h /usr/local/include/jerror.h
/usr/bin/install -c -m 644 libjpeg.a /usr/local/lib/libjpeg.a

Much better. Back over to the GTK+ source code directory. A quick
./configure and if the fates
shine upon me … yay … they do! Now I can type make and compile GTK+, then make install to put the files in
place, and leave this week’s part on a perkier note.

Next week: I continue with the valiant struggle that
is compiling GNOME from source.

(I’m sure the GNOME team would laugh at me. They’ve got a special
method for doing this that’s a lot easier. But that’s not the
point, as I said before. This is a learning “workshop.”)

What Do You Think?

 
53 queries / 0.103 seconds.