old-www/HOWTO/Software-Building-HOWTO-9.html

123 lines
4.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>Building and Installing Software Packages for Linux: First Example: Xscrabble</TITLE>
<LINK HREF="Software-Building-HOWTO-10.html" REL=next>
<LINK HREF="Software-Building-HOWTO-8.html" REL=previous>
<LINK HREF="Software-Building-HOWTO.html#toc9" REL=contents>
</HEAD>
<BODY>
<A HREF="Software-Building-HOWTO-10.html">Next</A>
<A HREF="Software-Building-HOWTO-8.html">Previous</A>
<A HREF="Software-Building-HOWTO.html#toc9">Contents</A>
<HR>
<H2><A NAME="s9">9. First Example: Xscrabble</A></H2>
<P>Matt Chapman's <CODE>Xscrabble</CODE> seemed like a program that would be
interesting to have, since I happen to be an avid Scrabble<CODE>TM</CODE>
player. I downloaded it, uncompressed it, and built it following the
procedure in the README file:
<BLOCKQUOTE><CODE>
<PRE>
xmkmf
make Makefiles
make includes
make
</PRE>
</CODE></BLOCKQUOTE>
<P><EM>Of course it did not work...</EM>
<P>
<BLOCKQUOTE><CODE>
<PRE>
gcc -o xscrab -O2 -O -L/usr/X11R6/lib
init.o xinit.o misc.o moves.o cmove.o main.o xutils.o mess.o popup.o
widgets.o display.o user.o CircPerc.o
-lXaw -lXmu -lXExExt -lXext -lX11 -lXt -lSM -lICE -lXExExt -lXext -lX11
-lXpm -L../Xc -lXc
BarGraf.o(.text+0xe7): undefined reference to `XtAddConverter'
BarGraf.o(.text+0x29a): undefined reference to `XSetClipMask'
BarGraf.o(.text+0x2ff): undefined reference to `XSetClipRectangles'
BarGraf.o(.text+0x375): undefined reference to `XDrawString'
BarGraf.o(.text+0x3e7): undefined reference to `XDrawLine'
etc.
etc.
etc...
</PRE>
</CODE></BLOCKQUOTE>
<P>I enquired about this in the
<A HREF="news://comp.os.linux.x">comp.os.linux.x</A> newsgroup, and someone kindly pointed out that
apparently the Xt, Xaw, Xmu, and X11 libs were not being found at the
link stage. Hmmm...
<P>There were two main Makefiles, and the one in the <CODE>src</CODE> directory
caught my interest. One line in the Makefile defined LOCAL_LIBS as:
LOCAL_LIBS = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) Here were
references to the libs not being found by the linker.
<P>Looking for the next reference to LOCAL_LIBS, I saw on line 495 of that
Makefile:
<BLOCKQUOTE><CODE>
<PRE>
$(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(LOCAL_LIBS) $(LDLIBS)
$(EXTRA_LOAD_FLAGS)
</PRE>
</CODE></BLOCKQUOTE>
<P>Now what were these LDLIBS?
<BLOCKQUOTE><CODE>
<PRE>
LDLIBS = $(LDPOSTLIB) $(THREADS_LIBS) $(SYS_LIBRARIES)
$(EXTRA_LIBRARIES)
</PRE>
</CODE></BLOCKQUOTE>
<P>The SYS_LIBRARIES were:
<BLOCKQUOTE><CODE>
<PRE>
SYS_LIBRARIES = -lXpm -L../Xc -lXc
</PRE>
</CODE></BLOCKQUOTE>
Yes! Here were the missing libraries.
<P>Possibly the linker needed to see the LDLIBS before the LOCAL_LIBS...
So, the first thing to try was to modify the Makefile by transposing the
$(LOCAL_LIBS) and $(LDLIBS) on line 495, so it would now read:
<BLOCKQUOTE><CODE>
<PRE>
$(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(LDLIBS) $(LOCAL_LIBS)
$(EXTRA_LOAD_FLAGS) ^^^^^^^^^^^^^^^^^^^^^^^
</PRE>
</CODE></BLOCKQUOTE>
<P>I tried running <EM>make</EM> again with the above change, and lo and
behold, it worked this time. Of course, Xscrabble still needed some
fine tuning and twiddling, such as renaming the dictionary and
commenting out some assert statements in one of the source files, but
since then it has provided me with many hours of pleasure.
<P>
<P>
<P>[Note that a newer version of Xscrabble is now available in rpm format, and
this installs without problems.]
<P>
<P>
<P>
<P>You may e-mail
<A HREF="mailto:matt@belgarath.demon.co.uk">Matt Chapman</A>, and download <EM>Xscrabble</EM> from his
<A HREF="http://www.belgarath.demon.co.uk/programs/index.html">home page</A>.
<P>
<P>
<P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
Scrabble is a registered trademark of the Milton Bradley Co., Inc.
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>
<P>
<P>
<HR>
<A HREF="Software-Building-HOWTO-10.html">Next</A>
<A HREF="Software-Building-HOWTO-8.html">Previous</A>
<A HREF="Software-Building-HOWTO.html#toc9">Contents</A>
</BODY>
</HTML>