https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104852
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- This is the usual problem with weak symbols and static linking. For distros other than Red Hat (and Fedora, CentOS etc.) you need to use: -Wl,--whole-archive -lpthread -Wl,--no-whole-archive Otherwise the pthread symbols do not get pulled in by the linker. For GCC 12 and Glibc 2.34 that isn't needed, since r12-5108