Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Mar 2008 09:38:51 -0700
From:      John E Hein <jhein@timing.com>
To:        threads@freebsd.org
Subject:   running threaded tasks in dynamically linked objects from a non-threaded app
Message-ID:  <18378.55323.480165.918523@gromit.timing.com>

next in thread | raw e-mail | index | archive | help
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?



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