On Thu, 19 Dec 2013, Diego Biurrun wrote:
On Thu, Dec 19, 2013 at 04:36:10PM +0200, Martin Storsjö wrote:
On Tue, 17 Dec 2013, Luca Barbato wrote:
On 17/12/13 21:06, Martin Storsjö wrote:
On Fri, 13 Dec 2013, Luca Barbato wrote:
Module: libav
Branch: master
Commit: a5a3b398fd9dce38ca50b20f182b17a256d209f2
Author: Luca Barbato <[email protected]>
Committer: Luca Barbato <[email protected]>
Date: Thu Dec 12 17:05:34 2013 +0100
configure: Reorder pthreads checks
Some pthreads symbols might be present in libc (as shown on various *BSD)
but not all of them, leading to false positives.
Check for the most common compiler flags before the plain symbol check
to avoid known pitfalls.
---
configure | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
FWIW, this causes clang/OSX to give warnings when linking about the
-pthreads parameter being unused. My vote earlier was on checking for 2
(or more if needed) different pthreads functions to sort out the issue,
but if the extra warning is the only issue and others don't think it's
important I guess I don't mind.
Sigh, I let this patch and the alternative on review for weeks and I
wanted not to keep the BSD broken for that long...
The alternative probably can be fixed and used instead if Diego isn't
that against it.
(clang on linux does accept -pthread obviously =_=)
So, what do others think, would it be acceptable to check for
multiple functions for this case, since blindly testing flags can
end up with odd situations like this where -pthread doesn't fail but
adds warnings to the build.
Could somebody summarize what the exact issues are on all the platforms?
The information is scattered over many messages and commits so that it is
hard to follow what the actual problems are.
IIRC, the three points we'd have to accommodate are:
clang-asan (or was it -tsan?) does provide pthread_create via something
that is linked in by default, but not pthread_join. Checking only for
pthread_create gives false positives (not adding all the necessary flags
for linking a real application).
Some BSD libcs contain pthread_join but not pthread_create, giving false
positives just like above but in the other way around.
These two issues can either be solved by checking for two (or more)
pthread functions, weeding out the false positives, or as now, by checking
for pthread functions with the linker flag '-pthread' and '-pthreads'
before trying e.g. '-lpthread' or trying if it works with no flags at all.
On OS X, all pthread functions are provided by libc by default and no
extra flags are needed. But on clang, providing -pthread to the linker
doesn't fail, but just gives a warning that the flag is ignored/unused.
With the current solution for the problem above (checking with some flags
before checking for the case of no flags at all), this gives extra
warnings when linking on OS X:
https://fate.libav.org/x86_64-apple-darwin-clang-3.3/20131217111902/compile
(see close to the end when linking avconv etc)
Therefore I think it would be a more robust solution to restore the order
of the pthread checks as it was before, but check for both pthread_create
and pthread_join, possibly also checking other functions if necessary.
// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel