Trying to compile (cross) with android arm64

1,605 views
Skip to first unread message

matthe...@gmail.com

unread,
Jan 30, 2018, 2:49:00 PM1/30/18
to WebM Discussion
Hello, I am new to compiling with libvpx and ideally I want to cross compile with FFMPEG on android. Before I get there I am having issues compiling libvpx.

I am using ubuntu 16.04, cloned https://chromium.googlesource.com/webm/libvpx and then tried to configure with the 

./configure  --target=arm64-android-gcc --disable-examples

And i get an error when make: 

vpx_dsp/arm/idct4x4_1_add_neon.c:11:22: fatal error: arm_neon.h: No such file or directory
 #include <arm_neon.h>

I thought maybe I need to add the sdk_path, downloaded ndk r16e for linux and then (also tried to point to a standalone toolchain, didn't work either)

 ./configure  --target=arm64-android-gcc --disable-examples --sdk-path=$NDK

Failed configuration, checked config.log and at the end

android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc --sysroot=/hdd/Android/android-ndk-r16b/platforms/android-27/arch-arm -DNDEBUG -O3 -fPIC -Wall -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-conversion -Wpointer-arith -Wtype-limits -Wcast-qual -Wvla -Wimplicit-function-declaration -Wuninitialized -Wunused -Wextra -Wundef -E -o /tmp/vpx-conf-2697-2985.o /tmp/vpx-conf-2697-2985.c
/tmp/vpx-conf-2697-2985.c:1:19: fatal error: stdio.h: No such file or directory
 #include "stdio.h"
                   ^
compilation terminated.

Is it pointing to the non-64 bit toolchain (it is autogenerated...)? 

Then I tried using external build,

 ./configure  --target=arm64-android-gcc --disable-examples --sdk-path=$NDK --enable-external-build

That worked, then make gives an error:

   disabling examples
  enabling external_build
  enabling vp8_encoder
  enabling vp8_decoder
  enabling vp9_encoder
  enabling vp9_decoder
Configuring for target 'arm64-android-gcc'
  enabling arm64
  enabling neon
  enabling realtime_only
  enabling webm_io
  enabling libyuv
Bypassing toolchain for environment detection.
Creating makefiles for arm64-android-gcc libs
Creating makefiles for arm64-android-gcc tools
Creating makefiles for arm64-android-gcc docs
ngmatthew@ngmatthew:~/Android/libvpx$ 
ngmatthew@ngmatthew:~/Android/libvpx$ make -j64^C
ngmatthew@ngmatthew:~/Android/libvpx$ make -j64
make[1]: Nothing to be done for `all'.
    [CC] tools/tiny_ssim.c.o
arm-linux-androideabi-gcc: error: unrecognized command line option '-Wparentheses-equality'
arm-linux-androideabi-gcc: error: unrecognized command line option '-Wshorten-64-to-32'
make[1]: *** [tools/tiny_ssim.c.o] Error 1
make: *** [.DEFAULT] Error 2

Then I tried to do the way I am compiling other libraries with cflags. Created a arm64 standalone toolchain

$NDK/build/tools/make_standalone_toolchain.py     --arch arm64 --api 27 --install-dir /tmp/toolchain
export TOOL= /tmp/toolchain

Then the configure

./configure  --target=arm64-android-gcc --disable-examples --prefix=prefix --extra-cflags=" -I$TOOL/lib/gcc/aarch64-linux-android/4.9.x/include/ -L$TOOL/sysroot/usr/lib -D__ANDROID_API__=27 -isystem $TOOL/sysroot/usr/include/aarch64-linux-android/ -I$TOOL/system/usr/include/aarch64-linux-android/"

I checked all the paths (and they work) but not sure about the cflags. Then I run make  and I get a bunch of errors similar to

/hdd/Android/tmp/toolchain//lib/gcc/aarch64-linux-android/4.9.x/include/arm_neon.h:86:1: error: unknown type name ‘__builtin_aarch64_simd_poly16’
 typedef __builtin_aarch64_simd_poly16 poly16_t;
 ^

What am I missing or doing wrong? Thanks in advance!
 
 

Johann Koenig

unread,
Jan 30, 2018, 5:28:55 PM1/30/18
to webm-d...@webmproject.org
On Tue, Jan 30, 2018 at 11:49 AM <matthe...@gmail.com> wrote:
Hello, I am new to compiling with libvpx and ideally I want to cross compile with FFMPEG on android. Before I get there I am having issues compiling libvpx.

I am using ubuntu 16.04, cloned https://chromium.googlesource.com/webm/libvpx and then tried to configure with the 

./configure  --target=arm64-android-gcc --disable-examples

Can you try --target=arm64-linux-gcc instead? the -android- targets tried to do some tricky things wrt guessing some settings in the NDK which may have changed. linux binaries should run just fine on android. 

Zach Reedy

unread,
Apr 7, 2021, 8:00:22 PM4/7/21
to WebM Discussion, matthe...@gmail.com
Hello,

I'm having a similar issue!
I tried Johann's suggestion of targeting arm64-android-gcc but I get the same error: "Unable to find arm_neon.h"

My environment is cygwin. NDK is installed via Android Studio.

Did you happen to find a solution to this?
Or would anyone happen to know where arm_neon.h resides? What library or toolchain does it belong to?

Cheers,
Zach Reedy

Алексей Мицкевич

unread,
Apr 14, 2021, 1:30:39 PM4/14/21
to WebM Discussion, Zach Reedy, matthe...@gmail.com
Hello,
Having similar problem, but on macOS and for target=armv7-android-gcc.
Log:
gcc -DNDEBUG -O3 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-conversion -Wparentheses-equality -Wpointer-arith -Wtype-limits -Wcast-qual -Wvla -Wimplicit-function-declaration -Wmissing-declarations -Wmissing-prototypes -Wuninitialized -Wunreachable-code-loop-increment -Wunused -Wextra -Wundef -Wframe-larger-than=52000 -std=gnu89 -Wshorten-64-to-32 -E -o /var/folders/17/9sjpmrvj5sqf9t2kxhn18q080000gq/T//vpx-conf-50871-23808.o /var/folders/17/9sjpmrvj5sqf9t2kxhn18q080000gq/T//vpx-conf-50871-23808.c
In file included from /var/folders/17/9sjpmrvj5sqf9t2kxhn18q080000gq/T//vpx-conf-50871-23808.c:1:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3/include/arm_neon.h:28:2: error: "NEON support not enabled"
#error "NEON support not enabled"
 ^
1 error generated.
Would be appreciate for any help!

четверг, 8 апреля 2021 г. в 03:00:22 UTC+3, Zach Reedy:

James Zern

unread,
Apr 15, 2021, 1:10:51 AM4/15/21
to WebM Discussion, matthe...@gmail.com
Hi,

On Wed, Apr 7, 2021 at 5:00 PM Zach Reedy <zach...@gmail.com> wrote:
Hello,

I'm having a similar issue!
I tried Johann's suggestion of targeting arm64-android-gcc but I get the same error: "Unable to find arm_neon.h"

My environment is cygwin. NDK is installed via Android Studio.

Did you happen to find a solution to this?
Or would anyone happen to know where arm_neon.h resides? What library or toolchain does it belong to?

By default configure will attempt to use gcc as the compiler, to use the toolchain in the ndk directly you'll need a few more options. Something like the following will work if you adjust the path for your cygwin install:
$ export PATH=$PATH:<path-to-android-ndk>/toolchains/llvm/prebuilt/linux-x86_64/bin
$ CROSS=arm-linux-androideabi- CC=armv7a-linux-androideabi21-clang CXX=armv7a-linux-androideabi21-clang++ ../libvpx/configure --target=armv7-android-gcc
$ make -j

If you're building with Android.mk files there is another option documented in build/make/Android.mk:
 
--
You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webm-discuss...@webmproject.org.
To view this discussion on the web visit https://groups.google.com/a/webmproject.org/d/msgid/webm-discuss/761732b6-40bf-4ba7-89cb-648c4009e512n%40webmproject.org.

James Zern

unread,
Apr 15, 2021, 1:12:24 AM4/15/21
to WebM Discussion, Zach Reedy, matthe...@gmail.com
Hi,

On Wed, Apr 14, 2021 at 10:30 AM Алексей Мицкевич <aleks.mi...@gmail.com> wrote:
Hello,
Having similar problem, but on macOS and for target=armv7-android-gcc.
Log:
gcc -DNDEBUG -O3 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-conversion -Wparentheses-equality -Wpointer-arith -Wtype-limits -Wcast-qual -Wvla -Wimplicit-function-declaration -Wmissing-declarations -Wmissing-prototypes -Wuninitialized -Wunreachable-code-loop-increment -Wunused -Wextra -Wundef -Wframe-larger-than=52000 -std=gnu89 -Wshorten-64-to-32 -E -o /var/folders/17/9sjpmrvj5sqf9t2kxhn18q080000gq/T//vpx-conf-50871-23808.o /var/folders/17/9sjpmrvj5sqf9t2kxhn18q080000gq/T//vpx-conf-50871-23808.c
In file included from /var/folders/17/9sjpmrvj5sqf9t2kxhn18q080000gq/T//vpx-conf-50871-23808.c:1:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3/include/arm_neon.h:28:2: error: "NEON support not enabled"
#error "NEON support not enabled"
 ^
1 error generated.
Would be appreciate for any help!

See my reply earlier in the thread for building with the NDK.
 
--
You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webm-discuss...@webmproject.org.
Reply all
Reply to author
Forward
0 new messages