GCC doesn't work "ld.exe: cannot find -lpthread"

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

GCC doesn't work "ld.exe: cannot find -lpthread"

entwikelaar
Hey folks,
I just installed MinGW using mingw-get-setup.exe and installed
mingw32-base, I then added the MinGW bin folder to my user PATH.
To test gcc I created a simple hello world C program.
However when I run "gcc test.c" it doesn't compile and I get the
following error:

c:/_programs/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe:
cannot find -lpthread
collect2.exe: error: ld returned 1 exit status

gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/_programs/mingw/bin/../libexec/gcc/mingw32/5.3.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-5.3.0/configure --build=x86_64-pc-linux-gnu
--host=mingw32 --prefix=/mingw --disable-win32-registry --target=mingw32
--with-arch=i586 --enable-languages=c,c++,objc,obj-c++,fortran,ada
--enable-static --enable-shared --enable-threads=posix --with-dwarf2
--disable-sjlj-exceptions --enable-version-specific-runtime-libs
--enable-libstdcxx-debug --with-tune=generic --enable-libgomp
--disable-libvtv --enable-nls
Thread model: posix
gcc version 5.3.0 (GCC)

ld -v:
GNU ld (GNU Binutils) 2.25.1

ld -lpthread:
ld: cannot find -lpthread

I am using Windows 7 64-bit and the latest MinGW. I would appreciate any
help.

Regards,
entwikelaar

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: GCC doesn't work "ld.exe: cannot find -lpthread"

Keith Marshall-3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/09/16 11:17, [hidden email] wrote:
> ... when I run "gcc test.c" it doesn't compile and I get the
> following error:
>
> .../ld.exe: cannot find -lpthread collect2.exe: error: ld returned
> 1 exit status

So, a missing libpthread.a or libpthread.dll.a dependency; thanks for
bringing this to our attention.

> gcc -v: Using built-in specs. ... Thread model: posix gcc version
> 5.3.0 (GCC)

This configuration causes GCC to add the "-lpthread" dependency, even
if your application doesn't (ultimately) need it.

> I am using Windows 7 64-bit and the latest MinGW. I would
> appreciate any help.

You should install the libpthreadgc-dev package; (from the CLI):

  mingw-get install libpthreadgc-dev

(or, if you are a GUI junkie, run mingw-get in GUI mode -- DO NOT run
mingw-get-setup.exe again -- scroll down until you find it, and
install it from there).

Of course, mingw-get should have known about this dependency, when you
installed GCC; I need to fix that, but a manual installation is still
going to be the quickest and easiest way to get you up and running.

- --
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iQIcBAEBAgAGBQJXzBHpAAoJEMCtNsY0flo/voIQAIMj3rsvgyiTWBclo4v9YlFy
2Qy2QDYVuzWbp4nihMJf1CV4nQD89gzQrRtCgJoi6VBxrpJZriTFn9Iai8xnAyDe
mRZ3D2Zo6xj4BO2+eoapVAsAYAqBIq5XGAnxqZTHnnvv61tGXhgiyV+67LORoh37
KJqOSCJxfVs8SueqQjKbQ/bwuD04xbj8RHe6sZbSDkWMEbaY3UBW1xSeJVSEffSd
1/DeAjMKNchYOieX1H0i5J0tVjNy8oMo6o7dHMXgapZrduCxQUd52fRHS/3Snj2V
EwySHzZ2v7A4DdKozN1l1aV3HrciCogM983WrCXC7thgDsvdkQ+Um4MZ7whMIDd1
JMd0QTAX9fkQEU0thjBSRdvH2N9xBH8zL1dZVIQkcz2ZZz8hBttYcVLLA+ao+lPU
y4T5MhCAXKgXksz0RZrUw0+p0PxReYg8yrluNj4h74t4o+XS2o687/FVT8b7Zd87
osLlguQLP7DSYoElsfBvPnwhoufMmjKEuzT/nQ2N29TA48ALtKI000yEwNNtfRCV
8+Ci3G9GFz8kM0nf2hhCal5E8LjyultGluVd1/6tUfGaC111z93Pkvdn4bhFGkpg
X19talOOqQpkOO5vIk4rzv9j+R0rp9Nqm5XNo36RwwpXR0br6ci6L1VcGSX2WAsi
4+RyMR8ruWC4pwRgEYLr
=kh+G
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: GCC doesn't work "ld.exe: cannot find -lpthread"

Keith Marshall-3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/09/16 13:22, Keith Marshall wrote:
> Of course, mingw-get should have known about this dependency, when
> you installed GCC; I need to fix that, but a manual installation
> is still going to be the quickest and easiest way to get you up
> and running.

This should now be fixed; you need to update your local copy of the
catalogue, to capture the change.

- --
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iQIcBAEBAgAGBQJXzUyBAAoJEMCtNsY0flo/o/4P/2SwaHs7DdC5tEc7xlfTvmCE
V6xrPLGdVz9S0La/iYb4jGJwa7yNkhF6BOoCvlTEAS4E9J9xQvz2J3Ch8WN9OE6U
dc7qcB9f/KDMkyTUCTXDNUYo8+ttIDm8p2v5JZpTTLCR1Aog/fedeSzoynGp3HH6
p9bsU4C1L9EjEX0UGKZZmx2Nd+OBFAuf7Bel/xUZ4FCk7n5Csq+qz8gfysxKjfTX
Wx56m5h8jG51VZZOpRDFKbM0IYOpTcZakPxdng8dvtLv622FOsDn0yfAzShrtY7S
p3dSfRnv0+b6LyoEdwqM++YLgOdpkVPHQg8rp7jwMZcqusW7ZjyxS667y76YF0+d
knbo6FOjFnJH7CItnPkPIbaNOF94R7/Ft46dZUKWlKrAlkhDXZ8EP2s0owBGNykc
4Qx+q5osQNfMWeI+YZFchvQt9IDmzt/juLJHM3IvQPDTPYHsMREyH77fL4M6R/d4
0cvY/FuuE7ggyoJBbYHVE5Iyj3qsla3V3BEr4udapxo7GpYuDjNWJDT0xKuc0Ipa
p1P5/aCQLfuYOB1BUg/UnZNpl+IHCJ3lboKO+ZGkB/QwEdP6N8kVD2GvqYLYhFCw
IgjY4lzB+O3kQbGlWwdlWRd9mcBP4rc81v3Tbi6yCmuF2t89SGs/sp/W6Yvhbdnl
S6ftLXq4MGmmuKmjXota
=P0eF
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Loading...