running threaded tasks in dynamically linked objects from a
non-threaded app
Jeremy Messenger
mezz7 at cox.net
Sun Mar 2 17:43:43 UTC 2008
On Sun, 02 Mar 2008 10:38:51 -0600, John E Hein <jhein at 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=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?
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 at cox.net - mezz at FreeBSD.org
FreeBSD GNOME Team
http://www.FreeBSD.org/gnome/ - gnome at FreeBSD.org
More information about the freebsd-threads
mailing list