Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VP9 build fails for some ABI (ndk r14b) #2661

Closed
davinctor opened this issue Apr 8, 2017 · 3 comments
Closed

VP9 build fails for some ABI (ndk r14b) #2661

davinctor opened this issue Apr 8, 2017 · 3 comments
Assignees

Comments

@davinctor
Copy link

davinctor commented Apr 8, 2017

Hi, all.

Try to compile VP9, and receive errors on two steps.
Firstly, I receive an error while configuring:

build_android_configs: 
configure --target=armv7-android-gcc --sdk-path=/Android/Sdk/ndk-bundle --enable-neon --enable-neon-asm --disable-examples --disable-docs --enable-realtime-only --disable-vp8 --disable-vp9-encoder --disable-webm-io --disable-libyuv --disable-runtime-cpu-detect
  disabling examples
  disabling docs
  enabling realtime_only
  disabling vp8
  disabling vp9_encoder
  disabling webm_io
  disabling libyuv
  disabling runtime_cpu_detect
  enabling vp9_decoder
Configuring for target 'armv7-android-gcc'
  enabling armv7
Creating makefiles for armv7-android-gcc libs
Creating makefiles for armv7-android-gcc tools
    [CREATE] vpx_scale_rtcd.h
    [CREATE] vpx_dsp_rtcd.h
    [CREATE] vp9_rtcd.h
    [ASM CONVERSION] vpx_dsp/arm/idct16x16_add_neon.asm.S
    [DEP] vpx_dsp/arm/idct16x16_add_neon.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/idct16x16_1_add_neon.asm.S
    [DEP] vpx_dsp/arm/idct16x16_1_add_neon.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/idct8x8_add_neon.asm.S
    [DEP] vpx_dsp/arm/idct8x8_add_neon.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/idct8x8_1_add_neon.asm.S
    [DEP] vpx_dsp/arm/idct8x8_1_add_neon.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/idct4x4_add_neon.asm.S
    [DEP] vpx_dsp/arm/idct4x4_add_neon.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/idct4x4_1_add_neon.asm.S
    [DEP] vpx_dsp/arm/idct4x4_1_add_neon.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/idct_neon.asm.S
    [DEP] vpx_dsp/arm/idct_neon.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/save_reg_neon.asm.S
    [DEP] vpx_dsp/arm/save_reg_neon.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/loopfilter_4_neon.asm.S
    [DEP] vpx_dsp/arm/loopfilter_4_neon.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/loopfilter_8_neon.asm.S
    [DEP] vpx_dsp/arm/loopfilter_8_neon.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/loopfilter_16_neon.asm.S
    [DEP] vpx_dsp/arm/loopfilter_16_neon.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/vpx_convolve_avg_neon_asm.asm.S
    [DEP] vpx_dsp/arm/vpx_convolve_avg_neon_asm.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/vpx_convolve8_neon_asm.asm.S
    [DEP] vpx_dsp/arm/vpx_convolve8_neon_asm.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/vpx_convolve8_avg_neon_asm.asm.S
    [DEP] vpx_dsp/arm/vpx_convolve8_avg_neon_asm.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/vpx_convolve_copy_neon_asm.asm.S
    [DEP] vpx_dsp/arm/vpx_convolve_copy_neon_asm.asm.S.d
    [ASM CONVERSION] vpx_dsp/arm/intrapred_neon_asm.asm.S
    [DEP] vpx_dsp/arm/intrapred_neon_asm.asm.S.d
    [DEP] vpx_config.c.d
    [DEP] vp9/decoder/vp9_dsubexp.c.d
    [DEP] vp9/decoder/vp9_decoder.c.d
    [DEP] vp9/decoder/vp9_dthread.c.d
    [DEP] vp9/decoder/vp9_detokenize.c.d
    [DEP] vp9/decoder/vp9_decodeframe.c.d
    [DEP] vp9/decoder/vp9_decodemv.c.d
    [DEP] vp9/vp9_dx_iface.c.d
    [DEP] vp9/common/arm/neon/vp9_iht8x8_add_neon.c.d
