Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ld: -ldl: No such file or directory (help needed)

370 views
Skip to first unread message

Greg Whitlock

unread,
Sep 4, 1992, 1:12:30 PM9/4/92
to

I recently posted to this group concerning the undefined symbols _dlopen,
_dlclose, etc and would like to thank everyone who replied. Most everyone
told me to include the -ldl option on my final compilation line. I did
this but a new error has arose. It would seem this error is simple to fix
but I've been unable to fix it. Here goes:

When compiling xgopher with the -ldl option I get the following error:
[excerpt from compiling; Sun4; OS4.1.1]

athena% make
rm -f xgopher
gcc -fstrength-reduce -fpcc-struct-return -o xgopher xgopher.o list.o util.o misc.o net.o gui.o options.o help.o panel.o save.o text.o error.o cso.o index.o KeyWSink.o -g -L/usr/local/X/export/sparc/lib -L/usr/lib -lXaw -lXmu -lXt -lXext -lX11 -ldl -B/usr/bin/
ld: -ldl: No such file or directory
*** Error code 1
make: Fatal error: Command failed for target `xgopher'
athena%

(The same happens when enclosing -ldl within -Bstatic -BDynamic)

The following file exists in /usr/lib:
-rwxr-xr-x 1 root 24576 Oct 13 1990 /usr/lib/libdl.so.1.0

Someone suggested that -l looks only at *.a files in /usr/lib. If so,
how would I solve this problem?

I would greatly appreciate any help as this has gone beyond getting xgopher
and xarchie compiled. I would really like to solve this problem so noone
else has to deal with it.

Thanks.

-Greg Whitlock
(gr...@athena.cs.uga.edu)

Barry Margolin

unread,
Sep 5, 1992, 2:10:34 AM9/5/92
to
In article <1992Sep4.1...@athena.cs.uga.edu> gr...@athena.cs.uga.edu (Greg Whitlock) writes:
>gcc -fstrength-reduce -fpcc-struct-return -o xgopher xgopher.o list.o util.o misc.o net.o gui.o options.o help.o panel.o save.o text.o error.o cso.o index.o KeyWSink.o -g -L/usr/local/X/export/sparc/lib -L/usr/lib -lXaw -lXmu -lXt -lXext -lX11 -ldl -B/usr/bin/
>ld: -ldl: No such file or directory
...

>Someone suggested that -l looks only at *.a files in /usr/lib. If so,
>how would I solve this problem?

Your GCC must be configured to use its own linker rather than /usr/bin/ld.
The GNU linker doesn't know how to link dynamic libraries, and Sun only
ships libdl in its dynamic form.

The solution is to compile the program mit/util/dlsym.c from the X11R5
distribution, and link this into your program in place of -ldl.

Another solution is to use cc instead of gcc to link your programs.
--
Barry Margolin
System Manager, Thinking Machines Corp.

bar...@think.com {uunet,harvard}!think!barmar

0 new messages