I was following this Android TVM Demo tutorial
System:
ubuntu 18.04
Gradle 5.0
LLVM 6.x
gcc and g++ 6.x
Apache Maven 3.5.2
Docker version 18.09.0
~Android/Sdk:NDK16.1
But I met some trouble like those:
acui@OFShare:~/tvm/tvm/apps/android_deploy$ gradle clean build
> Task :app:buildJni
/home/acui/tvm/tvm/apps/android_deploy/app/src/main/jnistrong text
Android NDK: WARNING: APP_PLATFORM android-17 is higher than android:minSdkVersion 1 in /home/acui/tvm/tvm/apps/android_deploy/app/src/main/AndroidManifest.xml. NDK binaries will *not* be comptible with devices older than android-17. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md for more information.
make: Entering directory `/home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni'
/home/acui/Android/Sdk/ndk-bundle/build/core/setup-app.mk:81: Android NDK: Application targets deprecated ABI(s): mips64 armeabi mips
/home/acui/Android/Sdk/ndk-bundle/build/core/setup-app.mk:82: Android NDK: Support for these ABIs will be removed in a future NDK release.
[arm64-v8a] Compile++ : tvm4j_runtime_packed <= ml_dmlc_tvm_native_c_api.cc
In file included from /home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/ml_dmlc_tvm_native_c_api.cc:8:
In file included from /home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/tvm_runtime.h:9:
In file included from /home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/../../../../../../include/../src/runtime/c_runtime_api.cc:9:
In file included from /home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/../../../../../../include/tvm/runtime/packed_func.h:18:
In file included from /home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/../../../../../../include/tvm/runtime/module.h:11:
In file included from /home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/../../../../../../3rdparty/dmlc-core/include/dmlc/./io.h:445:
In file included from /home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/../../../../../../3rdparty/dmlc-core/include/dmlc/./serializer.h:22:
/home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/../../../../../../3rdparty/dmlc-core/include/dmlc/./endian.h:26:6: error: "Unable to determine endianness of your machine; use CMake to compile"
#error "Unable to determine endianness of your machine; use CMake to compile"
^
In file included from /home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/ml_dmlc_tvm_native_c_api.cc:8:
In file included from /home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/tvm_runtime.h:9:
In file included from /home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/../../../../../../include/../src/runtime/c_runtime_api.cc:9:
In file included from /home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/../../../../../../include/tvm/runtime/packed_func.h:18:
In file included from /home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/../../../../../../include/tvm/runtime/module.h:11:
In file included from /home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/../../../../../../3rdparty/dmlc-core/include/dmlc/./io.h:445:
/home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/../../../../../../3rdparty/dmlc-core/include/dmlc/./serializer.h:85:9: error: use of undeclared identifier 'DMLC_LITTLE_ENDIAN'
if (DMLC_IO_NO_ENDIAN_SWAP) {
^
/home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni/../../../../../../3rdparty/dmlc-core/include/dmlc/./endian.h:32:33: note: expanded from macro 'DMLC_IO_NO_ENDIAN_SWAP'
#define DMLC_IO_NO_ENDIAN_SWAP (DMLC_LITTLE_ENDIAN == DMLC_IO_USE_LITTLE_ENDIAN)
.......
omitted
.......
17 errors generated.
make: *** [/home/acui/tvm/tvm/apps/android_deploy/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/ml_dmlc_tvm_native_c_api.o] Error 1
make: Leaving directory `/home/acui/tvm/tvm/apps/android_deploy/app/src/main/jni'
> Task :app:buildJni FAILED
FAILURE: Build failed with an exception.
on above outputs of errors,I noticed " #error “Unable to determine endianness of your machine; use CMake to compile” so I vim this tvm/apps/android_deploy/app/src/main/jni/Application.mk file and changed only one line of this:
APP_CPPFLAGS += -DDMLC_LOG_STACK_TRACE=0 -DDMLC_CMAKE_LITTLE_ENDIAN=1 -DTVM4J_ANDROID=1 -std=c++11 -Oz -frtti
(-DDMLC_CMAKE_LITTLE_ENDIAN=0 I also tried.It can also compile this project successfully but can’t run the apk on mobile device)
Then I can compile this project and produce apk file successfully.But when I have installed the apk,the app seems work incorrectly.Like this:
The TVM Android Demo shows dialog “prediction running on image…” then break up.
So does ‘the tvm android demo’ have some bug?Can somebody give me some helpful information. Thanks in advance. @FrozenGene @derisavi @Trami