From owner-freebsd-ports Mon Jul 24 14:20:15 2000 Delivered-To: freebsd-ports@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 4010937BC88 for ; Mon, 24 Jul 2000 14:20:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id OAA07877; Mon, 24 Jul 2000 14:20:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from bantha.org (adsl-117.ntrnet.net [208.241.154.117]) by hub.freebsd.org (Postfix) with ESMTP id EC39237B856 for ; Mon, 24 Jul 2000 14:19:06 -0700 (PDT) (envelope-from krinsky@sleepycat.com) Received: by bantha.org (Postfix, from userid 101) id B809866B69; Mon, 24 Jul 2000 17:18:59 -0400 (EDT) Message-Id: <20000724211859.B809866B69@bantha.org> Date: Mon, 24 Jul 2000 17:18:59 -0400 (EDT) From: krinsky@sleepycat.com Reply-To: krinsky@sleepycat.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: ports/20157: libtool incorrectly adds -lc to threaded apps Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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. 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