Skip to content

asm generic termbits.h macro "B0" collides with other macros #630

@matthewn4444

Description

@matthewn4444

Description

Compiling with libraries such as (newest) FFMPEG with arm64-v8a collides with several functions of the macro B0 (such as hevc_mvs.c). You can see how it may cause issues in this person's blog: http://alientechlab.com/how-to-build-ffmpeg-for-android/

Basically what happens is sysroot/usr/include/asm-generic/termbits.h defines a macro definition of

#define B0 0000000000

and FFMPEG uses variables such as

 is_available_B0 = AVAILABLE(cand_up_right, B0) &&
            xb0 < s->ps.sps->width &&
            PRED_BLOCK_AVAILABLE(B0) &&
            !is_diff_mer(s, xB0, yB0, x0, y0);

And then replaces them with 0000000000 as

 is_available_0000000000  = AVAILABLE(cand_up_right, 0000000000 ) &&
            x0000000000  < s->ps.sps->width &&
            PRED_BLOCK_AVAILABLE(0000000000 ) &&
            !is_diff_mer(s, x0000000000 , y0000000000 , x0, y0);

Which then leads to compile issues like

libavcodec/hevc_mvs.c: In function 'derive_spatial_merge_candidates':
libavcodec/hevc_mvs.c:368:23: error: 'y0000000' undeclared (first use in this function)
libavcodec/hevc_mvs.c:368:23: note: each undeclared identifier is reported only once for each function it appears in
libavcodec/hevc_mvs.c:368:23: error: 'x0000000' undeclared (first use in this function)
libavcodec/hevc_mvs.c: In function 'ff_hevc_luma_mv_mvp_mode':
libavcodec/hevc_mvs.c:683:24: error: 'y0000000' undeclared (first use in this function)
libavcodec/hevc_mvs.c:683:24: error: 'x0000000' undeclared (first use in this function)
ffbuild/common.mak:60: recipe for target 'libavcodec/hevc_mvs.o' failed

Sorry for my ignorance but does B0 have some special reason for being 00000000? Could this be changed in the future since this could potentially have collisions with other libraries (for only being 2 letters). (I am not sure if FFMPEG wants to rewrite their variables).

For now, I am using a script to comment that line out (from the termbits.h).

To reproduce you can follow the instructions in that blog (clone FFMPEG, configure, make and make install)

Environment Details

  • NDK Version: r16b
  • Build sytem: ndk-build, standalone tool chain
  • Host OS: Linux (Windows 10 Ubuntu shell, I think it is 16.04)
  • Compiler: Clang
  • ABI: arm64-v8a
  • STL: libc++
  • NDK API level: 27
  • Device API level: N/A, not compiling for device

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions