From: brad noyes (
Date: Tue Sep 09 2003 - 21:05:44 CDT

Yes this is a little strange, and i'm kind of confused by it. Here's what i
know so far.

On FreeBSD there's a package called pth, this is not shipped with freebsd, it
is a 3rd party implementation (it's the GNU implementation according to the
package comment). The package contains libpth, and libpthread. I think when
the linker uses '-lpthread' it tries to use the libpthread library from the
pth package, which seems to not work. However if the linker tag '-lpthread'
is omitted, then it will compile, link and execute fine.

I did some testing and it seems that there is no need to explicitly link to a
threading library. I compiled VMD without '-lpthread' and without '-lpth'. It
worked successfully and executed fine. (You can see the ldd output in the
attached nolpthread.txt, the file lpthread.txt is the ldd output of VMD
linked against libpthread) I also compiled with '-lpthread' to make sure it
was still crashing for me, which it was. Upon execution i got a segmentation
fault (somewhere in pthread_mutex_setkind_np, i think).

Apparently FreeBSD is doing a major upgrade to the libpthread implementation
so it is in flux on the current releases. Information about the upgrade can
be found here In the web page it looks
like on FreeBSD 4.x system the linker tag '-pthread' would do the trick. But
i can't test this since i don't have a 4.x system.

FreeBSD 5.1
  -lpthread: seg fault
  -lpth: executes fine
  -pthread: same as no linker tag
  no linker tag: executes fine

FreeBSD 4.8
  -lpthread: seg fault (according Tsu-Fan Cheng form the list)
  -lpth: ???
  -pthread: ???
  no linker tag: ???

So i hope this makes some sense. Perhaps if Tsu-Fan Cheng gets back to us we
could ask him to try various linker options to see what works.


On Tuesday 09 September 2003 20:43, you wrote:
> Brad,
> libpthread is shipped broken by default on FreeBSD??!?!?!?
> Do you know what the actual problem with their libpthread
> implementation is? I would be very interested to know why
> the crash occurs, and what libpth does differently to cure
> the problem. Seems hokey to me for the default libpthread
> to have serious problems. As far as changing the configure
> script, do you know if this alternate "libpth" is shipped
> by default with all FreeBSD machines?
> Thanks,
> John Stone
> On Tue, Sep 09, 2003 at 05:43:10PM -0400, brad noyes wrote:
> > Hi,
> > i think i have found the problem for the crashes on freebsd. At least
> > this fix seems to work for my desktop. Apparently there is a problem with
> > libpthread on freebsd, and therefor it has been deprecated. Instead VMD
> > should link to libpth. So in the src/ directory you can edit the Makefile
> > and change all occurrences of "-lpthread" to "-lpth", then run make.
> >
> > Sorry this took me 2 months to figure out, but i was stumped until i read
> > about libpthread on an unrelated list.
> >
> > John, Could you make the necessary change in the configure script?
> >
> > --brad