From owner-freebsd-hackers@FreeBSD.ORG Fri Sep 12 00:13:26 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A66A106566B for ; Fri, 12 Sep 2008 00:13:26 +0000 (UTC) (envelope-from titanandrews@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.243]) by mx1.freebsd.org (Postfix) with ESMTP id 131A08FC0C for ; Fri, 12 Sep 2008 00:13:25 +0000 (UTC) (envelope-from titanandrews@gmail.com) Received: by an-out-0708.google.com with SMTP id b33so77527ana.13 for ; Thu, 11 Sep 2008 17:13:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=GUe3/lc5mo2qJOzT020fvNOqc1ocOdlIbj8KV5UiMYU=; b=vfE4NzD87MYQV4r+Iqg3fkaohUBr0PKrXl7r1XWx5ajlKX3VpbM7WybMlam/ugE/CV P2Agmut8+JSlU3w+dzUfubKWG8sV3ykb3wpamNauyWR/OjuDq3PoXHJYrr6NBE5A2I8t Ne6pOjHIf1gKCb4TUFsI2DcR8ht/SFLr4IcPM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=IJ+QPe5IAG3cjcxwAm40MnHZlZ7QXiYX2n6kFcAc81E/GXBlvhNlZtkOm8mYBdZ5o+ +R1wBrW4dJrpzkwxIQ1xoSWALpH5HSfXtMaZXzDowgubxGKmZcgYK8ON7KAlDEeNoKH/ 1P66VyWEW6D3OGXpHEwYn7Lbvm67wiay+Z64M= Received: by 10.100.106.1 with SMTP id e1mr4471860anc.34.1221178405302; Thu, 11 Sep 2008 17:13:25 -0700 (PDT) Received: by 10.100.154.2 with HTTP; Thu, 11 Sep 2008 17:13:25 -0700 (PDT) Message-ID: Date: Thu, 11 Sep 2008 20:13:25 -0400 From: "Barry Andrews" To: "Brooks Davis" In-Reply-To: <20080911195653.GA53111@lor.one-eyed-alien.net> MIME-Version: 1.0 References: <20080911195653.GA53111@lor.one-eyed-alien.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: loading multi threaded library into executable enabled for single thread X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Sep 2008 00:13:26 -0000 FreeBSD version 5.5 output of ldd for my lib is: libbase.so: libutils.so => ./libutils.so (0x287e0000) libACE.so.5.5.6 => ./libACE.so.5.5.6 (0x2882d000) libxerces-c.so.27 => ./libxerces-c.so.27 (0x28976000) libsqlite3.so.8 => ./libsqlite3.so.8 (0x28d23000) libboost_regex-gcc40-mt-d-1_34.so.1.34.0 => ./libboost_regex-gcc40-mt-d-1_34.so.1.34.0 (0x28d76000) libstdc++.so.6 => ./libstdc++.so.6 (0x28e82000) libm.so.3 => /lib/libm.so.3 (0x28f53000) libgcc_s.so.1 => ./libgcc_s.so.1 (0x28f6e000) libpthread.so.1 => /usr/lib/libpthread.so.1 (0x28f78000) libc.so.5 => /lib/libc.so.5 (0x28079000) output of ldd for tclsh is: libtcl84.so.1 => /usr/local/lib/libtcl84.so.1 (0x28076000) libm.so.3 => /lib/libm.so.3 (0x28114000) libc.so.5 => /lib/libc.so.5 (0x2812f000) On Thu, Sep 11, 2008 at 3:56 PM, Brooks Davis wrote: > On Thu, Sep 11, 2008 at 03:06:35PM -0400, Barry Andrews wrote: > > Hi All, > > > > I have a multi-threaded library that is linked against libpthread. When I > > load this lib into a tclsh process on FreeBSD, I get this error, "Recurse > on > > private mutex". and crash. I understand that I can have this issue when > the > > executable is not linked against libpthread but one of the loaded libs > is. > > Basically, it thinks it's in single threaded mode. > > > > I can get around this issue, by doing export LD_PRELOAD=libpthread.so.1, > > however this is a hack at best. Is there any other way to get around this > > issue other than linking tclsh with libpthread ( because that's not an > > option) > > > > I thought of re-building libpthread with the offending code commented > out, > > and that did work, however I ran into other issues, so I think it's not a > > very "safe" option. > > > > My feeling is that this is a FreeBSD issue because it's not happening on > > other platforms, Linux, Solaris. > > > > Any suggestions are welcome. Many thanks! > > It would be helpful if you could provide: > - your FreeBSD version > - the output of "ldd libyourlib.so" > - the output of "ldd yourprogram" > > I wouldn't be supprised to find that the program and library are linked > against > different threading libraries. If so, one of them will need to be relinked > or > you will need to use libmap.conf to cause it to use the other one. > > -- Brooks >