This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Problem in compiling : cannot find -ldl


Elfyn McBratney wrote:

> > Here is the line for the compilation :
> >
> > " gcc -o wish.exe OBJ/wish.o OBJ/calculPosition.o
> > OBJ/calculVisibiliteCmd.o -L/usr/lib -L/usr/X11R6/lib
> > -ltk -ltcl -ldl -lX11 -lm "
> >
> > and it produces this error :
> >
> > "
> > /usr/lib/gcc-lib/i686-pc-cygwin/3.2/../../../../i686-pc-cygwin/bin/ld
> > : cannot find -ldl "
>
> libdl is a linux'ism. You don't need it. We don't have it :-) Just
> remove '-ldl' from the Makefile or link line.
>

Hmmh, is cygwin a unix emulation environment ? Usually in linux libdl contains
symbols for dynamic loading of shared libraries. In cygwin this is provided by
the libcygwin.

To ensure linux compatibility there are additional import libraries like
libpthread.a providing symbols of the cygwin dll, so that users does not have to
deal with the specific cygwin implementation.

But one thing I never understood with cygwin is, why libdl.a isn't provided in
the way libpthread does.

I have encountered several linux libs, which requires this libraries, so that I
have to add a symbolic link from /lib/libcygwin.a to /lib/libdl.a on any
machine, which does compiling such libs.

If anyone is interested to add a compatibility library for libdl.a, apply the
following patch to the cygwin sources.

Cheers
Ralf

--------------------------------------------------------------------------------
-----------------

2003-07-11  Ralf Habacker  <ralf.habacker@freenet.de>

	* Makefile.in (libdl.a): provide unix compatibility library
	for dlopen related functions.


--------------------------------------------------------------------------------
-----------------
$ diff -up Makefile.in.orig Makefile.in
--- Makefile.in.orig    2003-07-11 22:31:10.000000000 +0200
+++ Makefile.in 2003-07-11 22:32:09.000000000 +0200
@@ -233,7 +233,7 @@ NEW_FUNCTIONS:=regcomp posix_regcomp \
 API_VER:=$(srcdir)/include/cygwin/version.h

 PWD:=${shell pwd}
-SUBLIBS:=libpthread.a $(PWD)/libm.a libc.a
+SUBLIBS:=libpthread.a libdl.a $(PWD)/libm.a libc.a
 EXTRALIBS:=libautomode.a libbinmode.a libtextmode.a
 INSTOBJS:=automode.o binmode.o textmode.o
 TARGET_LIBS:=$(LIB_NAME) $(SUBLIBS) $(CYGWIN_START) $(GMON_START) $(LIBGMON_A)
$(SUBLIBS) $(INSTOBJS) $(EXTRALIBS)
@@ -379,10 +379,13 @@ shared.o: shared_info_magic.h
 libpthread.a: speclib cygwin.def pthread.o thread.o
        /bin/sh ${word 1, $^} $@ "${NM}" "${DLLTOOL}" "${AS}" ${wordlist 2, 99,
$^}

+libdl.a: speclib cygwin.def dlfcn.o
+       /bin/sh ${word 1, $^} $@ "${NM}" "${DLLTOOL}" "${AS}" ${wordlist 2, 99,
$^}
+
 $(PWD)/libm.a: speclib cygwin.def $(LIBM)
        /bin/sh ${word 1, $^} $@ "${NM}" "${DLLTOOL}" "${AS}" ${wordlist 2, 99,
$^}

-$(PWD)/libc.a: speclib cygwin.def $(PWD)/libm.a libpthread.a
+$(PWD)/libc.a: speclib cygwin.def $(PWD)/libm.a libpthread.a libdl.a
        /bin/sh ${word 1, $^} -v $@ "${NM}" "${DLLTOOL}" "${AS}" ${wordlist 2,
99, $^}

 lib%.a: %.o






--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]