* [FFmpeg-devel] Weird cross platform support in ffmpeg
@ 2022-05-31 10:03 Александр
2022-05-31 10:10 ` Nicolas George
2022-05-31 14:14 ` Timo Rothenpieler
0 siblings, 2 replies; 8+ messages in thread
From: Александр @ 2022-05-31 10:03 UTC (permalink / raw)
To: ffmpeg-devel
I tried to build ffmpeg 4.4 library and link with it and I received
multiple unresolved references. I came across on unusual architecture in
ffmpeg for multiple platforms.The library has many places with code like
this:
void foo()
{
// DO SOMETHING
if (ARCH_MIPS) // maybe #if ARCH_MIPS (...) #endif should be used instead?
foo_mips(...);
if (ARCH_PPC)
foo_ppc(c);
if (ARCH_ARM)
foo_arm(...);
if (ARCH_AARCH64)
foo_aarch64(...);
}
This code leads to linker errors because there is no any stub methods for
other platforms. I observed root MakeFile, it optionally includes platform
dependent code for each library (path like $(LIB_SUBDIR)/$(ARCH)/MakeFile)
where each foo_<arch> is defined.
So, how does it work? In my opinion preprocessor directive #if should be
used, otherwise we will receive unresolved reference on any platform. Maybe
I missed something? because this code appears frequently for example:
1. utils.c : ff_yuv2rgb_init_tables_ppc
2. swscale_unscaled.c : ff_get_unscaled_swscale_ppc,
ff_get_unscaled_swscale_arm, ff_get_unscaled_swscale_aarch64
3. cpu.c : ff_get_cpu_max_align_x86, ff_get_cpu_max_align_mips
4. float_dsp.c : ff_float_dsp_init_aarch64, ff_float_dsp_init_ppc,
ff_float_dsp_init_x86
5. etc.
_______________________________________________
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] 8+ messages in thread
* Re: [FFmpeg-devel] Weird cross platform support in ffmpeg
2022-05-31 10:03 [FFmpeg-devel] Weird cross platform support in ffmpeg Александр
@ 2022-05-31 10:10 ` Nicolas George
2022-05-31 14:14 ` Timo Rothenpieler
1 sibling, 0 replies; 8+ messages in thread
From: Nicolas George @ 2022-05-31 10:10 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 534 bytes --]
Александр (12022-05-31):
> This code leads to linker errors because there is no any stub methods for
> other platforms. I observed root MakeFile, it optionally includes platform
> dependent code for each library (path like $(LIB_SUBDIR)/$(ARCH)/MakeFile)
> where each foo_<arch> is defined.
>
> So, how does it work?
Please direct users questions to ffmpeg-users and include the exact
procedure you have used to try to build and the output it produced,
trimmed if necessary.
Regards,
--
Nicolas George
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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] 8+ messages in thread
* Re: [FFmpeg-devel] Weird cross platform support in ffmpeg
2022-05-31 10:03 [FFmpeg-devel] Weird cross platform support in ffmpeg Александр
2022-05-31 10:10 ` Nicolas George
@ 2022-05-31 14:14 ` Timo Rothenpieler
2022-05-31 14:23 ` Andreas Rheinhardt
1 sibling, 1 reply; 8+ messages in thread
From: Timo Rothenpieler @ 2022-05-31 14:14 UTC (permalink / raw)
To: ffmpeg-devel
On 31.05.2022 12:03, Александр wrote:
> I tried to build ffmpeg 4.4 library and link with it and I received
> multiple unresolved references. I came across on unusual architecture in
> ffmpeg for multiple platforms.The library has many places with code like
> this:
>
> void foo()
> {
> // DO SOMETHING
> if (ARCH_MIPS) // maybe #if ARCH_MIPS (...) #endif should be used instead?
> foo_mips(...);
> if (ARCH_PPC)
> foo_ppc(c);
> if (ARCH_ARM)
> foo_arm(...);
> if (ARCH_AARCH64)
> foo_aarch64(...);
> }
>
> This code leads to linker errors because there is no any stub methods for
> other platforms. I observed root MakeFile, it optionally includes platform
> dependent code for each library (path like $(LIB_SUBDIR)/$(ARCH)/MakeFile)
> where each foo_<arch> is defined.
>
> So, how does it work?
It relies on Compiler-Optimizations, namely Dead-Code-Elimination.
For that reason, FFmpeg does not support being built with -O0, since the
compiler won't eliminate the dead code, leading to a whole bunch of dead
references.
Hence, if you run into an issue like that, you need to look at your
compiler and figure out what the hell it's trying to do.
Or stop trying to build with -O0, which the build system should normally
never allow you to do in the first place unless you force it.
_______________________________________________
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] 8+ messages in thread
* Re: [FFmpeg-devel] Weird cross platform support in ffmpeg
2022-05-31 14:14 ` Timo Rothenpieler
@ 2022-05-31 14:23 ` Andreas Rheinhardt
2022-05-31 14:33 ` Александр
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Rheinhardt @ 2022-05-31 14:23 UTC (permalink / raw)
To: ffmpeg-devel
Timo Rothenpieler:
> On 31.05.2022 12:03, Александр wrote:
>> I tried to build ffmpeg 4.4 library and link with it and I received
>> multiple unresolved references. I came across on unusual architecture in
>> ffmpeg for multiple platforms.The library has many places with code like
>> this:
>>
>> void foo()
>> {
>> // DO SOMETHING
>> if (ARCH_MIPS) // maybe #if ARCH_MIPS (...) #endif should be used
>> instead?
>> foo_mips(...);
>> if (ARCH_PPC)
>> foo_ppc(c);
>> if (ARCH_ARM)
>> foo_arm(...);
>> if (ARCH_AARCH64)
>> foo_aarch64(...);
>> }
>>
>> This code leads to linker errors because there is no any stub methods for
>> other platforms. I observed root MakeFile, it optionally includes
>> platform
>> dependent code for each library (path like
>> $(LIB_SUBDIR)/$(ARCH)/MakeFile)
>> where each foo_<arch> is defined.
>>
>> So, how does it work?
>
> It relies on Compiler-Optimizations, namely Dead-Code-Elimination.
> For that reason, FFmpeg does not support being built with -O0, since the
> compiler won't eliminate the dead code, leading to a whole bunch of dead
> references.
>
Incorrect: Both GCC and Clang eliminate dead code at -O0 and FFmpeg can
be built with -O0 with both of them just fine.
> Hence, if you run into an issue like that, you need to look at your
> compiler and figure out what the hell it's trying to do.
> Or stop trying to build with -O0, which the build system should normally
> never allow you to do in the first place unless you force it.
_______________________________________________
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] 8+ messages in thread
* Re: [FFmpeg-devel] Weird cross platform support in ffmpeg
2022-05-31 14:23 ` Andreas Rheinhardt
@ 2022-05-31 14:33 ` Александр
2022-05-31 14:40 ` Nicolas George
0 siblings, 1 reply; 8+ messages in thread
From: Александр @ 2022-05-31 14:33 UTC (permalink / raw)
To: FFmpeg development discussions and patches
I analyzed problem a little bit. Only gcc/clang allows to use this trick.
Msvc compiler forbidens such code (even with different enabled
optimizations like remove unused references, whole program optimization
etc) I have made patch, which uses preprocessor #if directive instead. If
it will be helpful, I can share the patch.
вт, 31 мая 2022 г. в 17:24, Andreas Rheinhardt <
andreas.rheinhardt@outlook.com>:
> Timo Rothenpieler:
> > On 31.05.2022 12:03, Александр wrote:
> >> I tried to build ffmpeg 4.4 library and link with it and I received
> >> multiple unresolved references. I came across on unusual architecture in
> >> ffmpeg for multiple platforms.The library has many places with code like
> >> this:
> >>
> >> void foo()
> >> {
> >> // DO SOMETHING
> >> if (ARCH_MIPS) // maybe #if ARCH_MIPS (...) #endif should be used
> >> instead?
> >> foo_mips(...);
> >> if (ARCH_PPC)
> >> foo_ppc(c);
> >> if (ARCH_ARM)
> >> foo_arm(...);
> >> if (ARCH_AARCH64)
> >> foo_aarch64(...);
> >> }
> >>
> >> This code leads to linker errors because there is no any stub methods
> for
> >> other platforms. I observed root MakeFile, it optionally includes
> >> platform
> >> dependent code for each library (path like
> >> $(LIB_SUBDIR)/$(ARCH)/MakeFile)
> >> where each foo_<arch> is defined.
> >>
> >> So, how does it work?
> >
> > It relies on Compiler-Optimizations, namely Dead-Code-Elimination.
> > For that reason, FFmpeg does not support being built with -O0, since the
> > compiler won't eliminate the dead code, leading to a whole bunch of dead
> > references.
> >
>
> Incorrect: Both GCC and Clang eliminate dead code at -O0 and FFmpeg can
> be built with -O0 with both of them just fine.
>
> > Hence, if you run into an issue like that, you need to look at your
> > compiler and figure out what the hell it's trying to do.
> > Or stop trying to build with -O0, which the build system should normally
> > never allow you to do in the first place unless you force it.
> _______________________________________________
> 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".
>
_______________________________________________
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] 8+ messages in thread
* Re: [FFmpeg-devel] Weird cross platform support in ffmpeg
2022-05-31 14:33 ` Александр
@ 2022-05-31 14:40 ` Nicolas George
2022-05-31 14:52 ` Александр
2022-05-31 16:38 ` Wang Bin
0 siblings, 2 replies; 8+ messages in thread
From: Nicolas George @ 2022-05-31 14:40 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 1008 bytes --]
Александр (12022-05-31):
> I analyzed problem a little bit. Only gcc/clang allows to use this trick.
> Msvc compiler forbidens such code (even with different enabled
> optimizations like remove unused references, whole program optimization
> etc) I have made patch, which uses preprocessor #if directive instead. If
> it will be helpful, I can share the patch.
FATE shows FFmpeg builds fine on several MSVC instances, so no, we do
not need such a patch at this time.
I have asked you to show on ffmpeg-users the exact thing you are
attempting to do, you have neglected to do that. It is obvious to me
that you are trying to tweak the build process in a way that is not
supported: stop.
> вт, 31 мая 2022 г. в 17:24, Andreas Rheinhardt <
> andreas.rheinhardt@outlook.com>:
Top-posting is forbidden on all FFmpeg mailing-lists. If you do not know
what it means look it up. You are likely to receive no useful reply if
you continue.
Regards,
--
Nicolas George
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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] 8+ messages in thread
* Re: [FFmpeg-devel] Weird cross platform support in ffmpeg
2022-05-31 14:40 ` Nicolas George
@ 2022-05-31 14:52 ` Александр
2022-05-31 16:38 ` Wang Bin
1 sibling, 0 replies; 8+ messages in thread
From: Александр @ 2022-05-31 14:52 UTC (permalink / raw)
To: FFmpeg development discussions and patches
I duplicated question at another channel (users). I wrote here because I
get answers on my question here. On another channel I am ready to provide
any detailed information.
вт, 31 мая 2022 г. в 17:40, Nicolas George <george@nsup.org>:
> Александр (12022-05-31):
> > I analyzed problem a little bit. Only gcc/clang allows to use this trick.
> > Msvc compiler forbidens such code (even with different enabled
> > optimizations like remove unused references, whole program optimization
> > etc) I have made patch, which uses preprocessor #if directive instead. If
> > it will be helpful, I can share the patch.
>
> FATE shows FFmpeg builds fine on several MSVC instances, so no, we do
> not need such a patch at this time.
>
> I have asked you to show on ffmpeg-users the exact thing you are
> attempting to do, you have neglected to do that. It is obvious to me
> that you are trying to tweak the build process in a way that is not
> supported: stop.
>
> > вт, 31 мая 2022 г. в 17:24, Andreas Rheinhardt <
> > andreas.rheinhardt@outlook.com>:
>
> Top-posting is forbidden on all FFmpeg mailing-lists. If you do not know
> what it means look it up. You are likely to receive no useful reply if
> you continue.
>
> Regards,
>
> --
> Nicolas George
> _______________________________________________
> 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".
>
_______________________________________________
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] 8+ messages in thread
* Re: [FFmpeg-devel] Weird cross platform support in ffmpeg
2022-05-31 14:40 ` Nicolas George
2022-05-31 14:52 ` Александр
@ 2022-05-31 16:38 ` Wang Bin
1 sibling, 0 replies; 8+ messages in thread
From: Wang Bin @ 2022-05-31 16:38 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Nicolas George <george@nsup.org> 于2022年5月31日周二 22:40写道:
> Александр (12022-05-31):
> > I analyzed problem a little bit. Only gcc/clang allows to use this trick.
> > Msvc compiler forbidens such code (even with different enabled
> > optimizations like remove unused references, whole program optimization
> > etc) I have made patch, which uses preprocessor #if directive instead. If
> > it will be helpful, I can share the patch.
>
> FATE shows FFmpeg builds fine on several MSVC instances, so no, we do
> not need such a patch at this time.
>
> I have asked you to show on ffmpeg-users the exact thing you are
> attempting to do, you have neglected to do that. It is obvious to me
> that you are trying to tweak the build process in a way that is not
> supported: stop.
>
>
If MSVC whole program optimization is enabled (compiler flag /GL), DCE will
not work.
_______________________________________________
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] 8+ messages in thread
end of thread, other threads:[~2022-05-31 16:38 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31 10:03 [FFmpeg-devel] Weird cross platform support in ffmpeg Александр
2022-05-31 10:10 ` Nicolas George
2022-05-31 14:14 ` Timo Rothenpieler
2022-05-31 14:23 ` Andreas Rheinhardt
2022-05-31 14:33 ` Александр
2022-05-31 14:40 ` Nicolas George
2022-05-31 14:52 ` Александр
2022-05-31 16:38 ` Wang Bin
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