Date: Mon, 24 Jul 2000 17:18:59 -0400 (EDT) From: krinsky@sleepycat.com To: FreeBSD-gnats-submit@freebsd.org Subject: ports/20157: libtool incorrectly adds -lc to threaded apps Message-ID: <20000724211859.B809866B69@bantha.org>
next in thread | raw e-mail | index | archive | help
>Number: 20157 >Category: ports >Synopsis: libtool incorrectly adds -lc to threaded apps >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 24 14:20:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: David Krinsky >Release: FreeBSD 4.0-CURRENT i386 >Organization: Sleepycat Software >Environment: FreeBSD bantha.org 4.0-CURRENT FreeBSD 4.0-CURRENT #2: Wed May 10 14:53:21 EDT 2000 (x86) (but presumably all FreeBSDs) >Description: libtool, as available both from the main distribution site and in the FreeBSD ports collection, always adds the -lc flag when it links libraries it builds. However, on FreeBSD, it is incorrect to specify -lc when one builds libraries that are intended for use with threaded applications; such applications should be linked against libc_r.so instead of libc.so, and the selection of which library to use should be made using the -pthread flag to gcc rather than any explicit -l<foo>. Applications which wind up linked against both libc.so and libc_r.so may behave in unpredictable and ugly ways. >How-To-Repeat: I don't have a simple test case handy, but the default build of Sleepycat's Berkeley DB 3.1.14 (available from http://www.sleepycat.com) manifests this problem. I believe the errant lines are as follows (in ltmain.sh, starting at line 1762): case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *) # Add libc to deplibs on all other systems. deplibs="$deplibs -lc" ;; esac >Fix: This may not be the cleanest, but it works and is what we are planning to put in the ltmain.sh included with an upcoming release of Berkeley DB: *** ltmain.sh.orig Thu Apr 29 09:30:37 1999 --- ltmain.sh Mon Jul 24 17:13:07 2000 *************** *** 1762,1769 **** --- 1762,1777 ---- case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; + + #### local change for FreeBSD: + # The following case is added, since the linker's -pthread + # option implicitly controls use of -lc or -lc_r. + *freebsd2*|*freebsd3*|*freebsdelf3*|*freebsd4*) + # defer to whether the user wants -lc, or -lc_r + ;; + *) # Add libc to deplibs on all other systems. deplibs="$deplibs -lc" ;; In any case, I'm pretty sure libtool shouldn't specify any particular C library at all. This may well be the libtool people's bug to fix rather than yours, but I wanted to alert you to it (and let you decide whether to include a patch in the ports collection and/or hound the libtool folks yourself). Thanks! >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000724211859.B809866B69>