delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/07/11/16:39:23

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Ralf Habacker" <Ralf DOT Habacker AT freenet DOT de>
To: <cygwin AT cygwin DOT com>
Subject: RE: Problem in compiling : cannot find -ldl
Date: Fri, 11 Jul 2003 22:39:57 +0200
Message-ID: <011901c347ec$99909830$0a1c440a@BRAMSCHE>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
In-Reply-To: <Pine.CYG.4.55.0307091141250.2788@ellixia>

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 DOT habacker AT freenet DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019