Boost logo

Boost :

From: Jonathan Wakely (cow_at_[hidden])
Date: 2004-07-29 05:52:17


On Thu, Jul 29, 2004 at 11:25:49AM +0100, John Maddock wrote:

> > Either add the "-pthread" option to your compiles (and links) manually,
> > or use a build system tool that adds it for you (like Boost.Build).
>
> 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.

jon

-- 
Dull but sincere filler

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