The single-threaded C++ program below compiles with or without -lpthread, but behaves differently. The issue appears to be that libc.so provides an implementation of pthread_exit() that does not do stack-unwinding, but the libpthread.so version does do stack unwinding. I believe that either behaviour complies with the standards, but it would be nice if glibc was consistent in its behaviour. $ g++ -o temp temp.cc -pthread && ./temp Hi there! $ g++ -o temp temp.cc && ./temp (no output) This is Fedora glibc-2.23.1-10.fc24.x86_64 ----------------------------- #include <pthread.h> #include <stdio.h> struct Foo { ~Foo() { printf("Hi there!\n"); } }; int main() { Foo foo; pthread_exit(NULL); return 0; }
With lbipthread move to libc this issue does not happen anymore. Fixed on 2.34 (c62cef023cdcd8349369ef4e0d08290e495659be).