Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2004-07-29 06:22:09


> > There isn't a -pthread option on BSD, it's spelled -lpthread :-)
>
> Are you sure?
>
> $ uname
> FreeBSD
> $ gcc -pthread
> gcc: No input files specified
> $ gcc -pthreads
> gcc: unrecognized option `-pthreads'
> gcc: No input files specified
> $ gcc -lpthread
> /usr/libexec/elf/ld: cannot find -lpthread
> $ locate libpthread
> /usr/compat/linux/lib/libpthread-0.9.so
> /usr/compat/linux/lib/libpthread.so.0
>
> libpthread doesn't exist on most FreeBSD systems, unless (as above) as
> part of the linux compatibility runtime, used when running linux
> executables). Instead the pthread_* functions are contained in a
> reentrant version of libc: libc_r.
>
> For GCC 3 on FreeBSD when -pthread is given then the linker is passed
> -lc_r (to link to the reentrant version of libc) and when -pthread is
> absent the linker is passed -lc (the non-reentrant libc).
>
> (It's slightly complicated by the absence/presence of -pg, as there are
> also profiling versions of libc, so you end up with one of libc, libc_r,
> libc_p, or libc_r_p)
>
> The behaviour seems to be the same on GCC 2.95 though I haven't
> checked the source to confirm that.

You're right!

Serves me right for relying on memory, I take it all back, -pthread is the
option to use.

Thanks!

John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk