https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79182
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |jakub at gcc dot gnu.org Resolution|--- |INVALID --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- That is a libc issue, statically linking only parts of -lpthread often results in broken programs, unless libpthread.a ensures all of libpthread is linked when linking statically (e.g. what is done in some distributions where libpthread.a contains only libpthread.o - result of ld -r). If your distro isn't doing this, I'm afraid you need to use -static --Wl,--whole-archive -lpthread -Wl,--no-whole-archive.