Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 02 Mar 2008 11:33:35 -0600
From:      "Jeremy Messenger" <mezz7@cox.net>
To:        "John E Hein" <jhein@timing.com>
Cc:        threads@freebsd.org
Subject:   Re: running threaded tasks in dynamically linked objects from a non-threaded app
Message-ID:  <op.t7egd9di9aq2h7@mezz.mezzweb.com>
In-Reply-To: <18378.55323.480165.918523@gromit.timing.com>
References:  <18378.55323.480165.918523@gromit.timing.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 02 Mar 2008 10:38:51 -0600, John E Hein <jhein@timing.com> wrote=
:

> 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=3Dyes (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=3D/usr/lib/libthr.so (or libpthread.so if desired)
>  - require perl to be built WITH_THREADS=3Dyes for
>    users of this application
>  - build the lib in [3] with -lthr or -lpthread.  This
>    can break if perl in built WITH_THREADS=3Dyes 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?

Are you using FreeBSD 6.x or below? I think it has been fixed in FreeBSD=
  =

7.x and above with GCC 4.x. I only have tested it with Ruby.

Cheers,
Mezz


-- =

mezz7@cox.net  -  mezz@FreeBSD.org
FreeBSD GNOME Team
http://www.FreeBSD.org/gnome/  -  gnome@FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?op.t7egd9di9aq2h7>