aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Eilers <jan.eilers@arm.com>2021-02-08 09:23:21 +0000
committerJan Eilers <jan.eilers@arm.com>2021-02-08 09:23:21 +0000
commit72a9929d1ae37a9c32a0c51eb8491e65c3d1add2 (patch)
tree1d1a8261e5ed20e93d7bbff4ac1dfa284253ea4c
parentc5c40fef3d4b3de5d1aa26c1c4dc72dcd74a8bc6 (diff)
downloadarmnn-72a9929d1ae37a9c32a0c51eb8491e65c3d1add2.tar.gz
IVGCVSW-5605 Doxygen: Add remaining guides to doxygen
* Integrates the debian package installation guide * Integrates the AndroidNDK guide * Integrates the cross compile guide Signed-off-by: Jan Eilers <jan.eilers@arm.com> Change-Id: I2243b15ee3f8e976789494199f12f3cc0fd5f00d
-rw-r--r--BuildGuideAndroidNDK.md450
-rw-r--r--BuildGuideCrossCompilation.md623
-rw-r--r--InstallationViaAptRepository.md36
-rw-r--r--docs/02_build_guides.dox15
-rw-r--r--docs/Doxyfile11
5 files changed, 576 insertions, 559 deletions
diff --git a/BuildGuideAndroidNDK.md b/BuildGuideAndroidNDK.md
index 6b5d8d7a53..96e0ca86da 100644
--- a/BuildGuideAndroidNDK.md
+++ b/BuildGuideAndroidNDK.md
@@ -1,307 +1,293 @@
# How to use the Android NDK to build ArmNN
-* [Introduction](#introduction)
-* [Download the Android NDK and make a standalone toolchain](#downloadNDK)
-* [Build the Boost C++ libraries](#buildBoost)
-* [Build the Compute Library](#buildCL)
-* [Build Google's Protobuf library](#buildProtobuf)
-* [Download TensorFlow](#downloadTF)
-* [Build ArmNN](#buildArmNN)
-* [Run ArmNN UnitTests on an Android device](#runArmNNUnitTests)
-
-
-#### <a name="introduction">Introduction</a>
+- [Introduction](#introduction)
+- [Download the Android NDK and make a standalone toolchain](#download-the-android-ndk-and-make-a-standalone-toolchain)
+- [Build the Boost C++ libraries](#build-the-boost-c---libraries)
+- [Build the Compute Library](#build-the-compute-library)
+- [Build Google's Protobuf library](#build-google-s-protobuf-library)
+- [Download TensorFlow](#download-tensorflow)
+- [Build ArmNN](#build-armnn)
+- [Build Standalone Sample Dynamic Backend](#build-standalone-sample-dynamic-backend)
+- [Run the ArmNN unit tests on an Android device](#run-the-armnn-unit-tests-on-an-android-device)
+
+
+## Introduction
These are step by step instructions for using the Android NDK to build ArmNN.
They have been tested on a clean install of Ubuntu 18.04, and should also work with other OS versions.
The instructions show how to build the ArmNN core library and the optional TensorFlow parser.
All downloaded or generated files will be saved inside the `~/armnn-devenv` directory.
-#### <a name="downloadNDK">Download the Android NDK and make a standalone toolchain</a>
+## Download the Android NDK and make a standalone toolchain
* Download the Android NDK from [the official website](https://developer.android.com/ndk/downloads/index.html):
-
- ```bash
- mkdir -p ~/armnn-devenv/toolchains
- cd ~/armnn-devenv/toolchains
- # For Mac OS, change the NDK download link accordingly.
- wget https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip
- unzip android-ndk-r20b-linux-x86_64.zip
- export NDK=~/armnn-devenv/android-ndk-r20b
- export NDK_TOOLCHAIN_ROOT=$NDK/toolchains/llvm/prebuilt/linux-x86_64
- export PATH=$NDK_TOOLCHAIN_ROOT/bin/:$PATH
- ```
-
- You may want to append the above export variables commands to your `~/.bashrc` (or `~/.bash_profile` in Mac OS).
+ ```bash
+ mkdir -p ~/armnn-devenv/toolchains
+ cd ~/armnn-devenv/toolchains
+ # For Mac OS, change the NDK download link accordingly.
+ wget https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip
+ unzip android-ndk-r20b-linux-x86_64.zip
+ export NDK=~/armnn-devenv/android-ndk-r20b
+ export NDK_TOOLCHAIN_ROOT=$NDK/toolchains/llvm/prebuilt/linux-x86_64
+ export PATH=$NDK_TOOLCHAIN_ROOT/bin/:$PATH
+
+ # You may want to append the above export variables commands to your `~/.bashrc` (or `~/.bash_profile` in Mac OS).
+ ```
* With the android ndk-20b, you don't need to use the make_standalone_toolchain script to create a toolchain for a specific version of android. Android's current preference is for you to just specify the architecture and operating system while setting the compiler and just use the ndk directory.
-#### <a name="buildBoost">Build the Boost C++ libraries</a>
+## Build the Boost C++ libraries
* Download Boost version 1.64:
-
- ```bash
- mkdir ~/armnn-devenv/boost
- cd ~/armnn-devenv/boost
- wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2
- tar xvf boost_1_64_0.tar.bz2
- ```
+```bash
+mkdir ~/armnn-devenv/boost
+cd ~/armnn-devenv/boost
+wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2
+tar xvf boost_1_64_0.tar.bz2
+```
* Build:
(Requires clang if not previously installed: `sudo apt-get install clang`)
- ```bash
- echo "using clang : arm : aarch64-linux-android<Android_API>-clang++ ;" > $HOME/armnn-devenv/boost/user-config.jam
- cd ~/armnn-devenv/boost/boost_1_64_0
- ./bootstrap.sh --prefix=$HOME/armnn-devenv/boost/install
- ./b2 install --user-config=$HOME/armnn-devenv/boost/user-config.jam \
- toolset=clang-arm link=static cxxflags=-fPIC \
- --with-test --with-log --with-program_options -j16
- ```
- Note: You can specify the 'Android_API' version you want. For example, if your ANDROID_API is 27 then the compiler will be aarch64-linux-android27-clang++.
-
-#### <a name="buildCL">Build the Compute Library</a>
+
+ Note: You can specify the 'Android_API' version you want. For example, if your ANDROID_API is 27 then the compiler will be aarch64-linux-android27-clang++.
+```bash
+echo "using clang : arm : aarch64-linux-android<Android_API>-clang++ ;" > $HOME/armnn-devenv/boost/user-config.jam
+cd ~/armnn-devenv/boost/boost_1_64_0
+./bootstrap.sh --prefix=$HOME/armnn-devenv/boost/install
+./b2 install --user-config=$HOME/armnn-devenv/boost/user-config.jam \
+ toolset=clang-arm link=static cxxflags=-fPIC \
+ --with-test --with-log --with-program_options -j16
+```
+
+## Build the Compute Library
* Clone the Compute Library:
(Requires Git if not previously installed: `sudo apt install git`)
-
- ``` bash
- cd ~/armnn-devenv
- git clone https://github.com/ARM-software/ComputeLibrary.git
- ```
+``` bash
+cd ~/armnn-devenv
+git clone https://github.com/ARM-software/ComputeLibrary.git
+```
* Checkout ComputeLibrary branch:
- ```bash
- cd ComputeLibrary
- git checkout <branch_name>
- git pull
- ```
- For example, if you want to checkout release branch of 20.02:
- ```bash
- git checkout branches/arm_compute_20_02
- git pull
- ```
+```bash
+cd ComputeLibrary
+git checkout <branch_name>
+git pull
+```
+For example, if you want to checkout release branch of 20.02:
+```bash
+git checkout branches/arm_compute_20_02
+git pull
+```
* Build:
(Requires SCons if not previously installed: `sudo apt install scons`)
- ```bash
- scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" \
- benchmark_tests=0 validation_tests=0 os=android -j16
- ```
+```bash
+scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" \
+ benchmark_tests=0 validation_tests=0 os=android -j16
+```
-#### <a name="buildProtobuf">Build Google's Protobuf library</a>
+## Build Google's Protobuf library
* Clone protobuf:
- ```bash
- mkdir ~/armnn-devenv/google
- cd ~/armnn-devenv/google
- git clone https://github.com/google/protobuf.git
- cd protobuf
- git checkout -b v3.12.0 v3.12.0
- ```
+```bash
+mkdir ~/armnn-devenv/google
+cd ~/armnn-devenv/google
+git clone https://github.com/google/protobuf.git
+cd protobuf
+git checkout -b v3.12.0 v3.12.0
+```
* Build a native (x86) version of the protobuf libraries and compiler (protoc):
(Requires cUrl, autoconf, llibtool, and other build dependencies if not previously installed: `sudo apt install curl autoconf libtool build-essential g++`)
-
- ```bash
- ./autogen.sh
- mkdir x86_build
- cd x86_build
- ../configure --prefix=$HOME/armnn-devenv/google/x86_pb_install
- make install -j16
- cd ..
- ```
+```bash
+./autogen.sh
+mkdir x86_build
+cd x86_build
+../configure --prefix=$HOME/armnn-devenv/google/x86_pb_install
+make install -j16
+cd ..
+```
* Build the arm64 version of the protobuf libraries:
-
- ```bash
- mkdir arm64_build
- cd arm64_build
- CC=aarch64-linux-android<Android_API>-clang \
- CXX=aarch64-linux-android<Android_API>-clang++ \
- CFLAGS="-fPIE -fPIC" \
- LDFLAGS="-llog -lz -lc++_static" \
- ../configure --host=aarch64-linux-android \
- --prefix=$HOME/armnn-devenv/google/arm64_pb_install \
- --enable-cross-compile \
- --with-protoc=$HOME/armnn-devenv/google/x86_pb_install/bin/protoc
- make install -j16
- cd ..
- ```
-
-#### <a name="downloadTF">Download TensorFlow</a>
+```bash
+mkdir arm64_build
+cd arm64_build
+CC=aarch64-linux-android<Android_API>-clang \
+CXX=aarch64-linux-android<Android_API>-clang++ \
+CFLAGS="-fPIE -fPIC" \
+ LDFLAGS="-llog -lz -lc++_static" \
+ ../configure --host=aarch64-linux-android \
+ --prefix=$HOME/armnn-devenv/google/arm64_pb_install \
+ --enable-cross-compile \
+ --with-protoc=$HOME/armnn-devenv/google/x86_pb_install/bin/protoc
+make install -j16
+cd ..
+```
+
+## Download TensorFlow
* Clone TensorFlow source code:
+```bash
+cd ~/armnn-devenv/google/
+git clone https://github.com/tensorflow/tensorflow.git
+ cd tensorflow/
+ git checkout fcc4b966f1265f466e82617020af93670141b009
+```
- ```bash
- cd ~/armnn-devenv/google/
- git clone https://github.com/tensorflow/tensorflow.git
- cd tensorflow/
- git checkout fcc4b966f1265f466e82617020af93670141b009
- ```
-
-#### <a name="buildArmNN">Build ArmNN</a>
+## Build ArmNN
* Clone ArmNN source code:
-
- ```bash
- cd ~/armnn-devenv/
- git clone https://github.com/ARM-software/armnn.git
- ```
+```bash
+cd ~/armnn-devenv/
+git clone https://github.com/ARM-software/armnn.git
+```
* Checkout ArmNN branch:
-
- ```bash
- cd armnn
- git checkout <branch_name>
- git pull
- ```
-
- For example, if you want to checkout release branch of 20.02:
- ```bash
- git checkout branches/armnn_20_02
- git pull
- ```
+```bash
+cd armnn
+git checkout <branch_name>
+git pull
+```
+
+For example, if you want to checkout release branch of 20.02:
+```bash
+git checkout branches/armnn_20_02
+git pull
+```
* Generate TensorFlow protobuf definitions:
+```bash
+cd ~/armnn-devenv/google/tensorflow
+~/armnn-devenv/armnn/scripts/generate_tensorflow_protobuf.sh \
+ $HOME/armnn-devenv/google/tf_pb $HOME/armnn-devenv/google/x86_pb_install
+```
- ```bash
- cd ~/armnn-devenv/google/tensorflow
- ~/armnn-devenv/armnn/scripts/generate_tensorflow_protobuf.sh \
- $HOME/armnn-devenv/google/tf_pb $HOME/armnn-devenv/google/x86_pb_install
- ```
-
- * Build ArmNN:
+* Build ArmNN:
(Requires CMake if not previously installed: `sudo apt install cmake`)
-
- ```bash
- mkdir ~/armnn-devenv/armnn/build
- cd ~/armnn-devenv/armnn/build
- CXX=aarch64-linux-android<Android_API>-clang++ \
- CC=aarch64-linux-android<Android_API>-clang \
- CXX_FLAGS="-fPIE -fPIC" \
- cmake .. \
- -DCMAKE_ANDROID_NDK=$NDK \
- -DCMAKE_SYSTEM_NAME=Android \
- -DCMAKE_SYSTEM_VERSION=<Android_API> \
- -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
- -DCMAKE_EXE_LINKER_FLAGS="-pie -llog -lz" \
- -DARMCOMPUTE_ROOT=$HOME/armnn-devenv/ComputeLibrary/ \
- -DARMCOMPUTE_BUILD_DIR=$HOME/armnn-devenv/ComputeLibrary/build \
- -DBOOST_ROOT=$HOME/armnn-devenv/boost/install/ \
- -DARMCOMPUTENEON=1 -DARMCOMPUTECL=1 -DARMNNREF=1 \
- -DTF_GENERATED_SOURCES=$HOME/armnn-devenv/google/tf_pb/ -DBUILD_TF_PARSER=1 \
- -DPROTOBUF_ROOT=$HOME/armnn-devenv/google/arm64_pb_install/
- ```
-
- To include standalone sample dynamic backend tests, add the argument to enable the tests and the dynamic backend path to the CMake command:
-
- ```bash
- -DSAMPLE_DYNAMIC_BACKEND=1 \
- -DDYNAMIC_BACKEND_PATHS=$SAMPLE_DYNAMIC_BACKEND_PATH
- ```
- Where $SAMPLE_DYNAMIC_BACKEND_PATH is the path where libArm_SampleDynamic_backend.so library file is pushed
+```bash
+mkdir ~/armnn-devenv/armnn/build
+cd ~/armnn-devenv/armnn/build
+CXX=aarch64-linux-android<Android_API>-clang++ \
+CC=aarch64-linux-android<Android_API>-clang \
+CXX_FLAGS="-fPIE -fPIC" \
+cmake .. \
+ -DCMAKE_ANDROID_NDK=$NDK \
+ -DCMAKE_SYSTEM_NAME=Android \
+ -DCMAKE_SYSTEM_VERSION=<Android_API> \
+ -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
+ -DCMAKE_EXE_LINKER_FLAGS="-pie -llog -lz" \
+ -DARMCOMPUTE_ROOT=$HOME/armnn-devenv/ComputeLibrary/ \
+ -DARMCOMPUTE_BUILD_DIR=$HOME/armnn-devenv/ComputeLibrary/build \
+ -DBOOST_ROOT=$HOME/armnn-devenv/boost/install/ \
+ -DARMCOMPUTENEON=1 -DARMCOMPUTECL=1 -DARMNNREF=1 \
+ -DTF_GENERATED_SOURCES=$HOME/armnn-devenv/google/tf_pb/ -DBUILD_TF_PARSER=1 \
+ -DPROTOBUF_ROOT=$HOME/armnn-devenv/google/arm64_pb_install/
+```
+
+To include standalone sample dynamic backend tests, add the argument to enable the tests and the dynamic backend path to the CMake command:
+
+```bash
+-DSAMPLE_DYNAMIC_BACKEND=1 \
+-DDYNAMIC_BACKEND_PATHS=$SAMPLE_DYNAMIC_BACKEND_PATH
+# Where $SAMPLE_DYNAMIC_BACKEND_PATH is the path where libArm_SampleDynamic_backend.so library file is pushed
+```
* Run the build
- ```bash
- make -j16
- ```
+```bash
+make -j16
+```
-#### <a name="buildStandaloneBackend">Build Standalone Sample Dynamic Backend</a>
+## Build Standalone Sample Dynamic Backend
* The sample dynamic backend is located in armnn/src/dynamic/sample
- ```bash
- mkdir build
- cd build
- ```
+```bash
+mkdir build
+cd build
+```
* Use CMake to configure the build environment, update the following script and run it from the armnn/src/dynamic/sample/build directory to set up the armNN build:
- ```bash
- #!/bin/bash
- CXX=aarch64-linux-android<Android_API>-clang++ \
- CC=aarch64-linux-android<Android_API>-clang \
- CXX_FLAGS="-fPIE -fPIC" \
- cmake \
- -DCMAKE_SYSTEM_NAME=Android \
- -DCMAKE_CXX_FLAGS=--std=c++14 \
- -DCMAKE_EXE_LINKER_FLAGS="-pie -llog" \
- -DCMAKE_MODULE_LINKER_FLAGS="-llog" \
- -DBOOST_ROOT=$HOME/armnn-devenv/boost/install \
- -DBoost_SYSTEM_LIBRARY=$HOME/armnn-devenv/boost/install/lib/libboost_system.a \
- -DARMNN_PATH=$HOME/armnn-devenv/armnn/build/libarmnn.so ..
- ```
+```bash
+#!/bin/bash
+CXX=aarch64-linux-android<Android_API>-clang++ \
+CC=aarch64-linux-android<Android_API>-clang \
+CXX_FLAGS="-fPIE -fPIC" \
+cmake \
+-DCMAKE_SYSTEM_NAME=Android \
+-DCMAKE_CXX_FLAGS=--std=c++14 \
+-DCMAKE_EXE_LINKER_FLAGS="-pie -llog" \
+-DCMAKE_MODULE_LINKER_FLAGS="-llog" \
+-DBOOST_ROOT=$HOME/armnn-devenv/boost/install \
+-DBoost_SYSTEM_LIBRARY=$HOME/armnn-devenv/boost/install/lib/libboost_system.a \
+-DARMNN_PATH=$HOME/armnn-devenv/armnn/build/libarmnn.so ..
+```
* Run the build
- ```bash
- make
- ```
+```bash
+make
+```
-#### <a name="runArmNNUnitTests">Run the ArmNN unit tests on an Android device</a>
+## Run the ArmNN unit tests on an Android device
* Push the build results to an Android device and make symbolic links for shared libraries:
Currently adb version we have used for testing is 1.0.41.
-
- ```bash
- adb push libarmnnTfParser.so /data/local/tmp/
- adb push libarmnn.so /data/local/tmp/
- adb push libtimelineDecoder.so /data/local/tmp/
- adb push UnitTests /data/local/tmp/
- adb push $NDK/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so /data/local/tmp/
- adb push $HOME/armnn-devenv/google/arm64_pb_install/lib/libprotobuf.so /data/local/tmp/libprotobuf.so.23.0.0
- adb shell 'ln -s libprotobuf.so.23.0.0 /data/local/tmp/libprotobuf.so.23'
- adb shell 'ln -s libprotobuf.so.23.0.0 /data/local/tmp/libprotobuf.so'
- ```
+```bash
+adb push libarmnnTfParser.so /data/local/tmp/
+adb push libarmnn.so /data/local/tmp/
+ adb push libtimelineDecoder.so /data/local/tmp/
+adb push UnitTests /data/local/tmp/
+adb push $NDK/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so /data/local/tmp/
+adb push $HOME/armnn-devenv/google/arm64_pb_install/lib/libprotobuf.so /data/local/tmp/libprotobuf.so.23.0.0
+adb shell 'ln -s libprotobuf.so.23.0.0 /data/local/tmp/libprotobuf.so.23'
+adb shell 'ln -s libprotobuf.so.23.0.0 /data/local/tmp/libprotobuf.so'
+```
* Push the files needed for the unit tests (they are a mix of files, directories and symbolic links):
+```bash
+adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/testSharedObject
+adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/testSharedObject/* /data/local/tmp/src/backends/backendsCommon/test/testSharedObject/
- ```bash
- adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/testSharedObject
- adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/testSharedObject/* /data/local/tmp/src/backends/backendsCommon/test/testSharedObject/
-
- adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/testDynamicBackend
- adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/testDynamicBackend/* /data/local/tmp/src/backends/backendsCommon/test/testDynamicBackend/
+adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/testDynamicBackend
+adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/testDynamicBackend/* /data/local/tmp/src/backends/backendsCommon/test/testDynamicBackend/
- adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath1
- adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath1/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath1/
+adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath1
+adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath1/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath1/
- adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2
- adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath2/Arm_CpuAcc_backend.so /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/
- adb shell ln -s Arm_CpuAcc_backend.so /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/Arm_CpuAcc_backend.so.1
- adb shell ln -s Arm_CpuAcc_backend.so.1 /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/Arm_CpuAcc_backend.so.1.2
- adb shell ln -s Arm_CpuAcc_backend.so.1.2 /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/Arm_CpuAcc_backend.so.1.2.3
- adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath2/Arm_GpuAcc_backend.so /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/
- adb shell ln -s nothing /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/Arm_no_backend.so
+adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2
+adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath2/Arm_CpuAcc_backend.so /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/
+adb shell ln -s Arm_CpuAcc_backend.so /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/Arm_CpuAcc_backend.so.1
+adb shell ln -s Arm_CpuAcc_backend.so.1 /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/Arm_CpuAcc_backend.so.1.2
+adb shell ln -s Arm_CpuAcc_backend.so.1.2 /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/Arm_CpuAcc_backend.so.1.2.3
+adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath2/Arm_GpuAcc_backend.so /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/
+adb shell ln -s nothing /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/Arm_no_backend.so
- adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath3
+adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath3
- adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath5
- adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath5/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath5/
+adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath5
+adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath5/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath5/
- adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath6
- adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath6/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath6/
+adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath6
+adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath6/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath6/
- adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath7
+adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath7
- adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath9
- adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath9/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath9/
+adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath9
+adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath9/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath9/
- adb shell mkdir -p /data/local/tmp/src/backends/dynamic/reference
- adb push -p ~/armnn-devenv/armnn/build/src/backends/dynamic/reference/Arm_CpuRef_backend.so /data/local/tmp/src/backends/dynamic/reference/
- ```
+adb shell mkdir -p /data/local/tmp/src/backends/dynamic/reference
+adb push -p ~/armnn-devenv/armnn/build/src/backends/dynamic/reference/Arm_CpuRef_backend.so /data/local/tmp/src/backends/dynamic/reference/
- If the standalone sample dynamic tests are enabled, also push libArm_SampleDynamic_backend.so library file to the folder specified as $SAMPLE_DYNAMIC_BACKEND_PATH when ArmNN is built.
- This is the example when $SAMPLE_DYNAMIC_BACKEND_PATH is specified as /data/local/tmp/dynamic/sample/:
+# If the standalone sample dynamic tests are enabled, also push libArm_SampleDynamic_backend.so library file to the folder specified as $SAMPLE_DYNAMIC_BACKEND_PATH when ArmNN is built.
+# This is the example when $SAMPLE_DYNAMIC_BACKEND_PATH is specified as /data/local/tmp/dynamic/sample/:
- ```bash
- adb shell mkdir -p /data/local/tmp/dynamic/sample/
- adb push -p ${WORKING_DIR}/armnn/src/dynamic/sample/build/libArm_SampleDynamic_backend.so /data/local/tmp/dynamic/sample/
- ```
+adb shell mkdir -p /data/local/tmp/dynamic/sample/
+adb push -p ${WORKING_DIR}/armnn/src/dynamic/sample/build/libArm_SampleDynamic_backend.so /data/local/tmp/dynamic/sample/
+```
* Run ArmNN unit tests:
-
- ```bash
- adb shell 'LD_LIBRARY_PATH=/data/local/tmp:/vendor/lib64:/vendor/lib64/egl /data/local/tmp/UnitTests'
- ```
-
- If libarmnnUtils.a is present in `~/armnn-devenv/armnn/build/` and the unit tests run without failure then the build was successful.
+```bash
+adb shell 'LD_LIBRARY_PATH=/data/local/tmp:/vendor/lib64:/vendor/lib64/egl /data/local/tmp/UnitTests'
+```
+If libarmnnUtils.a is present in `~/armnn-devenv/armnn/build/` and the unit tests run without failure then the build was successful.
diff --git a/BuildGuideCrossCompilation.md b/BuildGuideCrossCompilation.md
index 2b94ff6c4a..8a926c943c 100644
--- a/BuildGuideCrossCompilation.md
+++ b/BuildGuideCrossCompilation.md
@@ -1,383 +1,398 @@
# How to Cross-Compile ArmNN on x86_64 for arm64
-* [Introduction](#introduction)
-* [Cross-compiling ToolChain](#installCCT)
-* [Build and install Google's Protobuf library](#buildProtobuf)
-* [Build Caffe for x86_64](#buildCaffe)
-* [Build Boost library for arm64](#installBaarch)
-* [Build Compute Library](#buildCL)
-* [Build ArmNN](#buildANN)
-* [Run Unit Tests](#unittests)
-* [Troubleshooting and Errors](#troubleshooting)
-
-
-#### <a name="introduction">Introduction</a>
+- [Introduction](#introduction)
+- [Cross-compiling ToolChain](#cross-compiling-toolchain)
+- [Build and install Google's Protobuf library](#build-and-install-google-s-protobuf-library)
+- [Build Caffe for x86_64](#build-caffe-for-x86-64)
+- [Build Boost library for arm64](#build-boost-library-for-arm64)
+- [Build Compute Library](#build-compute-library)
+- [Build Tensorflow](#build-tensorflow)
+- [Build Flatbuffer](#build-flatbuffer)
+- [Build Onnx](#build-onnx)
+- [Build TfLite](#build-tflite)
+- [Build ArmNN](#build-armnn)
+- [Build Standalone Sample Dynamic Backend](#build-standalone-sample-dynamic-backend)
+- [Run Unit Tests](#run-unit-tests)
+- [Troubleshooting and Errors:](#troubleshooting-and-errors-)
+
+
+## Introduction
These are the step by step instructions on Cross-Compiling ArmNN under an x86_64 system to target an Arm64 system. This build flow has been tested with Ubuntu 16.04.
The instructions show how to build the ArmNN core library and the Boost, Protobuf, Caffe, Tensorflow, Tflite, Flatbuffer and Compute Libraries necessary for compilation.
-#### <a name="installCCT">Cross-compiling ToolChain</a>
+## Cross-compiling ToolChain
* Install the standard cross-compilation libraries for arm64:
- ```
- sudo apt install crossbuild-essential-arm64
- ```
+```
+sudo apt install crossbuild-essential-arm64
+```
-#### <a name="buildProtobuf">Build and install Google's Protobuf library</a>
+## Build and install Google's Protobuf library
-## We support protobuf version 3.12.0
+We support protobuf version 3.12.0
* Get protobuf from here: https://github.com/protocolbuffers/protobuf :
- ```bash
- git clone -b v3.12.0 https://github.com/google/protobuf.git protobuf
- cd protobuf
- git submodule update --init --recursive
- ./autogen
- ```
+```bash
+git clone -b v3.12.0 https://github.com/google/protobuf.git protobuf
+cd protobuf
+git submodule update --init --recursive
+./autogen
+```
* Build a native (x86_64) version of the protobuf libraries and compiler (protoc):
(Requires cUrl, autoconf, llibtool, and other build dependencies if not previously installed: sudo apt install curl autoconf libtool build-essential g++)
- ```
- mkdir x86_64_build
- cd x86_64_build
- ../configure --prefix=$HOME/armnn-devenv/google/x86_64_pb_install
- make install -j16
- cd ..
- ```
+```
+mkdir x86_64_build
+cd x86_64_build
+../configure --prefix=$HOME/armnn-devenv/google/x86_64_pb_install
+make install -j16
+cd ..
+```
* Build the arm64 version of the protobuf libraries:
- ```
- mkdir arm64_build
- cd arm64_build
- export CC=aarch64-linux-gnu-gcc \
- export CXX=aarch64-linux-gnu-g++ \
- ../configure --host=aarch64-linux \
- --prefix=$HOME/armnn-devenv/google/arm64_pb_install \
- --with-protoc=$HOME/armnn-devenv/google/x86_64_pb_install/bin/protoc
- make install -j16
- cd ..
- ```
-
-#### <a name="buildCaffe">Build Caffe for x86_64</a>
+```
+mkdir arm64_build
+cd arm64_build
+export CC=aarch64-linux-gnu-gcc \
+export CXX=aarch64-linux-gnu-g++ \
+../configure --host=aarch64-linux \
+--prefix=$HOME/armnn-devenv/google/arm64_pb_install \
+--with-protoc=$HOME/armnn-devenv/google/x86_64_pb_install/bin/protoc
+make install -j16
+cd ..
+```
+
+## Build Caffe for x86_64
* Ubuntu 16.04 installation. These steps are taken from the full Caffe installation documentation at: http://caffe.berkeleyvision.org/install_apt.html
* Install dependencies:
- ```bash
- sudo apt-get install libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev
- sudo apt-get install --no-install-recommends libboost-all-dev
- sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
- sudo apt-get install libopenblas-dev
- sudo apt-get install libatlas-base-dev
- ```
+```bash
+sudo apt-get install libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev
+sudo apt-get install --no-install-recommends libboost-all-dev
+sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
+sudo apt-get install libopenblas-dev
+sudo apt-get install libatlas-base-dev
+```
* Download Caffe from: https://github.com/BVLC/caffe. We have tested using tag 1.0
- ```bash
- git clone https://github.com/BVLC/caffe.git
- cd caffe
- git checkout eeebdab16155d34ff8f5f42137da7df4d1c7eab0
- cp Makefile.config.example Makefile.config
- ```
+```bash
+git clone https://github.com/BVLC/caffe.git
+cd caffe
+git checkout eeebdab16155d34ff8f5f42137da7df4d1c7eab0
+cp Makefile.config.example Makefile.config
+```
* Adjust Makefile.config as necessary for your environment, for example:
- ```
- #CPU only version:
- CPU_ONLY := 1
-
- #Add hdf5 and protobuf include and library directories (Replace $HOME with explicit /home/username dir):
- INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/ $HOME/armnn-devenv/google/x86_64_pb_install/include/
- LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial/ $HOME/armnn-devenv/google/x86_64_pb_install/lib/
- ```
+```
+#CPU only version:
+CPU_ONLY := 1
+
+#Add hdf5 and protobuf include and library directories (Replace $HOME with explicit /home/username dir):
+INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/ $HOME/armnn-devenv/google/x86_64_pb_install/include/
+LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial/ $HOME/armnn-devenv/google/x86_64_pb_install/lib/
+```
* Setup environment:
- ```bash
- export PATH=$HOME/armnn-devenv/google/x86_64_pb_install/bin/:$PATH
- export LD_LIBRARY_PATH=$HOME/armnn-devenv/google/x86_64_pb_install/lib/:$LD_LIBRARY_PATH
- ```
+```bash
+export PATH=$HOME/armnn-devenv/google/x86_64_pb_install/bin/:$PATH
+export LD_LIBRARY_PATH=$HOME/armnn-devenv/google/x86_64_pb_install/lib/:$LD_LIBRARY_PATH
+```
* Compilation with Make:
- ```bash
- make all
- make test
- make runtest
- ```
- These should all run without errors
+```bash
+make all
+make test
+make runtest
+# These should all run without errors
+```
+
* caffe.pb.h and caffe.pb.cc will be needed when building ArmNN's Caffe Parser
-#### <a name="installBaarch">Build Boost library for arm64</a>
+## Build Boost library for arm64
* Build Boost library for arm64
Download Boost version 1.64 from http://www.boost.org/doc/libs/1_64_0/more/getting_started/unix-variants.html
Using any version of Boost greater than 1.64 will fail to build ArmNN, due to different dependency issues.
- ```bash
- tar -zxvf boost_1_64_0.tar.gz
- cd boost_1_64_0
- echo "using gcc : arm : aarch64-linux-gnu-g++ ;" > user_config.jam
- ./bootstrap.sh --prefix=$HOME/armnn-devenv/boost_arm64_install
- ./b2 install toolset=gcc-arm link=static cxxflags=-fPIC --with-test --with-log --with-program_options -j32 --user-config=user_config.jam
- ```
-
-#### <a name="buildCL">Build Compute Library</a>
+```bash
+tar -zxvf boost_1_64_0.tar.gz
+cd boost_1_64_0
+echo "using gcc : arm : aarch64-linux-gnu-g++ ;" > user_config.jam
+./bootstrap.sh --prefix=$HOME/armnn-devenv/boost_arm64_install
+./b2 install toolset=gcc-arm link=static cxxflags=-fPIC --with-test --with-log --with-program_options -j32 --user-config=user_config.jam
+```
+
+## Build Compute Library
* Building the Arm Compute Library:
- ```bash
- git clone https://github.com/ARM-software/ComputeLibrary.git
- cd ComputeLibrary/
- git checkout <branch_name>
- git pull
- scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" -j8 internal_only=0
- ```
-
- For example, if you want to checkout release branch of 20.02:
- ```bash
- git checkout branches/arm_compute_20_02
- git pull
- ```
-
-#### <a name="buildtf">Build Tensorflow</a>
+```bash
+git clone https://github.com/ARM-software/ComputeLibrary.git
+cd ComputeLibrary/
+git checkout <branch_name>
+git pull
+scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" -j8 internal_only=0
+```
+
+For example, if you want to checkout release branch of 20.02:
+```bash
+git checkout branches/arm_compute_20_02
+git pull
+```
+
+## Build Tensorflow
* Building Tensorflow version 2.3.1:
- ```bash
- git clone https://github.com/tensorflow/tensorflow.git
- cd tensorflow/
- git checkout fcc4b966f1265f466e82617020af93670141b009
- ../armnn/scripts/generate_tensorflow_protobuf.sh ../tensorflow-protobuf ../google/x86_64_pb_install
- ```
-
-#### <a name="buildflatbuffer">Build Flatbuffer</a>
+```bash
+git clone https://github.com/tensorflow/tensorflow.git
+cd tensorflow/
+git checkout fcc4b966f1265f466e82617020af93670141b009
+../armnn/scripts/generate_tensorflow_protobuf.sh ../tensorflow-protobuf ../google/x86_64_pb_install
+```
+
+## Build Flatbuffer
* Building Flatbuffer version 1.12.0
- ```bash
- wget -O flatbuffers-1.12.0.tar.gz https://github.com/google/flatbuffers/archive/v1.12.0.tar.gz
- tar xf flatbuffers-1.12.0.tar.gz
- cd flatbuffers-1.12.0
- rm -f CMakeCache.txt
- mkdir build
- cd build
- cmake .. -DFLATBUFFERS_BUILD_FLATC=1 \
- -DCMAKE_INSTALL_PREFIX:PATH=$<DIRECTORY_PATH> \
- -DFLATBUFFERS_BUILD_TESTS=0
- make all install
- ```
+```bash
+wget -O flatbuffers-1.12.0.tar.gz https://github.com/google/flatbuffers/archive/v1.12.0.tar.gz
+tar xf flatbuffers-1.12.0.tar.gz
+cd flatbuffers-1.12.0
+rm -f CMakeCache.txt
+mkdir build
+cd build
+cmake .. -DFLATBUFFERS_BUILD_FLATC=1 \
+ -DCMAKE_INSTALL_PREFIX:PATH=$<DIRECTORY_PATH> \
+ -DFLATBUFFERS_BUILD_TESTS=0
+make all install
+```
* Build arm64 version of flatbuffer
- ```bash
- mkdir build-arm64
- cd build-arm64
- # Add -fPIC to allow us to use the libraries in shared objects.
- CXXFLAGS="-fPIC" cmake .. -DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc \
- -DCMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++ \
- -DFLATBUFFERS_BUILD_FLATC=1 \
- -DCMAKE_INSTALL_PREFIX:PATH=$<DIRECTORY_PATH> \
- -DFLATBUFFERS_BUILD_TESTS=0
- make all install
- ```
-
-#### <a name="buildingONNX">Build Onnx</a>
+```bash
+mkdir build-arm64
+cd build-arm64
+# Add -fPIC to allow us to use the libraries in shared objects.
+CXXFLAGS="-fPIC" cmake .. -DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc \
+ -DCMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++ \
+ -DFLATBUFFERS_BUILD_FLATC=1 \
+ -DCMAKE_INSTALL_PREFIX:PATH=$<DIRECTORY_PATH> \
+ -DFLATBUFFERS_BUILD_TESTS=0
+make all install
+```
+
+## Build Onnx
* Building Onnx
- ```bash
- git clone https://github.com/onnx/onnx.git
- cd onnx
- git fetch https://github.com/onnx/onnx.git 553df22c67bee5f0fe6599cff60f1afc6748c635 && git checkout FETCH_HEAD
- export LD_LIBRARY_PATH=$<DIRECTORY_PATH>/protobuf-host/lib:$LD_LIBRARY_PATH
- ../google/x86_64_pb_install/bin/protoc onnx/onnx.proto --proto_path=. --proto_path=../google/x86_64_pb_install/include --cpp_out ../onnx
- ```
-
-#### <a name="buildingtflite">Build TfLite</a>
+```bash
+git clone https://github.com/onnx/onnx.git
+cd onnx
+git fetch https://github.com/onnx/onnx.git 553df22c67bee5f0fe6599cff60f1afc6748c635 && git checkout FETCH_HEAD
+export LD_LIBRARY_PATH=$<DIRECTORY_PATH>/protobuf-host/lib:$LD_LIBRARY_PATH
+../google/x86_64_pb_install/bin/protoc onnx/onnx.proto --proto_path=. --proto_path=../google/x86_64_pb_install/include --cpp_out ../onnx
+```
+
+## Build TfLite
* Building TfLite
- ```bash
- mkdir tflite
- cd tflite
- cp ../tensorflow/tensorflow/lite/schema/schema.fbs .
- ../flatbuffers-1.12.0/build/flatc -c --gen-object-api --reflect-types --reflect-names schema.fbs
- ```
-
-#### <a name="buildANN">Build ArmNN</a>
+```bash
+mkdir tflite
+cd tflite
+cp ../tensorflow/tensorflow/lite/schema/schema.fbs .
+../flatbuffers-1.12.0/build/flatc -c --gen-object-api --reflect-types --reflect-names schema.fbs
+```
+
+## Build ArmNN
* Compile ArmNN for arm64:
- ```bash
- git clone https://github.com/ARM-software/armnn.git
- cd armnn
- git checkout <branch_name>
- git pull
- mkdir build
- cd build
- ```
-
- For example, if you want to checkout release branch of 20.02:
- ```bash
- git checkout branches/armnn_20_02
- git pull
- ```
+```bash
+git clone https://github.com/ARM-software/armnn.git
+cd armnn
+git checkout <branch_name>
+git pull
+mkdir build
+cd build
+```
+
+For example, if you want to checkout release branch of 20.02:
+```bash
+git checkout branches/armnn_20_02
+git pull
+```
* Use CMake to configure your build environment, update the following script and run it from the armnn/build directory to set up the armNN build:
- ```bash
- #!/bin/bash
- export CXX=aarch64-linux-gnu-g++ \
- export CC=aarch64-linux-gnu-gcc \
- cmake .. \
- -DARMCOMPUTE_ROOT=$HOME/armnn-devenv/ComputeLibrary \
- -DARMCOMPUTE_BUILD_DIR=$HOME/armnn-devenv/ComputeLibrary/build/ \
- -DBOOST_ROOT=$HOME/armnn-devenv/boost_arm64_install/ \
- -DARMCOMPUTENEON=1 -DARMCOMPUTECL=1 -DARMNNREF=1 \
- -DCAFFE_GENERATED_SOURCES=$HOME/armnn-devenv/caffe/build/src \
- -DBUILD_CAFFE_PARSER=1 \
- -DONNX_GENERATED_SOURCES=$HOME/onnx \
- -DBUILD_ONNX_PARSER=1 \
- -DTF_GENERATED_SOURCES=$HOME/tensorflow-protobuf \
- -DBUILD_TF_PARSER=1 \
- -DBUILD_TF_LITE_PARSER=1 \
- -DTF_LITE_GENERATED_PATH=$HOME/tflite \
- -DFLATBUFFERS_ROOT=$HOME/flatbuffers-arm64 \
- -DFLATC_DIR=$HOME/flatbuffers-1.12.0/build \
- -DPROTOBUF_ROOT=$HOME/google/x86_64_pb_install \
- -DPROTOBUF_ROOT=$HOME/armnn-devenv/google/x86_64_pb_install/ \
- -DPROTOBUF_LIBRARY_DEBUG=$HOME/armnn-devenv/google/arm64_pb_install/lib/libprotobuf.so.23.0.0 \
- -DPROTOBUF_LIBRARY_RELEASE=$HOME/armnn-devenv/google/arm64_pb_install/lib/libprotobuf.so.23.0.0
- ```
+```bash
+#!/bin/bash
+export CXX=aarch64-linux-gnu-g++ \
+export CC=aarch64-linux-gnu-gcc \
+cmake .. \
+-DARMCOMPUTE_ROOT=$HOME/armnn-devenv/ComputeLibrary \
+-DARMCOMPUTE_BUILD_DIR=$HOME/armnn-devenv/ComputeLibrary/build/ \
+-DBOOST_ROOT=$HOME/armnn-devenv/boost_arm64_install/ \
+-DARMCOMPUTENEON=1 -DARMCOMPUTECL=1 -DARMNNREF=1 \
+-DCAFFE_GENERATED_SOURCES=$HOME/armnn-devenv/caffe/build/src \
+-DBUILD_CAFFE_PARSER=1 \
+-DONNX_GENERATED_SOURCES=$HOME/onnx \
+-DBUILD_ONNX_PARSER=1 \
+-DTF_GENERATED_SOURCES=$HOME/tensorflow-protobuf \
+-DBUILD_TF_PARSER=1 \
+-DBUILD_TF_LITE_PARSER=1 \
+-DTF_LITE_GENERATED_PATH=$HOME/tflite \
+-DFLATBUFFERS_ROOT=$HOME/flatbuffers-arm64 \
+-DFLATC_DIR=$HOME/flatbuffers-1.12.0/build \
+-DPROTOBUF_ROOT=$HOME/google/x86_64_pb_install \
+-DPROTOBUF_ROOT=$HOME/armnn-devenv/google/x86_64_pb_install/ \
+-DPROTOBUF_LIBRARY_DEBUG=$HOME/armnn-devenv/google/arm64_pb_install/lib/libprotobuf.so.23.0.0 \
+-DPROTOBUF_LIBRARY_RELEASE=$HOME/armnn-devenv/google/arm64_pb_install/lib/libprotobuf.so.23.0.0
+```
* If you want to include standalone sample dynamic backend tests, add the argument to enable the tests and the dynamic backend path to the CMake command:
- ```bash
- -DSAMPLE_DYNAMIC_BACKEND=1 \
- -DDYNAMIC_BACKEND_PATHS=$SAMPLE_DYNAMIC_BACKEND_PATH
- ```
+```bash
+-DSAMPLE_DYNAMIC_BACKEND=1 \
+-DDYNAMIC_BACKEND_PATHS=$SAMPLE_DYNAMIC_BACKEND_PATH
+```
* Run the build
- ```bash
- make -j32
- ```
+```bash
+make -j32
+```
-#### <a name="buildStandaloneBackend">Build Standalone Sample Dynamic Backend</a>
+## Build Standalone Sample Dynamic Backend
* The sample dynamic backend is located in armnn/src/dynamic/sample
- ```bash
- mkdir build
- cd build
- ```
+```bash
+mkdir build
+cd build
+```
* Use CMake to configure your build environment, update the following script and run it from the armnn/src/dynamic/sample/build directory to set up the armNN build:
- ```bash
- #!/bin/bash
- export CXX=aarch64-linux-gnu-g++ \
- export CC=aarch64-linux-gnu-gcc \
- cmake .. \
- -DCMAKE_CXX_FLAGS=--std=c++14 \
- -DBOOST_ROOT=$HOME/armnn-devenv/boost_arm64_install/ \
- -DBoost_SYSTEM_LIBRARY=$HOME/armnn-devenv/boost_arm64_install/lib/libboost_system.a \
- -DARMNN_PATH=$HOME/armnn-devenv/armnn/build/libarmnn.so
- ```
+```bash
+#!/bin/bash
+export CXX=aarch64-linux-gnu-g++ \
+export CC=aarch64-linux-gnu-gcc \
+cmake .. \
+-DCMAKE_CXX_FLAGS=--std=c++14 \
+-DBOOST_ROOT=$HOME/armnn-devenv/boost_arm64_install/ \
+-DBoost_SYSTEM_LIBRARY=$HOME/armnn-devenv/boost_arm64_install/lib/libboost_system.a \
+-DARMNN_PATH=$HOME/armnn-devenv/armnn/build/libarmnn.so
+```
* Run the build
- ```bash
- make
- ```
+```bash
+make
+```
-#### <a name="unittests">Run Unit Tests</a>
+## Run Unit Tests
* Copy the build folder to an arm64 linux machine
* Copy the libprotobuf.so.15.0.1 library file to the build folder
* If you enable the standalone sample dynamic tests, also copy libArm_SampleDynamic_backend.so library file to the folder specified as $SAMPLE_DYNAMIC_BACKEND_PATH when you build ArmNN
* cd to the build folder on your arm64 machine and set your LD_LIBRARY_PATH to its current location:
- ```
- cd build/
- export LD_LIBRARY_PATH=`pwd`
- ```
+
+```bash
+cd build/
+export LD_LIBRARY_PATH=<current_working_directory>
+```
+
* Create a symbolic link to libprotobuf.so.23.0.0:
- ```
- ln -s libprotobuf.so.23.0.0 ./libprotobuf.so.23
- ```
+
+```bash
+ln -s libprotobuf.so.23.0.0 ./libprotobuf.so.23
+```
+
* Run the UnitTests:
- ```
- ./UnitTests
- Running 567 test cases...
-
- *** No errors detected
- ```
-#### <a name="troubleshooting">Troubleshooting and Errors:</a>
-#### Error adding symbols: File in wrong format
+
+```bash
+./UnitTests
+Running 567 test cases...
+
+*** No errors detected
+```
+
+## Troubleshooting and Errors:
+### Error adding symbols: File in wrong format
* When building armNN:
- ```
- /usr/local/lib/libboost_log.a: error adding symbols: File in wrong format
- collect2: error: ld returned 1 exit status
- CMakeFiles/armnn.dir/build.make:4028: recipe for target 'libarmnn.so' failed
- make[2]: *** [libarmnn.so] Error 1
- CMakeFiles/Makefile2:105: recipe for target 'CMakeFiles/armnn.dir/all' failed
- make[1]: *** [CMakeFiles/armnn.dir/all] Error 2
- Makefile:127: recipe for target 'all' failed
- make: *** [all] Error 2
- ```
+```bash
+/usr/local/lib/libboost_log.a: error adding symbols: File in wrong format
+collect2: error: ld returned 1 exit status
+CMakeFiles/armnn.dir/build.make:4028: recipe for target 'libarmnn.so' failed
+make[2]: *** [libarmnn.so] Error 1
+CMakeFiles/Makefile2:105: recipe for target 'CMakeFiles/armnn.dir/all' failed
+make[1]: *** [CMakeFiles/armnn.dir/all] Error 2
+Makefile:127: recipe for target 'all' failed
+make: *** [all] Error 2
+```
* Boost libraries are not compiled for the correct architecture, try recompiling for arm64
-##
-#### Virtual memory exhausted
+<br><br>
+
+### Virtual memory exhausted
* When compiling the boost libraries:
- ```bash
- virtual memory exhausted: Cannot allocate memory
- ```
+```bash
+virtual memory exhausted: Cannot allocate memory
+```
* Not enough memory available to compile. Increase the amount of RAM or swap space available.
+<br><br>
-##
-#### Unrecognized command line option '-m64'
+### Unrecognized command line option '-m64'
* When compiling the boost libraries:
- ```bash
- aarch64-linux-gnu-g++: error: unrecognized command line option ‘-m64’
- ```
+```bash
+aarch64-linux-gnu-g++: error: unrecognized command line option ‘-m64’
+```
* Clean the boost library directory before trying to build with a different architecture:
- ```bash
- sudo ./b2 clean
- ```
+```bash
+sudo ./b2 clean
+```
* It should show the following for arm64:
- ```bash
- - 32-bit : no
- - 64-bit : yes
- - arm : yes
- ```
-
-##
-#### Missing libz.so.1
+```bash
+- 32-bit : no
+- 64-bit : yes
+- arm : yes
+```
+<br><br>
+
+### Missing libz.so.1
* When compiling armNN:
- ```bash
- /usr/lib/gcc-cross/aarch64-linux-gnu/5/../../../../aarch64-linux-gnu/bin/ld: warning: libz.so.1, needed by /home/<username>/armNN/usr/lib64/libprotobuf.so.23.0.0, not found (try using -rpath or -rpath-link)
- ```
+```bash
+/usr/lib/gcc-cross/aarch64-linux-gnu/5/../../../../aarch64-linux-gnu/bin/ld: warning: libz.so.1, needed by /home/<username>/armNN/usr/lib64/libprotobuf.so.23.0.0, not found (try using -rpath or -rpath-link)
+```
* Missing arm64 libraries for libz.so.1, these can be added by adding a second architecture to dpkg and explicitly installing them:
- ```bash
- sudo dpkg --add-architecture arm64
- sudo apt-get install zlib1g:arm64
- sudo apt-get update
- sudo ldconfig
- ```
+```bash
+sudo dpkg --add-architecture arm64
+sudo apt-get install zlib1g:arm64
+sudo apt-get update
+sudo ldconfig
+```
* If apt-get update returns 404 errors for arm64 repos refer to section 5 below.
* Alternatively the missing arm64 version of libz.so.1 can be downloaded and installed from a .deb package here:
https://launchpad.net/ubuntu/wily/arm64/zlib1g/1:1.2.8.dfsg-2ubuntu4
- ```bash
- sudo dpkg -i zlib1g_1.2.8.dfsg-2ubuntu4_arm64.deb
- ```
-##
-#### Unable to install arm64 packages after adding arm64 architecture
+```bash
+sudo dpkg -i zlib1g_1.2.8.dfsg-2ubuntu4_arm64.deb
+```
+<br><br>
+
+### Unable to install arm64 packages after adding arm64 architecture
* Using sudo apt-get update should add all of the required repos for arm64 but if it does not or you are getting 404 errors the following instructions can be used to add the repos manually:
* From stackoverflow:
https://askubuntu.com/questions/430705/how-to-use-apt-get-to-download-multi-arch-library/430718
* Open /etc/apt/sources.list with your preferred text editor.
* Mark all the current (default) repos as \[arch=<current_os_arch>], e.g.
- ```bash
- deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ xenial main restricted
- ```
+```bash
+deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ xenial main restricted
+```
* Then add the following:
- ```bash
- deb [arch=arm64] http://ports.ubuntu.com/ xenial main restricted
- deb [arch=arm64] http://ports.ubuntu.com/ xenial-updates main restricted
- deb [arch=arm64] http://ports.ubuntu.com/ xenial universe
- deb [arch=arm64] http://ports.ubuntu.com/ xenial-updates universe
- deb [arch=arm64] http://ports.ubuntu.com/ xenial multiverse
- deb [arch=arm64] http://ports.ubuntu.com/ xenial-updates multiverse
- deb [arch=arm64] http://ports.ubuntu.com/ xenial-backports main restricted universe multiverse
- ```
+```bash
+deb [arch=arm64] http://ports.ubuntu.com/ xenial main restricted
+deb [arch=arm64] http://ports.ubuntu.com/ xenial-updates main restricted
+deb [arch=arm64] http://ports.ubuntu.com/ xenial universe
+deb [arch=arm64] http://ports.ubuntu.com/ xenial-updates universe
+deb [arch=arm64] http://ports.ubuntu.com/ xenial multiverse
+deb [arch=arm64] http://ports.ubuntu.com/ xenial-updates multiverse
+deb [arch=arm64] http://ports.ubuntu.com/ xenial-backports main restricted universe multiverse
+```
* Update and install again:
- ```bash
- sudo apt-get install zlib1g:arm64
- sudo apt-get update
- sudo ldconfig
- ```
-##
-#### Undefined references to google::protobuf:: functions
+```bash
+sudo apt-get install zlib1g:arm64
+sudo apt-get update
+sudo ldconfig
+```
+<br><br>
+
+### Undefined references to google::protobuf:: functions
* When compiling armNN there are multiple errors of the following type:
- ```
- libarmnnCaffeParser.so: undefined reference to `google::protobuf:*
- ```
+```
+libarmnnCaffeParser.so: undefined reference to `google::protobuf:*
+```
* Missing or out of date protobuf compilation libraries.
Use the command 'protoc --version' to check which version of protobuf is available (version 3.12.0 is required).
Follow the instructions above to install protobuf 3.12.0
Note this will require you to recompile Caffe for x86_64
+<br><br>
-##
-#### Errors on strict-aliasing rules when compiling the Compute Library
+### Errors on strict-aliasing rules when compiling the Compute Library
* When compiling the Compute Library there are multiple errors on strict-aliasing rules:
- ```
- cc1plus: error: unrecognized command line option ‘-Wno-implicit-fallthrough’ [-Werror]
- ```
+ ```
+cc1plus: error: unrecognized command line option ‘-Wno-implicit-fallthrough’ [-Werror]
+ ```
* Add Werror=0 to the scons command:
- ```
- scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" -j8 internal_only=0 Werror=0
- ```
+```
+scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" -j8 internal_only=0 Werror=0
+```
diff --git a/InstallationViaAptRepository.md b/InstallationViaAptRepository.md
index e6a9398b85..4f0f6f0c28 100644
--- a/InstallationViaAptRepository.md
+++ b/InstallationViaAptRepository.md
@@ -1,18 +1,22 @@
# How to install ArmNN via our APT repository on Ubuntu's Launchpad
-* [Introduction](#introduction)
-* [Add the Ubuntu Launchpad PPA to your system](#addRepo)
-* [Outline of available packages](#availablePackages)
-* [Install desired combination of packages](#InstallPackages)
-* [Uninstall packages](#uninstallPackages)
-
-
-#### <a name="introduction">Introduction</a>
+* [Introduction](#introduction)
+* [Add the Ubuntu Launchpad PPA to your system](#add-the-ubuntu-launchpad-ppa-to-your-system)
+* [Outline of available packages](#outline-of-available-packages)
+ + [x86_64](#x86-64)
+ + [arm64](#arm64)
+ + [armhf](#armhf)
+* [Check latest version of packages](#check-latest-version-of-packages)
+* [Install desired combination of packages](#install-desired-combination-of-packages)
+* [Uninstall packages](#uninstall-packages)
+
+
+## Introduction
These are the step by step instructions on how to install the ArmNN core, TensorflowLite Parser as well as PyArmnn for x86_64, Arm64 and Armhf for Ubuntu 20.04.
The packages will also be added to Debian Bullseye, their progress can be tracked here: https://tracker.debian.org/pkg/armnn
-#### <a name="addRepo">Add the Ubuntu Launchpad PPA to your system</a>
+## Add the Ubuntu Launchpad PPA to your system
* Add the PPA to your sources using a command contained in software-properties-common package:
```
sudo apt install software-properties-common
@@ -20,7 +24,7 @@ The packages will also be added to Debian Bullseye, their progress can be tracke
sudo apt update
```
* More information about our PPA and the Ubuntu Launchpad service can be found at [launchpad.net](https://launchpad.net/~armnn/+archive/ubuntu/ppa)
-#### <a name="availablePackages"> Outline of available packages</a>
+## Outline of available packages
We provide a number of packages for each architecture; x86_64, aarch64 and armhf as outlined below.
@@ -30,7 +34,7 @@ ARMNN_RELEASE_VERSION: This is the marketing release version based on the date s
PACKAGE_VERSION: This is the version of the source package used to build the binaries packages from.
-##### x86_64
+### x86_64
* Runtime Packages
```
libarmnn-cpuref-backend{ARMNN_MAJOR_VERSION}_{ARMNN_RELEASE_VERSION}-{PACKAGE_VERSION}_amd64.deb
@@ -43,7 +47,7 @@ python3-pyarmnn_{ARMNN_RELEASE_VERSION}-{PACKAGE_VERSION}_amd64.deb
libarmnn-dev_{ARMNN_RELEASE_VERSION}-{PACKAGE_VERSION}_amd64.deb
libarmnn-tfliteparser-dev_{ARMNN_RELEASE_VERSION}-{PACKAGE_VERSION}_amd64.deb
```
-##### arm64
+### arm64
* Runtime Packages
```
libarmnn-aclcommon{ARMNN_MAJOR_VERSION}_{ARMNN_RELEASE_VERSION}-{PACKAGE_VERSION}_arm64.deb
@@ -61,7 +65,7 @@ libarmnn-dev_{ARMNN_RELEASE_VERSION}-{PACKAGE_VERSION}_arm64.deb
libarmnn-tfliteparser-dev_{ARMNN_RELEASE_VERSION}-{PACKAGE_VERSION}_arm64.deb
```
-##### armhf
+### armhf
* Runtime Packages
```
libarmnn-aclcommon{ARMNN_MAJOR_VERSION}_{ARMNN_RELEASE_VERSION}-{PACKAGE_VERSION}_armhf.deb
@@ -80,7 +84,7 @@ libarmnn-tfliteparser-dev_{ARMNN_RELEASE_VERSION}-{PACKAGE_VERSION}_armhf.deb
```
-#### <a name="VersionPackages"> Check latest version of packages</a>
+## Check latest version of packages
Due to Debian Packaging requiring the pristine tarball from our Github release, the version on Launchpad may not align with the released version on Github depending on the complexity of newly added features.
In order to check for the latest available ArmNN version use apt-cache search:
```
@@ -108,7 +112,7 @@ In order to check for the latest available ArmNN version use apt-cache search:
```
-#### <a name="InstallPackages"> Install desired combination of packages</a>
+## Install desired combination of packages
The easiest way to install all of the available packages for your systems architecture is to run the command:
(Please Note: libarmnn-cpuacc-backend has been built with NEON support, installing this backend on an armhf device not supporting NEON may cause a crash/undefined behaviour.)
@@ -125,7 +129,7 @@ If the user does not wish to use PyArmnn they can go up a level of dependencies
sudo apt-get install -y libarmnn-tfliteparser${ARMNN_MAJOR_VERSION} libarmnn-gpuacc-backend${ARMNN_MAJOR_VERSION}
```
-#### <a name="uninstallPackages"> Uninstall packages</a>
+## Uninstall packages
The easiest way to uninstall all of the previously installed packages is to run the command:
```
sudo apt autoremove -y libarmnn${ARMNN_MAJOR_VERSION}
diff --git a/docs/02_build_guides.dox b/docs/02_build_guides.dox
index 35abf3229e..e61354dd54 100644
--- a/docs/02_build_guides.dox
+++ b/docs/02_build_guides.dox
@@ -6,11 +6,11 @@
namespace armnn
{
/**
-@page buildguides Build Guides
+@page buildguides Installation and build Guides
@tableofcontents
-This page links all guides to build and/or install Arm NN tools. Some of these guides are not hosted in our
-repository and will lead you to guides on
+This page links all guides to build and/or install Arm NN tools hosted in our repository.
+You can find additional tutorials on
https://developer.arm.com/solutions/machine-learning-on-arm/developer-material/how-to-guides
Arm NN is written using portable C++14 and the build system uses [CMake](https://cmake.org/), therefore it is possible
@@ -19,8 +19,17 @@ to build for a wide variety of target platforms, from a wide variety of host env
Arm NN is managed by a single CMake project. That allows you to build multiple tools at once by combining the CMake
options from different build guides.
+## Installation via APT Repository
+ - @subpage md_InstallationViaAptRepository
+
## TfLite Delegate build guide
- @subpage md_delegate_BuildGuideNative
+## Android NDK and Arm NN
+ - @subpage md_BuildGuideAndroidNDK
+
+## Crosscompile Guide for Arm NN
+ - @subpage md_BuildGuideCrossCompilation
+
**/
} \ No newline at end of file
diff --git a/docs/Doxyfile b/docs/Doxyfile
index a8a5b5cf13..cfd2e670bc 100644
--- a/docs/Doxyfile
+++ b/docs/Doxyfile
@@ -820,14 +820,15 @@ INPUT = ./docs/01_00_software_tools.dox \
./docs/02_build_guides.dox \
./docs/03_use_guides.dox \
./docs/04_contributor.dox \
- ./src/armnnQuantizer/README.md \
- ./src/armnnConverter/README.md \
+ ./docs/FAQ.md \
./tests/ImageCSVFileGenerator/README.md \
./tests/ImageTensorGenerator/README.md \
./tests/ModelAccuracyTool-Armnn/README.md \
./python/pyarmnn/README.md \
./include/ \
./src/ \
+ ./src/armnnQuantizer/README.md \
+ ./src/armnnConverter/README.md \
./src/backends/README.md \
./src/dynamic/README.md \
./tests/ \
@@ -836,8 +837,10 @@ INPUT = ./docs/01_00_software_tools.dox \
./delegate/BuildGuideNative.md \
./delegate/IntegrateDelegateIntoPython.md \
./README.md \
- ./docs/FAQ.md \
- ./ContributorGuide.md
+ ./InstallationViaAptRepository.md \
+ ./ContributorGuide.md \
+ ./BuildGuideAndroidNDK.md \
+ ./BuildGuideCrossCompilation.md
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses