https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58909
--- Comment #25 from Marc Glisse <glisse at gcc dot gnu.org> --- Note that this also affects dynamic linking with -Wl,--as-needed (which some platforms use by default). #include <mutex> int main(){ std::once_flag o; std::call_once(o, [](){}); } $ g++ b.cc -lpthread && ldd ./a.out linux-vdso.so.1 (0x00007ffca7b60000) libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9c809ac000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9c807e7000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9c806a3000) /lib64/ld-linux-x86-64.so.2 (0x00007f9c80bd4000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9c80689000) No libpthread there :-( (using -pthread instead of -lpthread works, but some build systems like cmake use -lpthread by default)