In file included from ../../libvpx/vp9/common/arm/neon/vp9_iht8x8_add_neon.c:11:0:
/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/include/arm_neon.h:31:2: error: #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
 #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
  ^
    [DEP] vp9/common/arm/neon/vp9_iht4x4_add_neon.c.d
In file included from ../../libvpx/vp9/common/arm/neon/vp9_iht4x4_add_neon.c:11:0:
/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/include/arm_neon.h:31:2: error: #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
 #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
  ^
    [DEP] vp9/common/vp9_scan.c.d
    [DEP] vp9/common/vp9_common_data.c.d
    [DEP] vp9/common/vp9_reconintra.c.d
    [DEP] vp9/common/vp9_reconinter.c.d
    [DEP] vp9/common/vp9_quant_common.c.d
    [DEP] vp9/common/vp9_mvref_common.c.d
    [DEP] vp9/common/vp9_thread_common.c.d
    [DEP] vp9/common/vp9_loopfilter.c.d
    [DEP] vp9/common/vp9_tile_common.c.d
    [DEP] vp9/common/vp9_seg_common.c.d
    [DEP] vp9/common/vp9_scale.c.d
    [DEP] vp9/common/vp9_rtcd.c.d
    [DEP] vp9/common/vp9_pred_common.c.d
    [DEP] vp9/common/vp9_filter.c.d
    [DEP] vp9/common/vp9_idct.c.d
    [DEP] vp9/common/vp9_frame_buffers.c.d
    [DEP] vp9/common/vp9_entropymv.c.d
    [DEP] vp9/common/vp9_entropymode.c.d
    [DEP] vp9/common/vp9_entropy.c.d
    [DEP] vp9/common/vp9_blockd.c.d
    [DEP] vp9/common/vp9_alloccommon.c.d
    [DEP] vpx_util/vpx_thread.c.d
    [DEP] vpx_dsp/vpx_dsp_rtcd.c.d
    [DEP] vpx_dsp/arm/idct32x32_add_neon.c.d
In file included from ../../libvpx/vpx_dsp/arm/idct32x32_add_neon.c:11:0:
/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/include/arm_neon.h:31:2: error: #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
 #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
  ^
    [DEP] vpx_dsp/arm/idct32x32_135_add_neon.c.d
In file included from ../../libvpx/vpx_dsp/arm/idct32x32_135_add_neon.c:11:0:
/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/include/arm_neon.h:31:2: error: #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
 #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
  ^
    [DEP] vpx_dsp/arm/idct32x32_34_add_neon.c.d
In file included from ../../libvpx/vpx_dsp/arm/idct32x32_34_add_neon.c:11:0:
/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/include/arm_neon.h:31:2: error: #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
 #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
  ^
    [DEP] vpx_dsp/arm/idct32x32_1_add_neon.c.d
In file included from ../../libvpx/vpx_dsp/arm/idct32x32_1_add_neon.c:11:0:
/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/include/arm_neon.h:31:2: error: #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
 #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
  ^
    [DEP] vpx_dsp/arm/idct16x16_neon.c.d
    [DEP] vpx_dsp/inv_txfm.c.d
    [DEP] vpx_dsp/loopfilter.c.d
    [DEP] vpx_dsp/arm/vpx_convolve_neon.c.d
    [DEP] vpx_dsp/vpx_convolve.c.d
    [DEP] vpx_dsp/arm/intrapred_neon.c.d
In file included from ../../libvpx/vpx_dsp/arm/intrapred_neon.c:11:0:
/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/include/arm_neon.h:31:2: error: #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
 #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
  ^
    [DEP] vpx_dsp/intrapred.c.d
    [DEP] vpx_dsp/bitreader_buffer.c.d
    [DEP] vpx_dsp/bitreader.c.d
    [DEP] vpx_dsp/prob.c.d
    [DEP] vpx_ports/arm_cpudetect.c.d
    [DEP] vpx_scale/vpx_scale_rtcd.c.d
    [DEP] vpx_scale/generic/gen_scalers.c.d
    [DEP] vpx_scale/generic/yv12extend.c.d
    [DEP] vpx_scale/generic/yv12config.c.d
    [DEP] vpx_scale/generic/vpx_scale.c.d
    [DEP] vpx_mem/vpx_mem.c.d
    [DEP] vpx/src/vpx_image.c.d
    [DEP] vpx/src/vpx_codec.c.d
    [DEP] vpx/src/vpx_encoder.c.d
    [DEP] vpx/src/vpx_decoder.c.d
    [CREATE] libvpx_srcs.txt
    [DEP] tools/tiny_ssim.c.d
