Bug 198794 - [patch] Mk/bsd.port.mk : Fix PTHREAD_LIBS definition
Summary: [patch] Mk/bsd.port.mk : Fix PTHREAD_LIBS definition
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Port Management Team
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-03-22 16:32 UTC by John Marino
Modified: 2015-03-26 09:18 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Marino freebsd_committer freebsd_triage 2015-03-22 16:32:27 UTC
PTHREAD_LIBS is defined as "-pthread".  It should be "-lpthread".

Quoting tijl@
"FreeBSD used to have two libc, one without threading (libc.so) and one with (libc_r.so).  With -pthread the compiler would link with libc_r instead of libc.  Nowadays there's only one libc and -pthread tells the compiler to link with libpthread, exactly like -lpthread does.  Both work and patches that change -lpthread into -pthread or vice versa are redundant."

I'll commit the patch if this is approved.
Comment 1 Bryan Drewery freebsd_committer freebsd_triage 2015-03-23 03:15:02 UTC
Based on Tijl's comment I see no reason to change it.
Comment 2 John Marino freebsd_committer freebsd_triage 2015-03-23 08:16:21 UTC
Using -pthread is wrong.  The infrastructure should not be doing the wrong thing by default. 

We certainly should not be patching good -lpthread with -pthread, which multitudes of ports are doing.  It's hard to tell people not to do it when the PTHREAD_LIBS variable is defined the same.

In context, tijl's comment was there to support the removal of -pthread, not justify keeping it.
Comment 3 Baptiste Daroussin freebsd_committer freebsd_triage 2015-03-23 13:47:08 UTC
It has been discussed long ago, and some people already went through working on this (we for example provided a blanket to gahr long ago to work on this issue, but he never got time to finish). The work was to entirely drop the PTHREAD_LIBS from bsd.port.mk by first remove all PTHREAD_LIBS references from the ports and then drop entirely PTHREAD_LIBS from bsd.port.mk
Comment 4 Bryan Drewery freebsd_committer freebsd_triage 2015-03-23 15:15:21 UTC
Based on more conversations I will say I agree that we should not be using PTHREAD_LIBS or replacing -pthread or -lpthread with the alternative. Doing that cleanup effort is worth it.

I may have misunderstood the original intent; I don't think we should prefer -pthread over -lpthread.
Comment 5 Bryan Drewery freebsd_committer freebsd_triage 2015-03-24 02:48:36 UTC
So going back to the original description, we should have a goal of removing PTHREAD_LIBS. Changing it doesn't make sense.
Comment 6 John Marino freebsd_committer freebsd_triage 2015-03-24 10:54:41 UTC
using find/grep, a quick estimate is that 410 ports use PTHREAD_LIBS (FYI)
Comment 7 John Marino freebsd_committer freebsd_triage 2015-03-24 11:21:42 UTC
more info on breakdown by category:

 1 archivers
 1 dns
 1 french
 1 japanese
 1 news
 1 ports-mgmt
 1 sysutils
 1 x11-wm
 2 cad
 2 devel
 2 java
 2 x11-fm
 3 biology
 3 deskutils
 3 irc
 3 x11-clocks
 4 benchmarks
 4 misc
 4 textproc
 4 www
 5 ftp
 5 net-im
 5 net-mgmt
 6 editors
 6 x11
 7 x11-toolkits
 8 print
 8 science
 9 emulators
 9 net-p2p
11 comms
15 math
20 security
26 databases
26 mail
27 lang
28 multimedia
33 graphics
37 audio
37 games
38 net
Comment 8 John Marino freebsd_committer freebsd_triage 2015-03-25 23:56:11 UTC
okay, I think all the ${PTHREAD_LIBS} in ports have been removed.  Can we remove it from mk.port.mk now?
Comment 9 John Marino freebsd_committer freebsd_triage 2015-03-26 09:18:48 UTC
It's done (r382294)