|
Boost : |
From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2003-08-22 08:34:58
Geurt Vos wrote:
> I mean, is boost bjammed correctly for thread
> support? The thing is that the following code
> segfaults on '-pthread'
>
> #include <boost/filesystem/operations.hpp>
>
> int main()
> {
> *boost::filesystem::directory_iterator("/");
> }
>
> ------------
>
> # g++ -o test test.cpp -lboost_filesystem
> # ./test
> --- no problem
>
> # g++ -pthread -o test test.cpp -lboost_filesystem
> #./test
> --- segmentation fault
The order in which you specify libraries matters.
Therefor, -pthread (which is an alias to -lpthread) should
come last, as it redefines system level API functions (i.e. it
replaces the 'standard' ones with their reentrant counterparts.
At least that's how it works on linux...
(Dunno whether that will solve your problem, though)
For a more in depth discussion of these (and related) issues,
you may want to have a look into the excellent
paper by Ulrich Drepper explaining symbol resolution
from shared libraries:
http://people.redhat.com/drepper/dsohowto.pdf
Regards,
Stefan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk