From owner-freebsd-threads@FreeBSD.ORG Sun Mar 2 17:18:49 2008 Return-Path: Delivered-To: threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9155D106566B for ; Sun, 2 Mar 2008 17:18:49 +0000 (UTC) (envelope-from jhein@timing.com) Received: from Daffy.timing.com (mx2.timing.com [206.168.13.218]) by mx1.freebsd.org (Postfix) with ESMTP id 520D08FC18 for ; Sun, 2 Mar 2008 17:18:49 +0000 (UTC) (envelope-from jhein@timing.com) Received: from gromit.timing.com (gromit.timing.com [206.168.13.209]) by Daffy.timing.com (8.13.1/8.13.1) with ESMTP id m22Gcr5u075937 for ; Sun, 2 Mar 2008 09:38:53 -0700 (MST) (envelope-from jhein@timing.com) Received: from gromit.timing.com (localhost [127.0.0.1]) by gromit.timing.com (8.14.2/8.14.2) with ESMTP id m22GcpMD058085; Sun, 2 Mar 2008 09:38:51 -0700 (MST) (envelope-from jhein@gromit.timing.com) Received: (from jhein@localhost) by gromit.timing.com (8.14.2/8.14.2/Submit) id m22Gcpfv058082; Sun, 2 Mar 2008 09:38:51 -0700 (MST) (envelope-from jhein) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18378.55323.480165.918523@gromit.timing.com> Date: Sun, 2 Mar 2008 09:38:51 -0700 From: John E Hein To: threads@freebsd.org X-Mailer: VM 7.19 under Emacs 22.1.1 X-Virus-Scanned: ClamAV version 0.91.2, clamav-milter version 0.91.2 on Daffy.timing.com X-Virus-Status: Clean Cc: Subject: running threaded tasks in dynamically linked objects from a non-threaded app X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Mar 2008 17:18:49 -0000 I am having some issues with an application that uses... [1] perl to run test scripts [2] with eventually call modules in C modules [3] which link with a lib that contains pthread* references. When the tests run, one gets undefined references to pthread calls from the run-time linker. [1] the perl port was not built WITH_THREADS=yes (non-threaded is the default) [3] this lib was built with -pthread, but this does not contain an explicit dependency on any threading library. That's how our -pthread works (so one can decide at the time an application is linked which threading lib to use) workarounds: - LD_PRELOAD=/usr/lib/libthr.so (or libpthread.so if desired) - require perl to be built WITH_THREADS=yes for users of this application - build the lib in [3] with -lthr or -lpthread. This can break if perl in built WITH_THREADS=yes and the threading libs in [1] and [3] don't match. These all have weaknesses in one facet or another. Are there any different solutions?