running threaded tasks in dynamically linked objects from a
John E Hein
jhein at timing.com
Sun Mar 2 17:18:49 UTC 2008
I am having some issues with an application that uses...
 perl to run test scripts
 with eventually call modules in C modules
 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.
 the perl port was not built WITH_THREADS=yes (non-threaded
is the default)
 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)
- 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  with -lthr or -lpthread. This
can break if perl in built WITH_THREADS=yes and
the threading libs in  and  don't match.
These all have weaknesses in one facet or another.
Are there any different solutions?
More information about the freebsd-threads