From: keh5@ellis.uchicago.edu (keith eric hellman) Subject: ld & X11 errors (Yes, I'm using -lX11) Date: Sun, 18 Apr 1993 18:11:48 GMT
First off, my (1)THANKS to the people who responed to my
rw_swap_page: bad swap file
post. (2)APOLOGIES: you were right, it was in the FAQ.
At least I've learned my lesson, I have searched the GCC and
March FAQ and I can't seem to solve this problem:
I'm trying to compile some of my own code for X11. Everything
compiles alright, no errors at all; but I keep getting linker
errors:
>/u/.../x11_vpm.c:64 (/u/.../vpmgr.o): \
Undefined symbol _ServorVendor referenced from text segment
>/u/.../x11_vpm.c:73 (/u/.../vpmgr.o): \
Undefined symbol _Xflush referenced from text segment
>/u/.../x11_vpm.c:74 (/u/.../vpmgr.o): \
Undefined symbol _XDrawstring referenced from text segment
Now before you stop reading, yes I am using -lX11, in fact I've
used numerous combinations of
LDFLAGS=[-dynamic|-static] [-nojump] -lX11 -lXmu ...
with all the Xlibs I could find in /usr/lib; along with compiler
-g/-O options on and off. Still no dice.
My first thought was that that it wasn't looking in the right spot
for the libs (even though all the Xlibs were with libc, libm...):
so I did
mv /usr/lib/libX11.a /usr/lib/libX11.a.keh.
This time I got a "ld: <couldn't find/open libX11.a>" (paraphrased).
So it would seem that ld is finding all the -lX* libs and is opening
them; still though the dependencies are not resolved.
And I guess thats about the best description I can give of the problem
aside from:
>ls -l /usr/lib/libX*
>-rw-r--r-- 1 root wheel 451398 Feb 12 10:03 /usr/lib/libX11.a
>-rw-r--r-- 1 root wheel 144304 Feb 11 09:20 /usr/lib/libX11.sa
>-rw-r--r-- 1 root wheel 5826 Feb 12 10:03 /usr/lib/libXau.a
>-rw-r--r-- 1 root wheel 230084 Feb 12 10:04 /usr/lib/libXaw.a
>-rw-r--r-- 1 root wheel 26314 Feb 11 09:20 /usr/lib/libXaw.sa
>-rw-r--r-- 1 root wheel 12136 Feb 12 10:05 /usr/lib/libXdmcp.a
>-rw-r--r-- 1 root wheel 19424 Feb 12 10:06 /usr/lib/libXext.a
>-rw-r--r-- 1 root wheel 57312 Feb 11 09:20 /usr/lib/libXext.sa
>-rw-r--r-- 1 root wheel 33544 Feb 12 10:06 /usr/lib/libXi.a
>-rw-r--r-- 1 root wheel 78148 Feb 12 10:04 /usr/lib/libXmu.a
>-rw-r--r-- 1 root wheel 57664 Feb 11 09:20 /usr/lib/libXmu.sa
>-rw-r--r-- 1 root wheel 277998 Feb 12 10:03 /usr/lib/libXt.a
>-rw-r--r-- 1 root wheel 76168 Feb 11 09:20 /usr/lib/libXt.sa
>-rw-r--r-- 1 root wheel 3056 Feb 12 10:06 /usr/lib/libXtst.a
& my makefile is executing (this was my first attempt, from what I
have read from Xbooks this _should_ be what works):
> gcc -DGCCINLINUX -DCOMPILERANDOS -Wcomment \
> /usr/local/users/keith/o/vpmgr.o ... all my .o's\
> -dynamic -lX11 -lm -o /usr/local/users/keith/x/vpmgr
Any help would be greatly appreciated; please respond by email.
PS Perhaps if someone is feeling _really_ generous, they could
explain the difference between /usr/lib/*.a and /usr/lib/*.sa (static
or shared?); and why is there a /usr/lib/libm.ca instead of
/usr/lib/libm.sa?
GOD I HOPE THIS ISN'T LURKING IN THE FAQ SOMEWERE :-)