make[1]: Nothing to be done for 'libvpx_srcs.txt'.
make: 'vpx_config.c' is up to date.
make: 'vpx_config.h' is up to date.
make: 'vpx_scale_rtcd.h' is up to date.
make[1]: *** No rule to make target 'vp8_rtcd.h'.  Stop.
Makefile:17: recipe for target 'vp8_rtcd.h' failed
make: *** [vp8_rtcd.h] Error 2
make: 'vp9_rtcd.h' is up to date.
make: 'vpx_version.h' is up to date.
    [CREATE] vpx_config.asm
make[1]: Nothing to be done for 'vpx_config.asm'.
make: 'vpx_dsp_rtcd.h' is up to date.

The error is on configuring vp8, possible I can ignore it, but want to mention it.

make[1]: *** No rule to make target 'vp8_rtcd.h'.  Stop.
Makefile:17: recipe for target 'vp8_rtcd.h' failed
make: *** [vp8_rtcd.h] Error 2

Second problem is blocking to compile sources for armeabi:

~/AndroidStudioProjects/ExoPlayer/extensions/vp9/src/main/jni$ cd "${VP9_EXT_PATH}"/jni && ${NDK_PATH}/ndk-build APP_ABI=armeabi -j4
[armeabi] Compile arm    : vpx <= loopfilter.c
[armeabi] Compile arm    : vpx <= vpx_mem.c
[armeabi] Compile arm    : vpx <= arm_cpudetect.c
[armeabi] Compile arm    : vpx <= gen_scalers.c
[armeabi] Compile arm    : vpx <= vpx_scale.c
[armeabi] Compile arm    : vpx <= yv12config.c
[armeabi] Compile arm    : vpx <= yv12extend.c
[armeabi] Compile arm    : vpx <= vpx_scale_rtcd.c
[armeabi] Compile arm    : vpx <= vpx_thread.c
[armeabi] Compile arm    : vpx <= vpx_config.c
[armeabi] Compile++ arm  : vpxJNI <= vpx_jni.cc
/tmp/loopfilter-e8ff8a.s: Assembler messages:
/tmp/loopfilter-e8ff8a.s:223: Error: selected processor does not support ARM mode `ssat r5,#8,r5'
/tmp/loopfilter-e8ff8a.s:613: Error: selected processor does not support ARM mode `ssat r2,#8,r2'
/tmp/loopfilter-e8ff8a.s:936: Error: selected processor does not support ARM mode `ssat r3,#8,r3'
/tmp/loopfilter-e8ff8a.s:1650: Error: selected processor does not support ARM mode `ssat r4,#8,r4'
/tmp/loopfilter-e8ff8a.s:1665: Error: selected processor does not support ARM mode `ssat r5,#8,r5'
[armeabi] Compile++ thumb: yuv_static <= compare.cc
[armeabi] Compile++ thumb: yuv_static <= compare_common.cc
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
make: *** [/home/davinctor/AndroidStudioProjects/ExoPlayer/extensions/vp9/src/main/obj/local/armeabi/objs/vpx/libvpx/vpx_dsp/loopfilter.o] Error 1
make: *** Waiting for unfinished jobs....

And also I receive errors for mips:

~/AndroidStudioProjects/ExoPlayer/extensions/vp9/src/main/jni$ cd "${VP9_EXT_PATH}"/jni && ${NDK_PATH}/ndk-build APP_ABI=mips -j4
[mips] Compile        : vpx <= vp9_alloccommon.c
[mips] Compile        : vpx <= vp9_blockd.c
[mips] Compile        : vpx <= vp9_common_data.c
[mips] Compile        : vpx <= vp9_entropy.c
[mips] Compile        : vpx <= vp9_entropymode.c
[mips] Compile        : vpx <= vp9_entropymv.c
[mips] Compile        : vpx <= vp9_filter.c
[mips] Compile        : vpx <= vp9_frame_buffers.c
[mips] Compile        : vpx <= vp9_idct.c
[mips] Compile        : vpx <= vp9_loopfilter.c
[mips] Compile        : vpx <= vp9_mvref_common.c
[mips] Compile        : vpx <= vp9_pred_common.c
[mips] Compile        : vpx <= vp9_quant_common.c
[mips] Compile        : vpx <= vp9_reconinter.c
[mips] Compile        : vpx <= vp9_reconintra.c
[mips] Compile        : vpx <= vp9_rtcd.c
[mips] Compile        : vpx <= vp9_scale.c
[mips] Compile        : vpx <= vp9_scan.c
[mips] Compile        : vpx <= vp9_seg_common.c
[mips] Compile        : vpx <= vp9_thread_common.c
[mips] Compile        : vpx <= vp9_tile_common.c
[mips] Compile        : vpx <= vp9_decodeframe.c
[mips] Compile        : vpx <= vp9_decodemv.c
[mips] Compile        : vpx <= vp9_decoder.c
[mips] Compile        : vpx <= vp9_detokenize.c
[mips] Compile        : vpx <= vp9_dsubexp.c
[mips] Compile        : vpx <= vp9_dthread.c
[mips] Compile        : vpx <= vpx_codec.c
[mips] Compile        : vpx <= vpx_decoder.c
[mips] Compile        : vpx <= vpx_encoder.c
[mips] Compile        : vpx <= vpx_image.c
[mips] Compile        : vpx <= bitreader.c
[mips] Compile        : vpx <= bitreader_buffer.c
[mips] Compile        : vpx <= intrapred.c
[mips] Compile        : vpx <= inv_txfm.c
[mips] Compile        : vpx <= loopfilter.c
[mips] Compile        : vpx <= prob.c
[mips] Compile        : vpx <= vpx_convolve.c
[mips] Compile        : vpx <= vpx_dsp_rtcd.c
[mips] Compile        : vpx <= vpx_mem.c
[mips] Compile        : vpx <= gen_scalers.c
[mips] Compile        : vpx <= vpx_scale.c
[mips] Compile        : vpx <= yv12config.c
[mips] Compile        : vpx <= yv12extend.c
[mips] Compile        : vpx <= vpx_scale_rtcd.c
[mips] Compile        : vpx <= vpx_thread.c
[mips] Compile        : vpx <= vpx_config.c
[mips] Compile++      : vpxJNI <= vpx_jni.cc
[mips] Compile++      : yuv_static <= compare.cc
[mips] Compile++      : yuv_static <= compare_common.cc
[mips] Compile++      : yuv_static <= compare_neon64.cc
[mips] Compile++      : yuv_static <= compare_gcc.cc
[mips] Compile++      : yuv_static <= convert.cc
[mips] Compile++      : yuv_static <= convert_argb.cc
[mips] Compile++      : yuv_static <= convert_from.cc
[mips] Compile++      : yuv_static <= convert_from_argb.cc
[mips] Compile++      : yuv_static <= convert_to_argb.cc
[mips] Compile++      : yuv_static <= convert_to_i420.cc
[mips] Compile++      : yuv_static <= cpu_id.cc
[mips] Compile++      : yuv_static <= planar_functions.cc
[mips] Compile++      : yuv_static <= rotate.cc
[mips] Compile++      : yuv_static <= rotate_any.cc
[mips] Compile++      : yuv_static <= rotate_argb.cc
[mips] Compile++      : yuv_static <= rotate_common.cc
[mips] Compile++      : yuv_static <= rotate_mips.cc
[mips] Compile++      : yuv_static <= rotate_neon64.cc
[mips] Compile++      : yuv_static <= rotate_gcc.cc
[mips] Compile++      : yuv_static <= row_any.cc
[mips] Compile++      : yuv_static <= row_common.cc
[mips] Compile++      : yuv_static <= row_mips.cc
[mips] Compile++      : yuv_static <= row_neon64.cc
[mips] Compile++      : yuv_static <= row_gcc.cc
/home/davinctor/AndroidStudioProjects/ExoPlayer/extensions/vp9/src/main/jni/libyuv/source/row_mips.cc:70:6: error: unknown instruction
    "sgtu      $v1, %[dst], $t9                  \n"
     ^
<inline asm>:27:1: note: instantiated into assembly here
sgtu      $v1, $5, $t9                  
^
/home/davinctor/AndroidStudioProjects/ExoPlayer/extensions/vp9/src/main/jni/libyuv/source/row_mips.cc:121:6: error: unknown instruction
    "sgtu      $v1, %[dst], $t9                  \n"
     ^
<inline asm>:74:1: note: instantiated into assembly here
sgtu      $v1, $5, $t9                  
^
/home/davinctor/AndroidStudioProjects/ExoPlayer/extensions/vp9/src/main/jni/libyuv/source/row_mips.cc:223:6: error: unknown instruction
    "sgtu      $v1, %[dst], $t9                  \n"
     ^
<inline asm>:144:1: note: instantiated into assembly here
sgtu      $v1, $5, $t9                  
^
/home/davinctor/AndroidStudioProjects/ExoPlayer/extensions/vp9/src/main/jni/libyuv/source/row_mips.cc:294:6: error: unknown instruction
    "sgtu      $v1,%[dst],$t9                    \n"
     ^
<inline asm>:207:1: note: instantiated into assembly here
sgtu      $v1,$5,$t9                    
^
4 errors generated.
make: *** [/home/davinctor/AndroidStudioProjects/ExoPlayer/extensions/vp9/src/main/obj/local/mips/objs/yuv_static/source/row_mips.o] Error 1
make: *** Waiting for unfinished jobs....

Also, I have to install gcc-multilib refered to this issue to finish configuring process successfully.
Also I checked this issue, but I see that generate_libvpx_android_configs.sh file doesn't require any changes.

Many thanks for your work!

@vigneshvg
Copy link
Contributor

Thank you for pointing these out.

The error is on configuring vp8, possible I can ignore it, but want to mention it.
make[1]: *** No rule to make target 'vp8_rtcd.h'. Stop.
Makefile:17: recipe for target 'vp8_rtcd.h' failed
make: *** [vp8_rtcd.h] Error 2

This error can be safely ignored. See comment in [1].

I am able to reproduce the armeabi and mips failures with r14b.

Regarding armeabi failure:
This is a really weird failure coming from [2]. It most certainly is a clang or android-ndk bug as it is not supposed to generate 'SSAT' instruction when -march=armv5te. Per [3] 'SSAT' is supported only on armv6 or higher. This is out of my scope, i have filed a bug internally with the android NDK team. But as far as the vp9 extension build goes, the only workaround i can provide as of now is to not use r14b (or r15 beta).

Also, FWIW armeabi is a really silly architecture that does not have many devices in the wild. So you may be ok just building for armeabi-v7a (which works with r14b).

Regarding mips failure:
This failure is coming from libyuv and again something that works with r10. I have contacted the libyuv authors about why this fails in r14b. I will update this bug once i hear back from them.

[1] https://github.com/google/ExoPlayer/blob/release-v2/extensions/vp9/src/main/jni/generate_libvpx_android_configs.sh#L109
[2] https://github.com/webmproject/libvpx/blob/master/vpx_dsp/loopfilter.c#L18
[3] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489c/Cihgfjab.html

@vigneshvg
Copy link
Contributor

Unfortunately, both the armeabi and the mips issues seem to be a bug in the compiler itself. I have filed a bug with libyuv [1]. There is a fix that disables the violating code [2]. You will be able to build it once that lands.

In the meantime, the best workaround i can provide is to suggest use of android NDK r13 instead of r14+. Neither of those issues happen in r13.

Closing this bug as it is pretty much outside ExoPlayer project's scope.

[1] https://bugs.chromium.org/p/libyuv/issues/detail?id=700
[2] https://chromium-review.googlesource.com/c/486127/

@davinctor
Copy link
Author

Thanks a lot for your feedback.

ojw28 pushed a commit that referenced this issue Apr 26, 2017
Disable libjpeg dependency when building libyuv.

Partially fixes Github Issue #2661

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154179126
ojw28 pushed a commit that referenced this issue Apr 26, 2017
Disable libjpeg dependency when building libyuv.

Partially fixes Github Issue #2661

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154179126
@google google locked and limited conversation to collaborators Aug 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants