[FFmpeg-devel] [PATCH v2 3/4] tests/checkasm: Fix build error when enable linux perf on Android

Martin Storsjö martin at martin.st
Fri Jun 7 11:50:43 EEST 2024


On Fri, 7 Jun 2024, Zhao Zhili wrote:

>
>
>> On Jun 7, 2024, at 16:21, Martin Storsjö <martin at martin.st> wrote:
>> 
>> On Fri, 7 Jun 2024, Zhao Zhili wrote:
>> 
>>> From: Zhao Zhili <zhilizhao at tencent.com>
>>> 
>>> B0 is defined by system header.
>> 
>> Can you add more details about which header defines this? (I did a quick grep in a copy of the android NDK, and found it in asm-generic/termbits-common.h.)
>
> The include path is:
>
> timer.h => 
> <sys/ioctl.h> => 
> <linux/termios.h> => 
> <asm/termios.h> => 
> <asm-generic/termios.h> => 
> <asm/termbits.h> => 
> <asm-generic/termbits.h> => 
> <asm-generic/termbits-common.h>
>
> #define B0 0x00000000
> #define B50 0x00000001
> #define B75 0x00000002
>
> The issue has occurred multiple times, e.g.,
>
> commit f0f596dbc6b45b544d2d2d4fb78c0a2bdc3e6eb1
>
>    avutil/internal: remove timer.h again
>
>    timer.h has been removed from internal.h, and then added back with
>    3e6088f for convenience. This patch removed it again for the
>    following reasons:
>
>    1. Only includes what's necessary is a common and safe strategy.
>
>    2. It fixed some build errors on Android:
>      a. libavutil/timer.h includes sys/ioctl.h, and ioctl.h includes
>         termios.h on Android.
>      b. termios.h reserves names prefixed with ‘c_’, ‘V’, ‘I’, ‘O’, and
>         ‘TC’; and names prefixed with ‘B’ followed by a digit.
>      c. libavcodec uses B0 B1 and so on as variable names a lot. So
>         the code failed to build with --enable-linux-perf, or
>         --target-os=Linux.

Ah, that's a good explanation. Please reference this commit in this one, 
then it's good with me!

// Martin


More information about the ffmpeg-devel mailing list