Open psyhtest opened 5 years ago
Compiling with Clang 6 from Android NDK r17b results in even more errors and warnings:
clang++ -c -fPIE -pie -target aarch64-linux-android -gcc-toolchain /home/anton/data/android-ndk-r13b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 --sysroot=/home/anton/data/android-ndk-r13$
/platforms/android-24/arch-arm64 -I/home/anton/data/android-ndk-r17b/sysroot/usr/include -I/home/anton/data/android-ndk-r17b/sysroot/usr/include/aarch64-linux-android -I../ -DCK_HOST_OS_NAME2_LINUX=1 -$
CK_HOST_OS_NAME_LINUX=1 -DCK_TARGET_OS_NAME2_ANDROID=1 -DCK_TARGET_OS_NAME_LINUX=1 -std=c++11 -DTF_LITE_1_13 -Wall -Wno-sign-compare -I/home/anton/data/android-ndk-r17b/toolchains/llvm/prebuilt/linux-x86$
64/include -I/home/anton/CK_TOOLS/lib-rtl-xopenme-0.3-android-ndk-4.9.x-android24-arm64/include -I/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include -I -I/home/anton/CK_TOOLS/lib-tflit
e-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src -I/home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/tools/make/downloads/flatbuffe
rs/include ../classification.cpp -o classification.o
clang++: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
In file included from ../classification.cpp:12:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/kernels/register.h:19:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/model.h:40:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/interpreter.h:20:
In file included from /home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/complex:246:
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/cmath:313:9: error: no member named 'signbit' in the global namespace; did you mean 'sigwait'?
using ::signbit;
~~^
/home/anton/data/android-ndk-r17b/sysroot/usr/include/signal.h:129:5: note: 'sigwait' declared here
int sigwait(const sigset_t* __set, int* __signal);
^
In file included from ../classification.cpp:12:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/kernels/register.h:19:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/model.h:40:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/interpreter.h:20:
In file included from /home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/complex:246:
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/cmath:314:9: error: no member named 'fpclassify' in the global namespace
using ::fpclassify;
~~^
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/cmath:315:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
~~^
/home/anton/data/android-ndk-r17b/sysroot/usr/include/math.h:375:5: note: 'finite' declared here
int finite(double __x) __attribute_const__;
^
In file included from ../classification.cpp:12:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/kernels/register.h:19:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/model.h:40:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/interpreter.h:20:
In file included from /home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/complex:246:
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/cmath:318:9: error: no member named 'isnormal' in the global namespace
using ::isnormal;
~~^
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/cmath:319:7: error: no member named 'isgreater' in the global namespace; did you mean '::std::greater'?
using ::isgreater;
^~
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/functional:720:29: note: '::std::greater' declared here
struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool>
^
In file included from ../classification.cpp:12:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/kernels/register.h:19:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/model.h:40:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/interpreter.h:20:
In file included from /home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/complex:246:
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/cmath:320:7: error: no member named 'isgreaterequal' in the global namespace; did you mean '::std::greater_equal'?
using ::isgreaterequal;
^~
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/functional:749:29: note: '::std::greater_equal' declared here
struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool>
^
In file included from ../classification.cpp:12:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/kernels/register.h:19:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/model.h:40:
In file included from /home/anton/CK_TOOLS/lib-tflite-src-static-1.13.1-llvm-android-ndk-6.0.2-android24-arm64/src/tensorflow/lite/interpreter.h:20:
In file included from /home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/complex:246:
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/cmath:321:9: error: no member named 'isless' in the global namespace
using ::isless;
~~^
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/cmath:322:9: error: no member named 'islessequal' in the global namespace
using ::islessequal;
~~^
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/cmath:323:9: error: no member named 'islessgreater' in the global namespace
using ::islessgreater;
~~^
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/cmath:324:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
~~^
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/cmath:325:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
~~^
In file included from ../classification.cpp:9:
In file included from ../benchmark.h:16:
In file included from /home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/fstream:169:
In file included from /home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/ostream:138:
In file included from /home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/ios:216:
In file included from /home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/__locale:15:
In file included from /home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/string:470:
In file included from /home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/string_view:169:
In file included from /home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/__string:56:
In file included from /home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/algorithm:643:
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/memory:2233:5: warning: delete called on 'CK::IBenchmark' that is abstract but has non-virtual destructor [-Wdelete-non-virtual-dtor]
delete __ptr;
^
/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include/memory:2546:7: note: in instantiation of member function 'std::__ndk1::default_delete<CK::IBenchmark>::operator()' requested here
__ptr_.second()(__tmp);
^
../classification.cpp:73:19: note: in instantiation of member function 'std::__ndk1::unique_ptr<CK::IBenchmark, std::__ndk1::default_delete<CK::IBenchmark> >::reset' requested here
benchmark.reset(new TFLiteBenchmark<float, InNormalize, OutCopy>(&settings, interpreter.get(), input_index));
^
1 warning and 11 errors generated.
***************************************************************************************
Compilation time: 1.297 sec.; Object size: 0; Total binary size: 0; MD5:
Warning: compilation failed!
$ ck show env --tags=compiler,lang-cpp,llvm,target-os-android24-arm64,v6
Env UID: Target OS: Bits: Name: Version: Tags:
f58acb20767b3ac2 android24-arm64 64 Android NDK LLVM compiler 6.0.2 64bits,android,compiler,host-os-linux-64,lang-c,lang-cpp,llvm,ndk,target-os-android24-arm64,v6,v6.0,v6.0.2
$ ck show env --tags=lib,tflite,target-os-android24-arm64,compiled-by-llvm-android-ndk-6.0.2
Env UID: Target OS: Bits: Name: Version: Tags:
b3f4a8483fba565c android24-arm64 64 TensorFlow Lite API (from sources, static) 1.13.1 64bits,channel-stable,compiled-by-llvm-android-ndk,compiled-by-llvm-android-ndk-6.0.2,host-os-linux-64,lib,lite,target-os-android24-arm64,tensorflow,tensorflow-lite,tensorflow-static,tflite,v1,v1.13,v1.13.1,vsrc,vstatic
$ ck cat env --tags=compiler,lang-cpp,llvm,target-os-android24-arm64,v6 | grep INCLUDE
export CK_ENV_COMPILER_LLVM_INCLUDE=/home/anton/data/android-ndk-r17b/toolchains/llvm/prebuilt/linux-x86_64/include
export CK_ENV_LIB_STDCPP_INCLUDE=/home/anton/data/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include
export CK_ENV_LIB_STDCPP_INCLUDE_EXTRA=" "
export CK_FLAG_PREFIX_INCLUDE=-I
In fact, CK_ENV_COMPILER_LLVM_INCLUDE
does not even exist:
$ l /home/anton/data/android-ndk-r17b/toolchains/llvm/prebuilt/linux-x86_64/include
ls: cannot access '/home/anton/data/android-ndk-r17b/toolchains/llvm/prebuilt/linux-x86_64/include': No such file or directory
$ find /home/anton/data/android-ndk-r17b/toolchains/llvm/prebuilt/linux-x86_64 -name include
/home/anton/data/android-ndk-r17b/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/6.0.2/include
anton@velociti:~/CK_REPOS/ck-tensorflow$ l /home/anton/data/android-ndk-r17b/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/6.0.2/include
__clang_cuda_builtin_vars.h altivec.h avx512erintrin.h avx512vlintrin.h emmintrin.h intrin.h msa.h rtmintrin.h stdint.h x86intrin.h
__clang_cuda_cmath.h ammintrin.h avx512fintrin.h avx512vpopcntdqintrin.h f16cintrin.h inttypes.h mwaitxintrin.h s390intrin.h stdnoreturn.h xmmintrin.h
__clang_cuda_complex_builtins.h arm64intr.h avx512ifmaintrin.h avxintrin.h float.h iso646.h nmmintrin.h sanitizer/ tbmintrin.h xopintrin.h
__clang_cuda_intrinsics.h arm_acle.h avx512ifmavlintrin.h bmi2intrin.h fma4intrin.h limits.h omp.h shaintrin.h tgmath.h xray/
__clang_cuda_math_forward_declares.h arm_neon.h avx512pfintrin.h bmiintrin.h fmaintrin.h lwpintrin.h opencl-c.h smmintrin.h tmmintrin.h xsavecintrin.h
__clang_cuda_runtime_wrapper.h armintr.h avx512vbmiintrin.h clflushoptintrin.h fxsrintrin.h lzcntintrin.h pkuintrin.h stdalign.h unwind.h xsaveintrin.h
__stddef_max_align_t.h avx2intrin.h avx512vbmivlintrin.h clwbintrin.h htmintrin.h mm3dnow.h pmmintrin.h stdarg.h vadefs.h xsaveoptintrin.h
__wmmintrin_aes.h avx512bwintrin.h avx512vlbwintrin.h clzerointrin.h htmxlintrin.h mm_malloc.h popcntintrin.h stdatomic.h varargs.h xsavesintrin.h
__wmmintrin_pclmul.h avx512cdintrin.h avx512vlcdintrin.h cpuid.h ia32intrin.h mmintrin.h prfchwintrin.h stdbool.h vecintrin.h xtestintrin.h
adxintrin.h avx512dqintrin.h avx512vldqintrin.h cuda_wrappers/ immintrin.h module.modulemap rdseedintrin.h stddef.h wmmintrin.h
Similar for NDK 13b:
$ l /home/anton/data/android-ndk-r13b/toolchains/llvm/prebuilt/linux-x86_64/include
ls: cannot access '/home/anton/data/android-ndk-r13b/toolchains/llvm/prebuilt/linux-x86_64/include': No such file or directory
$ find /home/anton/data/android-ndk-r13b/toolchains/llvm/prebuilt/linux-x86_64/ -name include
/home/anton/data/android-ndk-r13b/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/3.8/include
/home/anton/data/android-ndk-r13b/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/3.8.256229/include
For Clang 7 in NDK 18b:
$ ck show env --tags=compiler,lang-cpp,llvm,target-os-android28-arm64,v7
Env UID: Target OS: Bits: Name: Version: Tags:
1c70f43a4910bf0c android28-arm64 64 Android NDK LLVM compiler 7.0.2 64bits,android,compiler,host-os-linux-64,lang-c,lang-cpp,llvm,ndk,target-os-android28-arm64,v7,v7.0,v7.0.2
it's even more complicated:
$ ck cat env --tags=compiler,lang-cpp,llvm,target-os-android28-arm64,v7 | grep INCLUDE
export CK_ENV_COMPILER_LLVM_INCLUDE=/home/anton/data/android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64/include
export CK_ENV_LIB_STDCPP_INCLUDE=/home/anton/data/android-ndk-r18b/sources/cxx-stl/gnu-libstdc++/include
export CK_ENV_LIB_STDCPP_INCLUDE_EXTRA=/home/anton/data/android-ndk-r18b/sources/cxx-stl/gnu-libstdc++/libs/arm64-v8a/include
export CK_FLAG_PREFIX_INCLUDE=-I
$ l /home/anton/data/android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64/include
ls: cannot access '/home/anton/data/android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64/include': No such file or directory
$ find /home/anton/data/android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64 -name include
/home/anton/data/android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/7.0.2/include
$ l /home/anton/data/android-ndk-r18b/sources/cxx-stl/gnu-libstdc++/include
ls: cannot access '/home/anton/data/android-ndk-r18b/sources/cxx-stl/gnu-libstdc++/include': No such file or directory
$ l /home/anton/data/android-ndk-r18b/sources/cxx-stl/gnu-libstdc++/4.9/include
ls: cannot access '/home/anton/data/android-ndk-r18b/sources/cxx-stl/gnu-libstdc++/4.9/include': No such file or directory
$ l /home/anton/data/android-ndk-r18b/sources/cxx-stl/gnu-libstdc++
ls: cannot access '/home/anton/data/android-ndk-r18b/sources/cxx-stl/gnu-libstdc++': No such file or directory
$ l /home/anton/data/android-ndk-r18b/sources/cxx-stl/gnu-libstdc++/libs/arm64-v8a/include
ls: cannot access '/home/anton/data/android-ndk-r18b/sources/cxx-stl/gnu-libstdc++/libs/arm64-v8a/include': No such file or directory
$ l /home/anton/data/android-ndk-r18b/sources/cxx-stl/gnu-libstdc++
ls: cannot access '/home/anton/data/android-ndk-r18b/sources/cxx-stl/gnu-libstdc++': No such file or directory
In fact, I cannot even build TFLite with NDK 18b:
$ ck install package --tags=lib,tflite,v1.13.1 --target_os=android28-arm64
Package found: lib-tflite-1.13.1-src-static (bbde49998ab62431)
-----------------------------------
Resolving software dependencies ...
*** Dependency 1 = compiler (C++ compiler):
More than one environment found for "C++ compiler" with tags="compiler,lang-cpp" and setup={"target_os_bits": "64", "host_os_uoa": "linux-64", "target_os_uoa": "android28-arm64"}:
0) Android NDK GCC compiler - vclang (64bits,android,compiler,gcc,host-os-linux-64,lang-c,lang-cpp,ndk,target-os-android28-arm64,v0 (fbe5a0899e47cda8))
1) Android NDK LLVM compiler - v7.0.2 (64bits,android,compiler,host-os-linux-64,lang-c,lang-cpp,llvm,ndk,target-os-android28-arm64,v7,v7.0,v7.0.2 (1c70f43a4910bf0c))
- Depends on "ndk" (env UOA=6e010ee496a928e8, tags="android,ndk,toolchain", version=2.27.0.20170315)
Select one of the options for "C++ compiler" with tags="compiler,lang-cpp" and setup={"target_os_bits": "64", "host_os_uoa": "linux-64", "target_os_uoa": "android28-arm64"} [ hit return for "0" ]: 1
results in tons of errors indicating again that the paths are not set up properly.
NB: I've learnt the hard way to avoid selecting the default when prompted. Recall no GCC is included in NDK from this revision on.
I have a version of TFLite v1.13.1 built for Android:
As indicated by the tags, it's compiled with Clang 3.8 in Android NDK (r13b):
Cross-compiling
program:image-classification-tflite
for Android fails:Inspecting the environment reveals what the problem is:
The include paths should be prefixed by
/home/anton/data/android-ndk-r13b/sources/cxx-stl/gnu-libstdc++/4.9
. It looks that thever
variable here is now empty after some changes to support NDK >= 17: