detailed question about X11 library

Jonathan Walton yellowdog-general@lists.terrasoftsolutions.com
Fri Jan 24 22:39:01 2003


>   There are several routines that fail the compile, so I am only showing one
> below (the smallest). The function open_log fails during a link to the X11
> library. It is not clear in the source code why X11 is involved.  I have not
> gotten the X11 source code to see where and what this is. Does anyone
> recognize what this problem might be?

actually, they compiled fine... they failed to link.  It couldn't find
dlsym, dlopen, or dlclose in any libraries.

"man dlsym" doesn't say this directly, but they have an example which
throws -ldl on the link line.. and
 nm /usr/lib/libdl.a converms that those symbols are defined in that
 library.

So if you add "-ldl" in your makefile [I think after -lm should be fine],
it should work.

Jonathan


> make[4]: Entering directory `/usr/local/ncarg-4.3.1/ncarview/src/bin/ctrans'
> gcc -ansi  -O    -o ctrans main.o
>   ../../../.././ncarview/src/lib/libctrans/libctrans.o \
>   -L../../../.././ncarview/src/lib/libcgm -lcgm \
>   -L../../../.././ncarview/src/lib/libncarg_ras -lncarg_ras \
>   -L../../../.././common/src/libncarg_c -lncarg_c -Wl,-Bstatic \
>   -L/usr/local/ncarg-4.3.1/lib -L/usr/X11R6/lib -L/usr/local/lib -lXpm -lX11 \
>   -lXext    -Wl,-Bdynamic -lm 
> 
> main.o: In function `open_log':
> main.o(.text+0x29c): the use of `mktemp' is dangerous, better use `mkstemp'
> /usr/X11R6/lib/libX11.a(XlcDL.o): In function `try_both_dlsym':
> XlcDL.o(.text+0x174): undefined reference to `dlsym'
> XlcDL.o(.text+0x174): relocation truncated to fit: R_PPC_REL24 dlsym
> XlcDL.o(.text+0x198): undefined reference to `dlsym'
> XlcDL.o(.text+0x198): relocation truncated to fit: R_PPC_REL24 dlsym
> /usr/X11R6/lib/libX11.a(XlcDL.o): In function `open_object':
> XlcDL.o(.text+0x78c): undefined reference to `dlopen'
> XlcDL.o(.text+0x78c): relocation truncated to fit: R_PPC_REL24 dlopen
> /usr/X11R6/lib/libX11.a(XlcDL.o): In function `close_object':
> XlcDL.o(.text+0x830): undefined reference to `dlclose'
> XlcDL.o(.text+0x830): relocation truncated to fit: R_PPC_REL24 dlclose
> collect2: ld returned 1 exit status
> make[4]: *** [ctrans] Error 1
> make[4]: Leaving directory `/usr/local/ncarg-4.3.1/ncarview/src/bin/ctrans'