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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to