NoLongerBreathedIn
NoLongerBreathedIn

Reputation: 73

mingw ld cannot find -lpthread?

I'm trying to cross-compile a C/C++ program for Windows on Linux.

I've gotten to the point where everything compiles properly, except that x86_64-w64-mingw32/bin/ld is called with the option -lpthread, which doesn't work.

I'm not sure why it's called with that option, because I'm 100% certain that there are no references in the code to threads except through CreateThread, which is part of the Windows API. There's no good reason for mingw to try to link in pthreads if I'm not using them, right?

(Fedora 32 but 64-bit, if it helps.)

Upvotes: 0

Views: 1188

Answers (1)

Bin Meng
Bin Meng

Reputation: 1

There is no way to teach the GCC compiler driver to drop "-lpthread" if the compiler was configured to include pthread support.

I guess you are trying to do a static build (?) and the libpthread.a is not installed by your toolchain. See a related bug report @ https://bugzilla.redhat.com/show_bug.cgi?id=2070571

Upvotes: 0

Related Questions