* [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
@ 2022-01-19 11:54 Anton Khirnov
2022-01-19 12:34 ` James Almer
0 siblings, 1 reply; 15+ messages in thread
From: Anton Khirnov @ 2022-01-19 11:54 UTC (permalink / raw)
To: ffmpeg-devel
C11 atomics in some configurations (e.g. 64bit operations on ppc64 with
GCC) require linking to libatomic.
---
Testing welcome, especially in configurations where
* libatomic is not present
* libatomic is actually needed
---
configure | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index 1413122d87..1ff5dbee5b 100755
--- a/configure
+++ b/configure
@@ -6324,7 +6324,14 @@ check_headers asm/types.h
# it seems there are versions of clang in some distros that try to use the
# gcc headers, which explodes for stdatomic
# so we also check that atomics actually work here
-check_builtin stdatomic stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
+#
+# some configurations also require linking to libatomic, so try
+# both with -latomic and without
+for LATOMIC in "-latomic" ""; do
+ check_builtin stdatomic stdatomic.h \
+ "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar" \
+ $LATOMIC && add_extralibs $LATOMIC && break
+done
check_lib advapi32 "windows.h" RegCloseKey -ladvapi32
check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt &&
--
2.33.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
2022-01-19 11:54 [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present Anton Khirnov
@ 2022-01-19 12:34 ` James Almer
2022-01-19 12:37 ` Andreas Rheinhardt
2022-01-19 12:40 ` Anton Khirnov
0 siblings, 2 replies; 15+ messages in thread
From: James Almer @ 2022-01-19 12:34 UTC (permalink / raw)
To: ffmpeg-devel
On 1/19/2022 8:54 AM, Anton Khirnov wrote:
> C11 atomics in some configurations (e.g. 64bit operations on ppc64 with
> GCC) require linking to libatomic.
> ---
> Testing welcome, especially in configurations where
> * libatomic is not present
> * libatomic is actually needed
> ---
> configure | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 1413122d87..1ff5dbee5b 100755
> --- a/configure
> +++ b/configure
> @@ -6324,7 +6324,14 @@ check_headers asm/types.h
> # it seems there are versions of clang in some distros that try to use the
> # gcc headers, which explodes for stdatomic
> # so we also check that atomics actually work here
> -check_builtin stdatomic stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
> +#
> +# some configurations also require linking to libatomic, so try
> +# both with -latomic and without
> +for LATOMIC in "-latomic" ""; do
Shouldn't you try without it first? On my toolchain libatomic is
present, but libraries compile without linking to it just fine. That
changes after this patch, where it starts linking to it explicitly.
> + check_builtin stdatomic stdatomic.h \
> + "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar" \
> + $LATOMIC && add_extralibs $LATOMIC && break
You should probably add it to the required libraries' extralibs only.
Just replace the add_extralibs part with setting stdatomic_extralibs to
$LATOMIC, and then add stdatomic to all the libraries' _suggest lists,
same as we do for libm.
> +done
>
> check_lib advapi32 "windows.h" RegCloseKey -ladvapi32
> check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt &&
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
2022-01-19 12:34 ` James Almer
@ 2022-01-19 12:37 ` Andreas Rheinhardt
2022-01-19 12:40 ` Anton Khirnov
1 sibling, 0 replies; 15+ messages in thread
From: Andreas Rheinhardt @ 2022-01-19 12:37 UTC (permalink / raw)
To: ffmpeg-devel
James Almer:
>
>
> On 1/19/2022 8:54 AM, Anton Khirnov wrote:
>> C11 atomics in some configurations (e.g. 64bit operations on ppc64 with
>> GCC) require linking to libatomic.
>> ---
>> Testing welcome, especially in configurations where
>> * libatomic is not present
>> * libatomic is actually needed
>> ---
>> configure | 9 ++++++++-
>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index 1413122d87..1ff5dbee5b 100755
>> --- a/configure
>> +++ b/configure
>> @@ -6324,7 +6324,14 @@ check_headers asm/types.h
>> # it seems there are versions of clang in some distros that try to
>> use the
>> # gcc headers, which explodes for stdatomic
>> # so we also check that atomics actually work here
>> -check_builtin stdatomic stdatomic.h "atomic_int foo, bar =
>> ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
>> +#
>> +# some configurations also require linking to libatomic, so try
>> +# both with -latomic and without
>> +for LATOMIC in "-latomic" ""; do
>
> Shouldn't you try without it first? On my toolchain libatomic is
> present, but libraries compile without linking to it just fine. That
> changes after this patch, where it starts linking to it explicitly.
>
This would work if this test checked for all the atomic operations that
might be needed; but it doesn't: It checks just for atomic increment and
only for atomic_int. What is if atomic_increment can be done without
recourse to libatomic because of hardware support whereas another atomic
operation needs libatomic?
>> + check_builtin stdatomic
>> stdatomic.h \
>> + "atomic_int foo, bar = ATOMIC_VAR_INIT(-1);
>> atomic_store(&foo, 0); foo += bar" \
>> + $LATOMIC && add_extralibs $LATOMIC && break
>
> You should probably add it to the required libraries' extralibs only.
> Just replace the add_extralibs part with setting stdatomic_extralibs to
> $LATOMIC, and then add stdatomic to all the libraries' _suggest lists,
> same as we do for libm.
>
>> +done
>> check_lib advapi32 "windows.h" RegCloseKey
>> -ladvapi32
>> check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom
>> -lbcrypt &&
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
2022-01-19 12:34 ` James Almer
2022-01-19 12:37 ` Andreas Rheinhardt
@ 2022-01-19 12:40 ` Anton Khirnov
2022-01-19 13:16 ` James Almer
1 sibling, 1 reply; 15+ messages in thread
From: Anton Khirnov @ 2022-01-19 12:40 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Quoting James Almer (2022-01-19 13:34:20)
>
>
> On 1/19/2022 8:54 AM, Anton Khirnov wrote:
> > C11 atomics in some configurations (e.g. 64bit operations on ppc64 with
> > GCC) require linking to libatomic.
> > ---
> > Testing welcome, especially in configurations where
> > * libatomic is not present
> > * libatomic is actually needed
> > ---
> > configure | 9 ++++++++-
> > 1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/configure b/configure
> > index 1413122d87..1ff5dbee5b 100755
> > --- a/configure
> > +++ b/configure
> > @@ -6324,7 +6324,14 @@ check_headers asm/types.h
> > # it seems there are versions of clang in some distros that try to use the
> > # gcc headers, which explodes for stdatomic
> > # so we also check that atomics actually work here
> > -check_builtin stdatomic stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
> > +#
> > +# some configurations also require linking to libatomic, so try
> > +# both with -latomic and without
> > +for LATOMIC in "-latomic" ""; do
>
> Shouldn't you try without it first? On my toolchain libatomic is
> present, but libraries compile without linking to it just fine. That
> changes after this patch, where it starts linking to it explicitly.
No, because it may only be needed for some atomic sizes and operations,
which the test in configure doesn't necessarily catch.
And because we pass as-needed to the linker, the built libraries
shouldn't actually require libatomic unless it's really needed.
>
> > + check_builtin stdatomic stdatomic.h \
> > + "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar" \
> > + $LATOMIC && add_extralibs $LATOMIC && break
>
> You should probably add it to the required libraries' extralibs only.
> Just replace the add_extralibs part with setting stdatomic_extralibs to
> $LATOMIC, and then add stdatomic to all the libraries' _suggest lists,
> same as we do for libm.
Then we need to actively track which libraries actually use atomics,
which also depends on which features are enabled. Given that this only
fails on less-common arches, this sounds like a recipe for obscure build
failures. Given that it's only really linked when needed, it seems
better to just add it unconditionally.
--
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
2022-01-19 12:40 ` Anton Khirnov
@ 2022-01-19 13:16 ` James Almer
2022-01-19 13:48 ` Anton Khirnov
0 siblings, 1 reply; 15+ messages in thread
From: James Almer @ 2022-01-19 13:16 UTC (permalink / raw)
To: ffmpeg-devel
On 1/19/2022 9:40 AM, Anton Khirnov wrote:
> Quoting James Almer (2022-01-19 13:34:20)
>>
>>
>> On 1/19/2022 8:54 AM, Anton Khirnov wrote:
>>> C11 atomics in some configurations (e.g. 64bit operations on ppc64 with
>>> GCC) require linking to libatomic.
>>> ---
>>> Testing welcome, especially in configurations where
>>> * libatomic is not present
>>> * libatomic is actually needed
>>> ---
>>> configure | 9 ++++++++-
>>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/configure b/configure
>>> index 1413122d87..1ff5dbee5b 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -6324,7 +6324,14 @@ check_headers asm/types.h
>>> # it seems there are versions of clang in some distros that try to use the
>>> # gcc headers, which explodes for stdatomic
>>> # so we also check that atomics actually work here
>>> -check_builtin stdatomic stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
>>> +#
>>> +# some configurations also require linking to libatomic, so try
>>> +# both with -latomic and without
>>> +for LATOMIC in "-latomic" ""; do
>>
>> Shouldn't you try without it first? On my toolchain libatomic is
>> present, but libraries compile without linking to it just fine. That
>> changes after this patch, where it starts linking to it explicitly.
>
> No, because it may only be needed for some atomic sizes and operations,
> which the test in configure doesn't necessarily catch.
> And because we pass as-needed to the linker, the built libraries
> shouldn't actually require libatomic unless it's really needed.
Ah, didn't consider --as-needed.
>
>>
>>> + check_builtin stdatomic stdatomic.h \
>>> + "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar" \
>>> + $LATOMIC && add_extralibs $LATOMIC && break
>>
>> You should probably add it to the required libraries' extralibs only.
>> Just replace the add_extralibs part with setting stdatomic_extralibs to
>> $LATOMIC, and then add stdatomic to all the libraries' _suggest lists,
>> same as we do for libm.
>
> Then we need to actively track which libraries actually use atomics,
> which also depends on which features are enabled. Given that this only
> fails on less-common arches, this sounds like a recipe for obscure build
> failures. Given that it's only really linked when needed, it seems
> better to just add it unconditionally.
Then just add it to all of them, like we do for libm.
What i want to avoid is having it in EXTRALIBS. There was a huge
configure rework long ago that removed everything from that variable
(leaving it as the place where user defined --extra-libs arguments are
dumped), and fine tuned ld arguments in a per library/module basis. I'd
like to not go back to start dumping everything in EXTRALIBS.
Like this, on top of this patch:
> diff --git a/configure b/configure
> index 1ff5dbee5b..43713a7679 100755
> --- a/configure
> +++ b/configure
> @@ -3794,20 +3794,20 @@ cws2fws_extralibs="zlib_extralibs"
>
> # libraries, in any order
> avcodec_deps="avutil"
> -avcodec_suggest="libm"
> +avcodec_suggest="libm stdatomic"
> avdevice_deps="avformat avcodec avutil"
> -avdevice_suggest="libm"
> +avdevice_suggest="libm stdatomic"
> avfilter_deps="avutil"
> -avfilter_suggest="libm"
> +avfilter_suggest="libm stdatomic"
> avformat_deps="avcodec avutil"
> -avformat_suggest="libm network zlib"
> -avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt"
> +avformat_suggest="libm network stdatomic zlib"
> +avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl stdatomic user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt"
> postproc_deps="avutil gpl"
> -postproc_suggest="libm"
> +postproc_suggest="libm stdatomic"
> swresample_deps="avutil"
> -swresample_suggest="libm libsoxr"
> +swresample_suggest="libm libsoxr stdatomic"
> swscale_deps="avutil"
> -swscale_suggest="libm"
> +swscale_suggest="libm stdatomic"
>
> avcodec_extralibs="pthreads_extralibs iconv_extralibs dxva2_extralibs"
> avfilter_extralibs="pthreads_extralibs"
> @@ -6330,7 +6330,7 @@ check_headers asm/types.h
> for LATOMIC in "-latomic" ""; do
> check_builtin stdatomic stdatomic.h \
> "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar" \
> - $LATOMIC && add_extralibs $LATOMIC && break
> + $LATOMIC && eval stdatomic_extralibs="\$LATOMIC" && break
> done
>
> check_lib advapi32 "windows.h" RegCloseKey -ladvapi32
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
* [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
2022-01-19 13:16 ` James Almer
@ 2022-01-19 13:48 ` Anton Khirnov
2022-01-19 15:23 ` James Almer
0 siblings, 1 reply; 15+ messages in thread
From: Anton Khirnov @ 2022-01-19 13:48 UTC (permalink / raw)
To: ffmpeg-devel
C11 atomics in some configurations (e.g. 64bit operations on ppc64 with
GCC) require linking to libatomic.
Fixes #9275
---
configure | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/configure b/configure
index 1413122d87..3059c154df 100755
--- a/configure
+++ b/configure
@@ -3794,20 +3794,20 @@ cws2fws_extralibs="zlib_extralibs"
# libraries, in any order
avcodec_deps="avutil"
-avcodec_suggest="libm"
+avcodec_suggest="libm stdatomic"
avdevice_deps="avformat avcodec avutil"
-avdevice_suggest="libm"
+avdevice_suggest="libm stdatomic"
avfilter_deps="avutil"
-avfilter_suggest="libm"
+avfilter_suggest="libm stdatomic"
avformat_deps="avcodec avutil"
-avformat_suggest="libm network zlib"
-avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt"
+avformat_suggest="libm network zlib stdatomic"
+avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt stdatomic"
postproc_deps="avutil gpl"
-postproc_suggest="libm"
+postproc_suggest="libm stdatomic"
swresample_deps="avutil"
-swresample_suggest="libm libsoxr"
+swresample_suggest="libm libsoxr stdatomic"
swscale_deps="avutil"
-swscale_suggest="libm"
+swscale_suggest="libm stdatomic"
avcodec_extralibs="pthreads_extralibs iconv_extralibs dxva2_extralibs"
avfilter_extralibs="pthreads_extralibs"
@@ -6324,7 +6324,14 @@ check_headers asm/types.h
# it seems there are versions of clang in some distros that try to use the
# gcc headers, which explodes for stdatomic
# so we also check that atomics actually work here
-check_builtin stdatomic stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
+#
+# some configurations also require linking to libatomic, so try
+# both with -latomic and without
+for LATOMIC in "-latomic" ""; do
+ check_builtin stdatomic stdatomic.h \
+ "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar" \
+ $LATOMIC && eval stdatomic_extralibs="\$LATOMIC" && break
+done
check_lib advapi32 "windows.h" RegCloseKey -ladvapi32
check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt &&
--
2.33.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
2022-01-19 13:48 ` Anton Khirnov
@ 2022-01-19 15:23 ` James Almer
2022-01-22 6:42 ` Brad Smith
0 siblings, 1 reply; 15+ messages in thread
From: James Almer @ 2022-01-19 15:23 UTC (permalink / raw)
To: ffmpeg-devel
On 1/19/2022 10:48 AM, Anton Khirnov wrote:
> C11 atomics in some configurations (e.g. 64bit operations on ppc64 with
> GCC) require linking to libatomic.
>
> Fixes #9275
> ---
> configure | 25 ++++++++++++++++---------
> 1 file changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/configure b/configure
> index 1413122d87..3059c154df 100755
> --- a/configure
> +++ b/configure
> @@ -3794,20 +3794,20 @@ cws2fws_extralibs="zlib_extralibs"
>
> # libraries, in any order
> avcodec_deps="avutil"
> -avcodec_suggest="libm"
> +avcodec_suggest="libm stdatomic"
> avdevice_deps="avformat avcodec avutil"
> -avdevice_suggest="libm"
> +avdevice_suggest="libm stdatomic"
> avfilter_deps="avutil"
> -avfilter_suggest="libm"
> +avfilter_suggest="libm stdatomic"
> avformat_deps="avcodec avutil"
> -avformat_suggest="libm network zlib"
> -avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt"
> +avformat_suggest="libm network zlib stdatomic"
> +avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt stdatomic"
> postproc_deps="avutil gpl"
> -postproc_suggest="libm"
> +postproc_suggest="libm stdatomic"
> swresample_deps="avutil"
> -swresample_suggest="libm libsoxr"
> +swresample_suggest="libm libsoxr stdatomic"
> swscale_deps="avutil"
> -swscale_suggest="libm"
> +swscale_suggest="libm stdatomic"
>
> avcodec_extralibs="pthreads_extralibs iconv_extralibs dxva2_extralibs"
> avfilter_extralibs="pthreads_extralibs"
> @@ -6324,7 +6324,14 @@ check_headers asm/types.h
> # it seems there are versions of clang in some distros that try to use the
> # gcc headers, which explodes for stdatomic
> # so we also check that atomics actually work here
> -check_builtin stdatomic stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
> +#
> +# some configurations also require linking to libatomic, so try
> +# both with -latomic and without
> +for LATOMIC in "-latomic" ""; do
> + check_builtin stdatomic stdatomic.h \
> + "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar" \
> + $LATOMIC && eval stdatomic_extralibs="\$LATOMIC" && break
> +done
LGTM now, thanks.
>
> check_lib advapi32 "windows.h" RegCloseKey -ladvapi32
> check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt &&
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
2022-01-19 15:23 ` James Almer
@ 2022-01-22 6:42 ` Brad Smith
2022-01-22 9:00 ` Hendrik Leppkes
0 siblings, 1 reply; 15+ messages in thread
From: Brad Smith @ 2022-01-22 6:42 UTC (permalink / raw)
To: FFmpeg development discussions and patches, James Almer
On 1/19/2022 10:23 AM, James Almer wrote:
> On 1/19/2022 10:48 AM, Anton Khirnov wrote:
>> C11 atomics in some configurations (e.g. 64bit operations on ppc64 with
>> GCC) require linking to libatomic.
>>
>> Fixes #9275
>> ---
>> configure | 25 ++++++++++++++++---------
>> 1 file changed, 16 insertions(+), 9 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 1413122d87..3059c154df 100755
>> --- a/configure
>> +++ b/configure
>> @@ -3794,20 +3794,20 @@ cws2fws_extralibs="zlib_extralibs"
>> # libraries, in any order
>> avcodec_deps="avutil"
>> -avcodec_suggest="libm"
>> +avcodec_suggest="libm stdatomic"
>> avdevice_deps="avformat avcodec avutil"
>> -avdevice_suggest="libm"
>> +avdevice_suggest="libm stdatomic"
>> avfilter_deps="avutil"
>> -avfilter_suggest="libm"
>> +avfilter_suggest="libm stdatomic"
>> avformat_deps="avcodec avutil"
>> -avformat_suggest="libm network zlib"
>> -avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl
>> user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia
>> bcrypt"
>> +avformat_suggest="libm network zlib stdatomic"
>> +avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl
>> user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia
>> bcrypt stdatomic"
>> postproc_deps="avutil gpl"
>> -postproc_suggest="libm"
>> +postproc_suggest="libm stdatomic"
>> swresample_deps="avutil"
>> -swresample_suggest="libm libsoxr"
>> +swresample_suggest="libm libsoxr stdatomic"
>> swscale_deps="avutil"
>> -swscale_suggest="libm"
>> +swscale_suggest="libm stdatomic"
>> avcodec_extralibs="pthreads_extralibs iconv_extralibs
>> dxva2_extralibs"
>> avfilter_extralibs="pthreads_extralibs"
>> @@ -6324,7 +6324,14 @@ check_headers asm/types.h
>> # it seems there are versions of clang in some distros that try to
>> use the
>> # gcc headers, which explodes for stdatomic
>> # so we also check that atomics actually work here
>> -check_builtin stdatomic stdatomic.h "atomic_int foo, bar =
>> ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
>> +#
>> +# some configurations also require linking to libatomic, so try
>> +# both with -latomic and without
>> +for LATOMIC in "-latomic" ""; do
>> + check_builtin stdatomic
>> stdatomic.h \
>> + "atomic_int foo, bar = ATOMIC_VAR_INIT(-1);
>> atomic_store(&foo, 0); foo += bar" \
>> + $LATOMIC && eval stdatomic_extralibs="\$LATOMIC" && break
>> +done
>
> LGTM now, thanks.
>
>> check_lib advapi32 "windows.h" RegCloseKey
>> -ladvapi32
>> check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt &&
Wait, this should be checking without first then with, if the first test
without fails.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
2022-01-22 6:42 ` Brad Smith
@ 2022-01-22 9:00 ` Hendrik Leppkes
2022-01-23 19:40 ` Brad Smith
0 siblings, 1 reply; 15+ messages in thread
From: Hendrik Leppkes @ 2022-01-22 9:00 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Sat, Jan 22, 2022 at 7:43 AM Brad Smith
<brad-at-comstyle.com@ffmpeg.org> wrote:
>
> On 1/19/2022 10:23 AM, James Almer wrote:
>
> > On 1/19/2022 10:48 AM, Anton Khirnov wrote:
> >> C11 atomics in some configurations (e.g. 64bit operations on ppc64 with
> >> GCC) require linking to libatomic.
> >>
> >> Fixes #9275
> >> ---
> >> configure | 25 ++++++++++++++++---------
> >> 1 file changed, 16 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/configure b/configure
> >> index 1413122d87..3059c154df 100755
> >> --- a/configure
> >> +++ b/configure
> >> @@ -3794,20 +3794,20 @@ cws2fws_extralibs="zlib_extralibs"
> >> # libraries, in any order
> >> avcodec_deps="avutil"
> >> -avcodec_suggest="libm"
> >> +avcodec_suggest="libm stdatomic"
> >> avdevice_deps="avformat avcodec avutil"
> >> -avdevice_suggest="libm"
> >> +avdevice_suggest="libm stdatomic"
> >> avfilter_deps="avutil"
> >> -avfilter_suggest="libm"
> >> +avfilter_suggest="libm stdatomic"
> >> avformat_deps="avcodec avutil"
> >> -avformat_suggest="libm network zlib"
> >> -avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl
> >> user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia
> >> bcrypt"
> >> +avformat_suggest="libm network zlib stdatomic"
> >> +avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl
> >> user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia
> >> bcrypt stdatomic"
> >> postproc_deps="avutil gpl"
> >> -postproc_suggest="libm"
> >> +postproc_suggest="libm stdatomic"
> >> swresample_deps="avutil"
> >> -swresample_suggest="libm libsoxr"
> >> +swresample_suggest="libm libsoxr stdatomic"
> >> swscale_deps="avutil"
> >> -swscale_suggest="libm"
> >> +swscale_suggest="libm stdatomic"
> >> avcodec_extralibs="pthreads_extralibs iconv_extralibs
> >> dxva2_extralibs"
> >> avfilter_extralibs="pthreads_extralibs"
> >> @@ -6324,7 +6324,14 @@ check_headers asm/types.h
> >> # it seems there are versions of clang in some distros that try to
> >> use the
> >> # gcc headers, which explodes for stdatomic
> >> # so we also check that atomics actually work here
> >> -check_builtin stdatomic stdatomic.h "atomic_int foo, bar =
> >> ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
> >> +#
> >> +# some configurations also require linking to libatomic, so try
> >> +# both with -latomic and without
> >> +for LATOMIC in "-latomic" ""; do
> >> + check_builtin stdatomic
> >> stdatomic.h \
> >> + "atomic_int foo, bar = ATOMIC_VAR_INIT(-1);
> >> atomic_store(&foo, 0); foo += bar" \
> >> + $LATOMIC && eval stdatomic_extralibs="\$LATOMIC" && break
> >> +done
> >
> > LGTM now, thanks.
> >
> >> check_lib advapi32 "windows.h" RegCloseKey
> >> -ladvapi32
> >> check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt &&
>
> Wait, this should be checking without first then with, if the first test
> without fails.
>
This was covered earlier in the thread for the reason it is not - its
deliberate, because exhaustive functionality checks would be very
complicated.
- Hendrik
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
2022-01-22 9:00 ` Hendrik Leppkes
@ 2022-01-23 19:40 ` Brad Smith
2022-01-26 11:49 ` Anton Khirnov
0 siblings, 1 reply; 15+ messages in thread
From: Brad Smith @ 2022-01-23 19:40 UTC (permalink / raw)
To: FFmpeg development discussions and patches, Hendrik Leppkes
On 1/22/2022 4:00 AM, Hendrik Leppkes wrote:
> On Sat, Jan 22, 2022 at 7:43 AM Brad Smith
> <brad-at-comstyle.com@ffmpeg.org> wrote:
>> On 1/19/2022 10:23 AM, James Almer wrote:
>>
>>> On 1/19/2022 10:48 AM, Anton Khirnov wrote:
>>>> C11 atomics in some configurations (e.g. 64bit operations on ppc64 with
>>>> GCC) require linking to libatomic.
>>>>
>>>> Fixes #9275
>>>> ---
>>>> configure | 25 ++++++++++++++++---------
>>>> 1 file changed, 16 insertions(+), 9 deletions(-)
>>>>
>>>> diff --git a/configure b/configure
>>>> index 1413122d87..3059c154df 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -3794,20 +3794,20 @@ cws2fws_extralibs="zlib_extralibs"
>>>> # libraries, in any order
>>>> avcodec_deps="avutil"
>>>> -avcodec_suggest="libm"
>>>> +avcodec_suggest="libm stdatomic"
>>>> avdevice_deps="avformat avcodec avutil"
>>>> -avdevice_suggest="libm"
>>>> +avdevice_suggest="libm stdatomic"
>>>> avfilter_deps="avutil"
>>>> -avfilter_suggest="libm"
>>>> +avfilter_suggest="libm stdatomic"
>>>> avformat_deps="avcodec avutil"
>>>> -avformat_suggest="libm network zlib"
>>>> -avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl
>>>> user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia
>>>> bcrypt"
>>>> +avformat_suggest="libm network zlib stdatomic"
>>>> +avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl
>>>> user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia
>>>> bcrypt stdatomic"
>>>> postproc_deps="avutil gpl"
>>>> -postproc_suggest="libm"
>>>> +postproc_suggest="libm stdatomic"
>>>> swresample_deps="avutil"
>>>> -swresample_suggest="libm libsoxr"
>>>> +swresample_suggest="libm libsoxr stdatomic"
>>>> swscale_deps="avutil"
>>>> -swscale_suggest="libm"
>>>> +swscale_suggest="libm stdatomic"
>>>> avcodec_extralibs="pthreads_extralibs iconv_extralibs
>>>> dxva2_extralibs"
>>>> avfilter_extralibs="pthreads_extralibs"
>>>> @@ -6324,7 +6324,14 @@ check_headers asm/types.h
>>>> # it seems there are versions of clang in some distros that try to
>>>> use the
>>>> # gcc headers, which explodes for stdatomic
>>>> # so we also check that atomics actually work here
>>>> -check_builtin stdatomic stdatomic.h "atomic_int foo, bar =
>>>> ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
>>>> +#
>>>> +# some configurations also require linking to libatomic, so try
>>>> +# both with -latomic and without
>>>> +for LATOMIC in "-latomic" ""; do
>>>> + check_builtin stdatomic
>>>> stdatomic.h \
>>>> + "atomic_int foo, bar = ATOMIC_VAR_INIT(-1);
>>>> atomic_store(&foo, 0); foo += bar" \
>>>> + $LATOMIC && eval stdatomic_extralibs="\$LATOMIC" && break
>>>> +done
>>> LGTM now, thanks.
>>>
>>>> check_lib advapi32 "windows.h" RegCloseKey
>>>> -ladvapi32
>>>> check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt &&
>> Wait, this should be checking without first then with, if the first test
>> without fails.
>>
> This was covered earlier in the thread for the reason it is not - its
> deliberate, because exhaustive functionality checks would be very
> complicated.
Testing this commit out it does as I had suspected and even with --as-needed
causes a false positive on OpenBSD / FreeBSD. Now erroneously tries to link
against libatomic and unlike the other project (haproxy) I ran across an
overly
simplistic test (doesn't even involve linking, just checking compiler
predefined
macros) I don't see any options to disable the broken test either.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
2022-01-23 19:40 ` Brad Smith
@ 2022-01-26 11:49 ` Anton Khirnov
2022-01-29 4:44 ` Brad Smith
0 siblings, 1 reply; 15+ messages in thread
From: Anton Khirnov @ 2022-01-26 11:49 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Quoting Brad Smith (2022-01-23 20:40:30)
>
> Testing this commit out it does as I had suspected and even with --as-needed
> causes a false positive on OpenBSD / FreeBSD.
Why?
--
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
2022-01-26 11:49 ` Anton Khirnov
@ 2022-01-29 4:44 ` Brad Smith
2022-01-29 9:54 ` Hendrik Leppkes
0 siblings, 1 reply; 15+ messages in thread
From: Brad Smith @ 2022-01-29 4:44 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On 1/26/2022 6:49 AM, Anton Khirnov wrote:
> Quoting Brad Smith (2022-01-23 20:40:30)
>> Testing this commit out it does as I had suspected and even with --as-needed
>> causes a false positive on OpenBSD / FreeBSD.
> Why?
Looking at this again and thinking about what it does, the test as is is
flawed.
With the order being used it doesn't check to see if the linked binary even
is linked against libatomic. Using --as-needed it drops the libatomic
dependency
but since the link succeeds then the code as it is and based on the
ordering, as
I commented about, says go ahead and link in libatomic. Changing the order
so it is "" "-latomic" instead of "-latomic" "" does the right thing.
humpty$ cc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-DPIC -O2 -pipe -I/usr/local/include -I/usr/X11R6/include -std=c11 -fPIC
-c -o test.o test.c
humpty$ cc -Wl,--as-needed -Wl,-z,noexecstack -o test test.o -latomic
-L/usr/local/lib -L/usr/X11R6/lib
humpty$ objdump -p test
test: file format elf64-x86-64
Program Header:
PHDR off 0x0000000000000040 vaddr 0x0000000000000040 paddr
0x0000000000000040 align 2**3
filesz 0x00000000000002a0 memsz 0x00000000000002a0 flags r--
INTERP off 0x00000000000002e0 vaddr 0x00000000000002e0 paddr
0x00000000000002e0 align 2**0
filesz 0x0000000000000013 memsz 0x0000000000000013 flags r--
LOAD off 0x0000000000000000 vaddr 0x0000000000000000 paddr
0x0000000000000000 align 2**12
filesz 0x00000000000005dc memsz 0x00000000000005dc flags r--
LOAD off 0x00000000000005e0 vaddr 0x00000000000015e0 paddr
0x00000000000015e0 align 2**12
filesz 0x0000000000000450 memsz 0x0000000000000450 flags r-x
LOAD off 0x0000000000000a30 vaddr 0x0000000000002a30 paddr
0x0000000000002a30 align 2**12
filesz 0x00000000000001c0 memsz 0x00000000000001c0 flags rw-
LOAD off 0x0000000000000bf0 vaddr 0x0000000000003bf0 paddr
0x0000000000003bf0 align 2**12
filesz 0x0000000000000000 memsz 0x0000000000000055 flags rw-
DYNAMIC off 0x0000000000000a88 vaddr 0x0000000000002a88 paddr
0x0000000000002a88 align 2**3
filesz 0x0000000000000120 memsz 0x0000000000000120 flags rw-
RELRO off 0x0000000000000a30 vaddr 0x0000000000002a30 paddr
0x0000000000002a30 align 2**0
filesz 0x00000000000001c0 memsz 0x00000000000005d0 flags r--
EH_FRAME off 0x00000000000004c8 vaddr 0x00000000000004c8 paddr
0x00000000000004c8 align 2**2
filesz 0x0000000000000034 memsz 0x0000000000000034 flags r--
OPENBSD_RANDOMIZE off 0x0000000000000a30 vaddr 0x0000000000002a30
paddr 0x0000000000002a30 align 2**3
filesz 0x0000000000000030 memsz 0x0000000000000030 flags rw-
STACK off 0x0000000000000000 vaddr 0x0000000000000000 paddr
0x0000000000000000 align 2**0
filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
NOTE off 0x00000000000002f4 vaddr 0x00000000000002f4 paddr
0x00000000000002f4 align 2**2
filesz 0x0000000000000018 memsz 0x0000000000000018 flags r--
Dynamic Section:
NEEDED libc.so.96.1
FLAGS_1 0x8000000
DEBUG 0x0
RELA 0x438
RELASZ 0x30
RELAENT 0x18
RELACOUNT 0x1
JMPREL 0x468
PLTRELSZ 0x60
PLTGOT 0x2bb8
PLTREL 0x7
SYMTAB 0x310
SYMENT 0x18
STRTAB 0x3f8
STRSZ 0x3f
GNU_HASH 0x3a0
HASH 0x3c0
libatomic is dropped by --as-needed since it is not necessary.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
2022-01-29 4:44 ` Brad Smith
@ 2022-01-29 9:54 ` Hendrik Leppkes
2022-01-29 18:15 ` Brad Smith
0 siblings, 1 reply; 15+ messages in thread
From: Hendrik Leppkes @ 2022-01-29 9:54 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Sat, Jan 29, 2022 at 5:45 AM Brad Smith
<brad-at-comstyle.com@ffmpeg.org> wrote:
>
> libatomic is dropped by --as-needed since it is not necessary.
>
Thats what this solution relies on, and thus there is no harm in adding it.
- Hendrik
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
2022-01-29 9:54 ` Hendrik Leppkes
@ 2022-01-29 18:15 ` Brad Smith
2022-01-29 20:38 ` Anton Khirnov
0 siblings, 1 reply; 15+ messages in thread
From: Brad Smith @ 2022-01-29 18:15 UTC (permalink / raw)
To: FFmpeg development discussions and patches, Hendrik Leppkes
On 1/29/2022 4:54 AM, Hendrik Leppkes wrote:
> On Sat, Jan 29, 2022 at 5:45 AM Brad Smith
> <brad-at-comstyle.com@ffmpeg.org> wrote:
>> libatomic is dropped by --as-needed since it is not necessary.
>>
> Thats what this solution relies on, and thus there is no harm in adding it.
But it doesn't work, and the generated pkg-config files are contaminated
too. I'll just
have to patch out this broken crap locally.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present
2022-01-29 18:15 ` Brad Smith
@ 2022-01-29 20:38 ` Anton Khirnov
0 siblings, 0 replies; 15+ messages in thread
From: Anton Khirnov @ 2022-01-29 20:38 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Quoting Brad Smith (2022-01-29 19:15:46)
> On 1/29/2022 4:54 AM, Hendrik Leppkes wrote:
>
> > On Sat, Jan 29, 2022 at 5:45 AM Brad Smith
> > <brad-at-comstyle.com@ffmpeg.org> wrote:
> >> libatomic is dropped by --as-needed since it is not necessary.
> >>
> > Thats what this solution relies on, and thus there is no harm in adding it.
>
> But it doesn't work, and the generated pkg-config files are contaminated
> too. I'll just
> have to patch out this broken crap locally.
You have now twice disregarded someone explaining why the test first
check with -latomic and then without, then you call this code "broken
crap" without properly explaining what breaks and why.
Consider communicating better if you want people here to take you
seriously.
--
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2022-01-29 20:38 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 11:54 [FFmpeg-devel] [PATCH] configure: link to libatomic when it's present Anton Khirnov
2022-01-19 12:34 ` James Almer
2022-01-19 12:37 ` Andreas Rheinhardt
2022-01-19 12:40 ` Anton Khirnov
2022-01-19 13:16 ` James Almer
2022-01-19 13:48 ` Anton Khirnov
2022-01-19 15:23 ` James Almer
2022-01-22 6:42 ` Brad Smith
2022-01-22 9:00 ` Hendrik Leppkes
2022-01-23 19:40 ` Brad Smith
2022-01-26 11:49 ` Anton Khirnov
2022-01-29 4:44 ` Brad Smith
2022-01-29 9:54 ` Hendrik Leppkes
2022-01-29 18:15 ` Brad Smith
2022-01-29 20:38 ` Anton Khirnov
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git