Skip to content

Unable to build the external delegate for the A311D processor on Android armv7-a #171

@FrankdenUijl

Description

@FrankdenUijl

If I understand correctly I can build an External Delegate (for example: libvx_delegate.so) via this repository and run TensorFlow Lite models on the NPU of the A311D processor?

My first question, do I need to modify TensorFlow Lite to run this delegate, or can I swap this delegate with a different external delegate with a pre-build TensorFlow Lite plugin?

For example replace the external delegate on this location with the libvx_delegate.so (this runs TensorFlow Lite):
https://github.com/asus4/tf-lite-unity-sample/tree/master/Packages/com.github.asus4.tflite/Plugins/Android/armeabi-v7a

My second question is, I'm unable to build this external delegate:

cmake .. -DCMAKE_TOOLCHAIN_FILE=C:/Users/Frank/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake
-- Building for: Visual Studio 17 2022
-- Setting build type to Release, for debug builds use'-DCMAKE_BUILD_TYPE=Debug'.
-- ANDROID_PLATFORM not set. Defaulting to minimum supported version
19.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Users/Frank/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: C:/Users/Frank/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.26/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "C:/Users/Frank/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/Frank/Documents/4Growth/wksp/tflite-vx-delegate/builds/CMakeFiles/CMakeScratch/TryCompile-ubk14s

    Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_86eea.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:n && MSBuild version 17.5.0+6f08c67f3 for .NET Framework
    Build started 15-3-2023 09:59:19.
    Included response file: C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\MSBuild.rsp

    Project "C:\Users\Frank\Documents\4Growth\wksp\tflite-vx-delegate\builds\CMakeFiles\CMakeScratch\TryCompile-ubk14s\cmTC_86eea.vcxproj" on node 1 (default targets).
    SetBuildDefaultEnvironmentVariables:
      ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
      ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk
      ANT_HOME=
      JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08
      NDK_ROOT=C:\\Microsoft\AndroidNDK\android-ndk-r23c
    PrepareForBuild:
      Creating directory "cmTC_86eea.dir\Debug\".
      Creating directory "C:\Users\Frank\Documents\4Growth\wksp\tflite-vx-delegate\builds\CMakeFiles\CMakeScratch\TryCompile-ubk14s\Debug\".
      Creating directory "cmTC_86eea.dir\Debug\cmTC_86eea.tlog\".
    InitializeBuildStatus:
      Creating "cmTC_86eea.dir\Debug\cmTC_86eea.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
    ClCompile:
      C:\\Microsoft\AndroidNDK\android-ndk-r23c\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe -c -fdiagnostics-format=msvc --gcc-toolchain="C:\\\\Microsoft\\AndroidNDK\\android-ndk-r23c\\toolchains\\x86_64-4.9\\prebuilt\\windows-x86_64" -target "x86_64-none-linux-android1" --sysroot="C:\\\\Microsoft\\AndroidNDK\\android-ndk-r23c\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot" -isystem "C:\\\\Microsoft\\AndroidNDK\\android-ndk-r23c\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\include\\x86_64-linux-android" -isystem "C:\\\\Microsoft\\AndroidNDK\\android-ndk-r23c\\toolchains\\llvm\\prebuilt\\windows-x86_64\\lib64\\clang\\12.0.9\\include" -isystem "C:\\\\Microsoft\\AndroidNDK\\android-ndk-r23c\\sources\\android\\support\\include" -isystem "C:\\\\Microsoft\\AndroidNDK\\android-ndk-r23c\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\include" -I "C:\\\\Microsoft\\AndroidNDK\\android-ndk-r23c\\sources\\cxx-stl\\llvm-libc++\\include" -I "C:\\\\Microsoft\\AndroidNDK\\android-ndk-r23c\\sources\\cxx-stl\\llvm-libc++abi\\include" -I "C:\\\\Microsoft\\AndroidNDK\\android-ndk-r23c\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\include" -I "C:\\\\Microsoft\\AndroidNDK\\android-ndk-r23c\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\include\\x86_64-linux-android" -I "C:\\\\Microsoft\\AndroidNDK\\android-ndk-r23c\\sources\\android\\support\\include" -I "C:\\\\Microsoft\\AndroidNDK\\android-ndk-r23c\\toolchains\\llvm\\prebuilt\\windows-x86_64\\lib64\\clang\\12.0.9\\include" -gline-tables-only -o "cmTC_86eea.dir\\Debug\\testCCompiler.o" -Wall -O3 -fno-strict-aliasing -fomit-frame-pointer -fno-exceptions -ffunction-sections -fdata-sections -fstack-protector -fpic -fno-short-enums -D __ANDROID_API__=1 -D NDEBUG -D ANDROID -D _FORTIFY_SOURCE=2 -D "CMAKE_INTDIR=\"Debug\"" -x c  -g -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mthumb -Wformat -Werror=format-security -fno-limit-debug-info "C:\\Users\\Frank\\Documents\\4Growth\\wksp\\tflite-vx-delegate\\builds\\CMakeFiles\\CMakeScratch\\TryCompile-ubk14s\\testCCompiler.c"
      testCCompiler.c
    clang : warning : argument unused during compilation: '-mthumb' [-Wunused-command-line-argument] [C:\Users\Frank\Documents\4Growth\wksp\tflite-vx-delegate\builds\CMakeFiles\CMakeScratch\TryCompile-ubk14s\cmTC_86eea.vcxproj]
    CLANGCOMPILE : error : unknown target CPU 'armv7-a' [C:\Users\Frank\Documents\4Growth\wksp\tflite-vx-delegate\builds\CMakeFiles\CMakeScratch\TryCompile-ubk14s\cmTC_86eea.vcxproj]
      note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
    Done Building Project "C:\Users\Frank\Documents\4Growth\wksp\tflite-vx-delegate\builds\CMakeFiles\CMakeScratch\TryCompile-ubk14s\cmTC_86eea.vcxproj" (default targets) -- FAILED.

    Build FAILED.

    "C:\Users\Frank\Documents\4Growth\wksp\tflite-vx-delegate\builds\CMakeFiles\CMakeScratch\TryCompile-ubk14s\cmTC_86eea.vcxproj" (default target) (1) ->
    (ClCompile target) ->
      clang : warning : argument unused during compilation: '-mthumb' [-Wunused-command-line-argument] [C:\Users\Frank\Documents\4Growth\wksp\tflite-vx-delegate\builds\CMakeFiles\CMakeScratch\TryCompile-ubk14s\cmTC_86eea.vcxproj]


    "C:\Users\Frank\Documents\4Growth\wksp\tflite-vx-delegate\builds\CMakeFiles\CMakeScratch\TryCompile-ubk14s\cmTC_86eea.vcxproj" (default target) (1) ->
    (ClCompile target) ->
      CLANGCOMPILE : error : unknown target CPU 'armv7-a' [C:\Users\Frank\Documents\4Growth\wksp\tflite-vx-delegate\builds\CMakeFiles\CMakeScratch\TryCompile-ubk14s\cmTC_86eea.vcxproj]

        1 Warning(s)
        1 Error(s)

    Time Elapsed 00:00:00.20





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:31 (project)


-- Configuring incomplete, errors occurred!

Our A311D processor runs on Android 32-bit.

Any help is appreciated, thanks!

Metadata

Metadata

Assignees

No one assigned

    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