I recently wrote that I was having trouble linking an application (spice) to
the X11R4 libraries that I had just constructed. Specifically, I got the error
message:
ld.so: Undefined symbol: _XtInitialize
I have so far received eight respones, which I greatly appreciate. The
responses fall into three general categories:
(1) The Xt stuff is simply not required, and including the library somehow
confuses the linker. Try removing the reference to libXt and see what
happens. This was actually the most-popular form of response. In my
case it turns out not to work. I get:
cc -o spice spice.o ../lib/FTE.a ../lib/DEV.a ../lib/CKT.a ../lib/CP.a ../lib/H
LP.a ../lib/INP.a ../lib/MFB.a ../lib/NI.a ../lib/SMP.a ../lib/MISC.a -L/usr/lo
cal/lib/X11 -lXaw -lXau -lXmu -lX11 -lm -ltermlib
ld: Undefined symbol
_XtDispatchEvent
_XtAddEventHandler
_topLevelShellWidgetClass
_XtNextEvent
_XtCreateApplicationShell
_XtPending
_XtInitialize
*** Error code 2
I.e., it appears that spice *does* use the Xt stuff, although others may
not, of course.
(2) If I have OpenWindows installed, there may be some confusion between the
vanilla X that I built and the OpenWindows stuff. I *do* have OW installed,
but I thought that the -L option was supposed to force the linker to look
in the specified directory *first*. I haven't ruled this out as a possible
source of the problem, but it doesn't seem the likely culprit.
(3) X11R5 is better than X11R4, and, who knows, it may solve this problem.
Why not install it? The answer is that I assumed that little of the
free software that is floating around the net would have been compiled
and linked against R5 at this time. As I don't (yet) intend to make use
of all the X11 stuff, only libraries and header files, I picked R4.
If and when I start using the window managers and other executables, I'll
try the R5 stuff.
I have ``solved'' the problem that I had just by getting rid of the Xt
shareable library, thus forcing a link against the standard random library.
I.e., when I built X11R4, I got the following libraries:
libXt.a libXt.so.4.0
I just did:
mv libXt.so.4.0 libXt.so.4.0-
This is not my ideal solution, but I'm in a bit of a rush to get this program
(spice) ready for a lab next quarter. If anybody can shed any light on the
real problem here, please let me know.
By the way, I noticed something else peculiar in all this. When I started to
write this summary, I redid the ``make'', just to get the exact form of the
error. When I did so, I got:
ld: Undefined symbol
_XtInitialize
*** Error code 2
This is almost, but not quite, what I reported initially, which was:
ld.so: Undefined symbol: _XtInitialize
I'm not aware that I changed any of the linker options during all this
thrashing around. Why did I get ld.so in one case and ld in the other?
Thanks.
- Mike
-----------
Mike Hannon mike@ucdhep (Bitnet)
ucdhep::mike (HEPnet) 42385::mike (HEPnet)
mike@ucdhep.ucdavis.edu (Internet) 916-752-4966 (Telephone)
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:22 CDT