IVGCVSW-3726 - Doxygen Beautification
[platform/upstream/armnn.git] / docs / 00_introduction.dox
1 /// Copyright (c) 2017 ARM Limited.
2 ///
3 /// SPDX-License-Identifier: MIT
4 ///
5 /// Permission is hereby granted, free of charge, to any person obtaining a copy
6 /// of this software and associated documentation files (the "Software"), to deal
7 /// in the Software without restriction, including without limitation the rights
8 /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 /// copies of the Software, and to permit persons to whom the Software is
10 /// furnished to do so, subject to the following conditions:
11 ///
12 /// The above copyright notice and this permission notice shall be included in all
13 /// copies or substantial portions of the Software.
14 ///
15 /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 /// SOFTWARE.
22 ///
23
24
25 namespace armnn{
26 /** @mainpage Introduction
27
28 @tableofcontents
29 @section S0_1_armnn ArmNN
30
31 Arm NN is a key component of the [machine learning platform](https://mlplatform.org/), which is part of the [Linaro Machine Intelligence Initiative](https://www.linaro.org/news/linaro-announces-launch-of-machine-intelligence-initiative/). For more information on the machine learning platform and Arm NN, see: <https://mlplatform.org/>, also there is further Arm NN information available from <https://developer.arm.com/products/processors/machine-learning/arm-nn>
32
33 There is a getting started guide here using TensorFlow: <https://developer.arm.com/technologies/machine-learning-on-arm/developer-material/how-to-guides/configuring-the-arm-nn-sdk-build-environment-for-tensorflow>
34
35 There is a getting started guide here using TensorFlow Lite: <https://developer.arm.com/technologies/machine-learning-on-arm/developer-material/how-to-guides/configuring-the-arm-nn-sdk-build-environment-for-tensorflow-lite>
36
37 There is a getting started guide here using Caffe: <https://developer.arm.com/technologies/machine-learning-on-arm/developer-material/how-to-guides/configuring-the-arm-nn-sdk-build-environment-for-caffe>
38
39 There is a getting started guide here using ONNX: <https://developer.arm.com/technologies/machine-learning-on-arm/developer-material/how-to-guides/configuring-the-arm-nn-sdk-build-environment-for-onnx>
40
41 There is a guide for backend development <a href="backends.xhtml">here</a>.
42 <br/><br/><br/><br/>
43
44 @section S1_license License
45
46 Arm NN is provided under the [MIT](https://spdx.org/licenses/MIT.html) license.
47
48 __**MIT License**__
49
50 Copyright (c) 2017-2020 ARM Limited.
51
52 Permission is hereby granted, free of charge, to any person obtaining a copy
53 of this software and associated documentation files (the "Software"), to deal
54 in the Software without restriction, including without limitation the rights
55 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
56 copies of the Software, and to permit persons to whom the Software is
57 furnished to do so, subject to the following conditions:
58
59 The above copyright notice and this permission notice shall be included in all
60 copies or substantial portions of the Software.
61
62 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
63 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
64 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
65 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
66 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
67 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
68 SOFTWARE.
69
70
71 Individual files contain the following tag instead of the full license text.
72
73     SPDX-License-Identifier: MIT
74
75 This enables machine processing of license information based on the SPDX License Identifiers that are available [here](http://spdx.org/licenses/)
76 <br/><br/><br/><br/>
77
78 @section S2_1_contributions Contributor Guide
79
80 The Arm NN project is open for external contributors and welcomes contributions. Arm NN is licensed under the [MIT license](https://spdx.org/licenses/MIT.html) and all accepted contributions must have the same license. For more details on contributing to Arm NN see the [Contributing page](https://mlplatform.org/contributing/) on the [MLPlatform.org](https://mlplatform.org/) website.
81
82 @subsection S2_1_dco Developer Certificate of Origin (DCO)
83
84 Before the Arm NN project accepts your contribution, you need to certify its origin and give us your permission.  To manage this process we use Developer Certificate of Origin (DCO) V1.1 (https://developercertificate.org/).
85
86 To indicate that you agree to the the terms of the DCO, you "sign off" your contribution by adding a line with your name and e-mail address to every git commit message:
87
88 Signed-off-by: John Doe <john.doe@example.org>
89
90 You must use your real name, no pseudonyms or anonymous contributions are accepted.
91
92 @subsection S2_2_releases Releases
93
94 Official Arm NN releases are published through the official [Arm NN Github repository](https://github.com/ARM-software/armnn).
95
96 @subsection S2_3_development_repository Developer Repository
97
98 The Arm NN development repository is hosted on the [mlplatform.org git repository](https://git.mlplatform.org/ml/armnn.git/) hosted by [Linaro](https://www.linaro.org/).
99
100 @subsection S2_4_code_review Code Review
101
102 Contributions must go through code review. Code reviews are performed through the [mlplatform.org Gerrit server](https://review.mlplatform.org). Contributors need to signup to this Gerrit server with their GitHub account
103 credentials.
104
105 Only reviewed contributions can go to the master branch of Arm NN.
106
107 @subsection S2_5_continuous_integration Continuous Integration
108
109 Contributions to Arm NN go through testing at the Arm CI system. All unit, integration and regression tests must pass before a contribution gets merged to the Arm NN master branch.
110
111 @subsection S2_6_communications Communications
112
113 We encourage all Arm NN developers to subscribe to the [Arm NN developer mailing list](https://lists.linaro.org/mailman/listinfo/armnn-dev).
114 <br/><br/><br/><br/>
115
116
117
118
119
120
121
122
123
124 @section S3_build_instructions Build Instructions
125
126 Arm tests the build system of Arm NN with the following build environments:
127
128 * Android NDK
129 * Cross compilation from x86_64 Ubuntu to arm64 Linux
130 * Native compilation under aarch64 Debian 9
131
132
133 Arm NN is written using portable C++14 and the build system uses [CMake](https://cmake.org/), therefore it is possible to build for a wide variety of target platforms, from a wide variety of host environments.
134
135 The armnn/tests directory contains tests used during Arm NN development. Many of them depend on third-party IP, model protobufs and image files not distributed with Arm NN. The dependencies of some of the tests are available freely on the Internet, for those who wish to experiment.
136
137 The 'armnn/samples' directory contains SimpleSample.cpp, a very basic example of the ArmNN SDK API in use.
138
139 The 'ExecuteNetwork' program, in armnn/tests/ExecuteNetwork, has no additional dependencies beyond those required by Arm NN and the model parsers. It takes any model and any input tensor, and simply prints out the output tensor. Run it with no arguments to see command-line help.
140
141 The 'ArmnnConverter' program, in armnn/src/armnnConverter, has no additional dependencies beyond those required by Arm NN and the model parsers. It takes a model in TensorFlow format and produces a serialized model in Arm NN format. Run it with no arguments to see command-line help. Note that this program can only convert models for which all operations are supported by the serialization tool [src/armnnSerializer](src/armnnSerializer/README.md).
142
143 The 'ArmnnQuantizer' program, in armnn/src/armnnQuantizer, has no additional dependencies beyond those required by Arm NN and the model parsers. It takes a 32-bit float network and converts it into a quantized asymmetric 8-bit or quantized symmetric 16-bit network.
144 Static quantization is supported by default but dynamic quantization can be enabled if CSV file of raw input tensors is specified. Run it with no arguments to see command-line help.
145
146 \Note  note that Arm NN needs to be built against a particular version of [ARM's Compute Library](https://github.com/ARM-software/ComputeLibrary). The get_compute_library.sh in the scripts subdirectory will clone the compute library from the review.mlplatform.org github repository into a directory alongside armnn named 'clframework' and checks out the correct revision.
147 <br/><br/><br/><br/>
148
149 @subsection S3_1_android_ndk_build_guide How to use the Android NDK to build ArmNN
150
151 <ul>
152     <li>  [Introduction](#introduction) </li>
153     <li>  [Download the Android NDK and make a standalone toolchain](#downloadNDK) </li>
154     <li>  [Build the Boost C++ libraries](#buildBoost) </li>
155     <li>  [Build the Compute Library](#buildCL) </li>
156     <li>  [Build Google's Protobuf library](#buildProtobuf) </li>
157     <li>  [Download TensorFlow](#downloadTF) </li>
158     <li>  [Build ArmNN](#buildArmNN) </li>
159     <li>  [Run ArmNN UnitTests on an Android device](#runArmNNUnitTests) </li>
160 </ul>
161
162 ## <a name="introduction">Introduction</a>
163 These are step by step instructions for using the Android NDK to build ArmNN.
164 They have been tested on a clean install of Ubuntu 18.04, and should also work with other OS versions.
165 The instructions show how to build the ArmNN core library and the optional TensorFlow parser.
166 All downloaded or generated files will be saved inside the `~/armnn-devenv` directory.
167
168
169 ## <a name="downloadNDK">Download the Android NDK and make a standalone toolchain</a>
170
171 ### Download the Android NDK from [the official website](https://developer.android.com/ndk/downloads/index.html):
172
173 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
174
175      mkdir -p ~/armnn-devenv/toolchains
176      cd ~/armnn-devenv/toolchains
177
178      #For Mac OS, change the NDK download link accordingly.
179      wget https://dl.google.com/android/repository/android-ndk-r17b-linux-x86_64.zip
180      unzip android-ndk-r17b-linux-x86_64.zip
181      export NDK=~/armnn-devenv/toolchains/android-ndk-r17b
182
183 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184
185          You may want to append `export NDK=~/armnn-devenv/toolchains/android-ndk-r17b` to your `~/.bashrc` (or `~/.bash_profile` in Mac OS).
186
187 ### Make a standalone toolchain:
188
189          (Requires python if not previously installed: `sudo apt install python`)
190
191 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
192
193    # Create an arm64 API 26 libc++ toolchain.
194    $NDK/build/tools/make_standalone_toolchain.py \
195        --arch arm64 \
196        --api 26 \
197        --stl=libc++ \
198        --install-dir=$HOME/armnn-devenv/toolchains/aarch64-android-r17b
199    export PATH=$HOME/armnn-devenv/toolchains/aarch64-android-r17b/bin:$PATH
200
201 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
202
203          You may want to append `export PATH=$HOME/armnn-devenv/toolchains/aarch64-android-r17b/bin:$PATH` to your `~/.bashrc` (or `~/.bash_profile` in Mac OS).
204
205 ## <a name="buildBoost">Build the Boost C++ libraries</a>
206
207 ### Download Boost version 1.64:
208
209 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
210    mkdir ~/armnn-devenv/boost
211    cd ~/armnn-devenv/boost
212    wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2
213    tar xvf boost_1_64_0.tar.bz2
214
215 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
216
217 ### Build:
218
219         (Requires gcc if not previously installed: `sudo apt install gcc`)
220 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
221
222         echo "using gcc : arm : aarch64-linux-android-clang++ ;" > $HOME/armnn-devenv/boost/user-config.jam
223         cd ~/armnn-devenv/boost/boost_1_64_0
224         ./bootstrap.sh --prefix=$HOME/armnn-devenv/boost/install
225         ./b2 install --user-config=$HOME/armnn-devenv/boost/user-config.jam \
226      toolset=gcc-arm link=static cxxflags=-fPIC --with-filesystem \
227          --with-test --with-log --with-program_options -j16
228
229 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
230
231 ## <a name="buildCL">Build the Compute Library</a>
232
233 ### Clone the Compute Library:
234
235         (Requires Git if not previously installed: `sudo apt install git`)
236
237 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
238
239         cd ~/armnn-devenv
240         git clone https://github.com/ARM-software/ComputeLibrary.git
241
242 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
243
244 ### Build:
245
246         (Requires SCons if not previously installed: `sudo apt install scons`)
247 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
248
249         cd ComputeLibrary
250         scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" \
251          benchmark_tests=0 validation_tests=0 os=android -j16
252
253 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
254
255 ## <a name="buildProtobuf">Build Google's Protobuf library</a>
256
257 ### Clone protobuf:
258
259 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
260
261         mkdir ~/armnn-devenv/google
262         cd ~/armnn-devenv/google
263         git clone https://github.com/google/protobuf.git
264         cd protobuf
265         git checkout -b v3.5.2 v3.5.2
266
267 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
268
269 ### Build a native (x86) version of the protobuf libraries and compiler (protoc):
270
271         (Requires cUrl, autoconf, llibtool, and other build dependencies if not previously installed: `sudo apt install curl autoconf libtool build-essential g++`)
272
273 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
274
275         ./autogen.sh
276         mkdir x86_build
277         cd x86_build
278         ../configure --prefix=$HOME/armnn-devenv/google/x86_pb_install
279         make install -j16
280         cd ..
281
282 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
283
284 ### Build the arm64 version of the protobuf libraries:
285
286 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
287
288         mkdir arm64_build
289         cd arm64_build
290         CC=aarch64-linux-android-clang \
291           CXX=aarch64-linux-android-clang++ \
292           CFLAGS="-fPIE -fPIC" LDFLAGS="-pie -llog" \
293        ../configure --host=aarch64-linux-android \
294        --prefix=$HOME/armnn-devenv/google/arm64_pb_install \
295        --with-protoc=$HOME/armnn-devenv/google/x86_pb_install/bin/protoc
296         make install -j16
297         cd ..
298
299 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
300
301 ## <a name="downloadTF">Download TensorFlow</a>
302 ### Clone TensorFlow source code:
303
304 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
305
306         cd ~/armnn-devenv/google/
307         git clone https://github.com/tensorflow/tensorflow.git
308     cd tensorflow/
309     git checkout a0043f9262dc1b0e7dc4bdf3a7f0ef0bebc4891e
310
311 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
312
313         You need tensorflow/contrib/makefile/tf_proto_files.txt from TensorFlow to generate TensorFlow protobuf definitions. This file is not available in TensorFlow master branch.
314
315 ## <a name="buildArmNN">Build ArmNN</a>
316
317 ### Clone ArmNN source code:
318
319 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
320
321         cd ~/armnn-devenv/
322         git clone https://github.com/ARM-software/armnn.git
323
324 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
325
326 ### Generate TensorFlow protobuf definitions:
327
328 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
329
330         cd ~/armnn-devenv/google/tensorflow
331         ~/armnn-devenv/armnn/scripts/generate_tensorflow_protobuf.sh \
332          $HOME/armnn-devenv/google/tf_pb $HOME/armnn-devenv/google/x86_pb_install
333
334 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
335
336 ### Build ArmNN:
337
338         (Requires CMake if not previously installed: `sudo apt install cmake`)
339
340 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
341
342           mkdir ~/armnn-devenv/armnn/build
343           cd ~/armnn-devenv/armnn/build
344       CXX=aarch64-linux-android-clang++ \
345           CC=aarch64-linux-android-clang \
346           CXX_FLAGS="-fPIE -fPIC" \
347           cmake .. \
348       -DCMAKE_SYSTEM_NAME=Android \
349       -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
350       -DCMAKE_ANDROID_STANDALONE_TOOLCHAIN=$HOME/armnn-devenv/toolchains/aarch64-android-r17b/ \
351       -DCMAKE_EXE_LINKER_FLAGS="-pie -llog" \
352       -DARMCOMPUTE_ROOT=$HOME/armnn-devenv/ComputeLibrary/ \
353       -DARMCOMPUTE_BUILD_DIR=$HOME/armnn-devenv/ComputeLibrary/build \
354       -DBOOST_ROOT=$HOME/armnn-devenv/boost/install/ \
355       -DARMCOMPUTENEON=1 -DARMCOMPUTECL=1 -DARMNNREF=1 \
356       -DTF_GENERATED_SOURCES=$HOME/armnn-devenv/google/tf_pb/ -DBUILD_TF_PARSER=1 \
357       -DPROTOBUF_ROOT=$HOME/armnn-devenv/google/arm64_pb_install/
358           make -j16
359
360 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
361
362 ## <a name="runArmNNUnitTests">Run the ArmNN unit tests on an Android device</a>
363
364
365 ### Push the build results to an Android device and make symbolic links for shared libraries:
366   Currently adb version we have used for testing is 1.0.41.
367
368 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
369
370         adb push libarmnnTfParser.so /data/local/tmp/
371         adb push libarmnn.so /data/local/tmp/
372         adb push UnitTests /data/local/tmp/
373         adb push $NDK/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so /data/local/tmp/
374         adb push $HOME/armnn-devenv/google/arm64_pb_install/lib/libprotobuf.so /data/local/tmp/libprotobuf.so.15.0.1
375         adb shell 'ln -s libprotobuf.so.15.0.1 /data/local/tmp/libprotobuf.so.15'
376         adb shell 'ln -s libprotobuf.so.15.0.1 /data/local/tmp/libprotobuf.so'
377
378 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
379
380 ### Push the files needed for the unit tests (they are a mix of files, directories and symbolic links):
381
382 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
383
384         adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/testSharedObject
385         adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/testSharedObject/* /data/local/tmp/src/backends/backendsCommon/test/testSharedObject/
386
387         adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/testDynamicBackend
388         adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/testDynamicBackend/* /data/local/tmp/src/backends/backendsCommon/test/testDynamicBackend/
389
390         adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath1
391         adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath1/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath1/
392
393         adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2
394         adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath2/Arm_CpuAcc_backend.so /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/
395         adb shell ln -s Arm_CpuAcc_backend.so /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/Arm_CpuAcc_backend.so.1
396         adb shell ln -s Arm_CpuAcc_backend.so.1 /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/Arm_CpuAcc_backend.so.1.2
397         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
398         adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath2/Arm_GpuAcc_backend.so /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/
399         adb shell ln -s nothing /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/Arm_no_backend.so
400
401         adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath3
402
403         adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath5
404         adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath5/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath5/
405
406         adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath6
407         adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath6/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath6/
408
409         adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath7
410
411         adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath9
412         adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath9/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath9/
413
414         adb shell mkdir -p /data/local/tmp/src/backends/dynamic/reference
415         adb push -p ~/armnn-devenv/armnn/build/src/backends/dynamic/reference/Arm_CpuRef_backend.so /data/local/tmp/src/backends/dynamic/reference/
416
417 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
418
419 ### Run ArmNN unit tests:
420
421 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
422
423         adb shell 'LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/UnitTests'
424
425 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
426
427         If libarmnnUtils.a is present in `~/armnn-devenv/armnn/build/` and the unit tests run without failure then the build was successful.
428 <br/><br/><br/><br/>
429
430 @subsection S3_2_cross_compilations_build_guide  Cross Compilation Build Guide
431
432 <ul>
433     <li>  [Introduction](#introduction) </li>
434     <li>  [Cross-compiling ToolChain](#installCCT) </li>
435     <li>  [Build and install Google's Protobuf library](#buildProtobuf) </li>
436     <li>  [Build Caffe for x86_64](#buildCaffe) </li>
437     <li>  [Build Boost library for arm64](#installBaarch) </li>
438     <li>  [Build Compute Library](#buildCL) </li>
439     <li>  [Build ArmNN](#buildANN) </li>
440     <li>  [Run Unit Tests](#unittests) </li>
441     <li>  [Troubleshooting and Errors](#troubleshooting) </li>
442 </ul>
443
444
445 ## <a name="introduction">Introduction</a>
446 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.
447 The instructions show how to build the ArmNN core library and the Boost, Protobuf, Caffe and Compute Libraries necessary for compilation.
448
449 ## <a name="installCCT">Cross-compiling ToolChain</a>
450
451 ### Install the standard cross-compilation libraries for arm64:
452
453 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
454
455     sudo apt install crossbuild-essential-arm64
456
457 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
458
459 ## <a name="buildProtobuf">Build and install Google's Protobuf library</a>
460
461 ### Get protobuf-all-3.5.1.tar.gz from [here](https://github.com/protocolbuffers/protobuf/releases/tag/v3.5.1).
462
463 ### Extract:
464
465 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
466
467     tar -zxvf protobuf-all-3.5.1.tar.gz
468     cd protobuf-3.5.1
469
470 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
471
472 ### Build a native (x86_64) version of the protobuf libraries and compiler (protoc):
473   (Requires cUrl, autoconf, llibtool, and other build dependencies if not previously installed: sudo apt install curl autoconf libtool build-essential g++)
474
475 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
476
477     mkdir x86_64_build
478     cd x86_64_build
479     ../configure --prefix=$HOME/armnn-devenv/google/x86_64_pb_install
480     make install -j16
481     cd ..
482
483 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
484
485 ### Build the arm64 version of the protobuf libraries:
486
487 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
488
489     mkdir arm64_build
490     cd arm64_build
491     CC=aarch64-linux-gnu-gcc \
492     CXX=aarch64-linux-gnu-g++ \
493     ../configure --host=aarch64-linux \
494     --prefix=$HOME/armnn-devenv/google/arm64_pb_install \
495     --with-protoc=$HOME/armnn-devenv/google/x86_64_pb_install/bin/protoc
496     make install -j16
497     cd ..
498
499 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
500
501 ## <a name="buildCaffe">Build Caffe for x86_64</a>
502
503 ### Ubuntu 16.04 installation. These steps are taken from the full Caffe installation documentation [here](http://caffe.berkeleyvision.org/install_apt.html)
504
505 ### Install dependencies:
506
507 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
508
509     sudo apt-get install libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev
510     sudo apt-get install --no-install-recommends libboost-all-dev
511     sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
512     sudo apt-get install libopenblas-dev
513     sudo apt-get install libatlas-base-dev
514
515 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
516
517 ### Download Caffe-Master from [here](https://github.com/BVLC/caffe).
518
519 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
520
521     git clone https://github.com/BVLC/caffe.git
522     cd caffe
523     cp Makefile.config.example Makefile.config
524
525 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
526
527 ### Adjust Makefile.config as necessary for your environment, for example:
528
529 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
530
531     #CPU only version:
532     CPU_ONLY := 1
533
534     #Add hdf5 and protobuf include and library directories (Replace $HOME with explicit /home/username dir):
535     INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/ $HOME/armnn-devenv/google/x86_64_pb_install/include/
536     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/
537
538 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
539
540 ### Setup environment:
541
542 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
543
544     export PATH=$HOME/armnn-devenv/google/x86_64_pb_install/bin/:$PATH
545     export LD_LIBRARY_PATH=$HOME/armnn-devenv/google/x86_64_pb_install/lib/:$LD_LIBRARY_PATH
546
547 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
548
549 ### Compilation with Make:
550
551 ~~~~~~~~~~~~~~~~.sh
552
553     make all
554     make test
555     make runtest
556
557 ~~~~~~~~~~~~~~~~
558
559     These should all run without errors
560 ### caffe.pb.h and caffe.pb.cc will be needed when building ArmNN's Caffe Parser
561
562 ## <a name="installBaarch">Build Boost library for arm64</a>
563
564 ### Build Boost library for arm64
565     Download Boost version 1.64 from [here](http://www.boost.org/doc/libs/1_64_0/more/getting_started/unix-variants.html).
566     Using any version of Boost greater than 1.64 will fail to build ArmNN, due to different dependency issues.
567
568 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
569     tar -zxvf boost_1_64_0.tar.gz
570     cd boost_1_64_0
571     echo "using gcc : arm : aarch64-linux-gnu-g++ ;" > user_config.jam
572     ./bootstrap.sh --prefix=$HOME/armnn-devenv/boost_arm64_install
573     ./b2 install toolset=gcc-arm link=static cxxflags=-fPIC --with-filesystem --with-test --with-log --with-program_options -j32 --user-config=user_config.jam
574
575 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
576
577 ## <a name="buildCL">Build Compute Library</a>
578
579 ### Building the Arm Compute Library:
580
581 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
582
583     git clone https://github.com/ARM-software/ComputeLibrary.git
584     cd ComputeLibrary/
585     scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" -j8 internal_only=0
586
587 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
588
589 ## <a name="buildANN">Build ArmNN</a>
590
591 ### Compile ArmNN for arm64:
592
593 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
594
595     git clone https://github.com/ARM-software/armnn.git
596     cd armnn
597     mkdir build
598     cd build
599
600 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
601
602 ### 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:
603
604 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
605
606     #!/bin/bash
607     CXX=aarch64-linux-gnu-g++ \
608     CC=aarch64-linux-gnu-gcc \
609     cmake .. \
610     -DARMCOMPUTE_ROOT=$HOME/armnn-devenv/ComputeLibrary \
611     -DARMCOMPUTE_BUILD_DIR=$HOME/armnn-devenv/ComputeLibrary/build/ \
612     -DBOOST_ROOT=$HOME/armnn-devenv/boost_arm64_install/ \
613     -DARMCOMPUTENEON=1 -DARMCOMPUTECL=1 -DARMNNREF=1 \
614     -DCAFFE_GENERATED_SOURCES=$HOME/armnn-devenv/caffe/build/src \
615     -DBUILD_CAFFE_PARSER=1 \
616     -DPROTOBUF_ROOT=$HOME/armnn-devenv/google/x86_64_pb_install/ \
617     -DPROTOBUF_LIBRARY_DEBUG=$HOME/armnn-devenv/google/arm64_pb_install/lib/libprotobuf.so.15.0.1 \
618     -DPROTOBUF_LIBRARY_RELEASE=$HOME/armnn-devenv/google/arm64_pb_install/lib/libprotobuf.so.15.0.1
619
620 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
621
622 ### Run the build
623
624 ~~~~~~~~~~~~~.sh
625
626     make -j32
627
628 ~~~~~~~~~~~~~
629
630 ## <a name="unittests">Run Unit Tests</a>
631
632 ### Copy the build folder to an arm64 linux machine
633
634 ### Copy the libprotobuf.so.15.0.1 library file to the build folder
635
636 ### cd to the build folder on your arm64 machine and set your LD_LIBRARY_PATH to its current location:
637
638 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
639
640     cd build/
641     export LD_LIBRARY_PATH=`pwd`
642
643 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
644
645 ### Create a symbolic link to libprotobuf.so.15.0.1:
646
647 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
648
649     ln -s libprotobuf.so.15.0.1 ./libprotobuf.so.15
650
651 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
652
653 ### Run the UnitTests:
654
655 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
656
657     ./UnitTests
658     Running 567 test cases...
659
660     *** No errors detected
661
662 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
663
664 ## <a name="troubleshooting">Troubleshooting and Errors:</a>
665 ## Error adding symbols: File in wrong format
666
667 ### When building armNN:
668
669 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
670
671     /usr/local/lib/libboost_log.a: error adding symbols: File in wrong format
672     collect2: error: ld returned 1 exit status
673     CMakeFiles/armnn.dir/build.make:4028: recipe for target 'libarmnn.so' failed
674     make[2]: *** [libarmnn.so] Error 1
675     CMakeFiles/Makefile2:105: recipe for target 'CMakeFiles/armnn.dir/all' failed
676     make[1]: *** [CMakeFiles/armnn.dir/all] Error 2
677     Makefile:127: recipe for target 'all' failed
678     make: *** [all] Error 2
679
680 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
681
682 ### Boost libraries are not compiled for the correct architecture, try recompiling for arm64
683
684 ## Virtual memory exhausted
685 ### When compiling the boost libraries:
686
687 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
688
689     virtual memory exhausted: Cannot allocate memory
690
691 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
692
693 ### Not enough memory available to compile. Increase the amount of RAM or swap space available.
694
695
696 ## Unrecognized command line option '-m64'
697
698 ### When compiling the boost libraries:
699
700 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
701
702     aarch64-linux-gnu-g++: error: unrecognized command line option ‘-m64’
703
704 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
705
706 ### Clean the boost library directory before trying to build with a different architecture:
707
708 ~~~~~~~~~~~~~~~~~~~.sh
709
710     sudo ./b2 clean
711
712 ~~~~~~~~~~~~~~~~~~~
713
714 ### It should show the following for arm64:
715
716 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
717
718     - 32-bit                   : no
719     - 64-bit                   : yes
720     - arm                      : yes
721
722 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
723
724
725 ## Missing libz.so.1
726
727 ### When compiling armNN:
728
729 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
730
731     /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.15.0.0, not found (try using -rpath or -rpath-link)
732
733 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
734
735 ### Missing arm64 libraries for libz.so.1, these can be added by adding a second architecture to dpkg and explicitly installing them:
736
737 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
738
739     sudo dpkg --add-architecture arm64
740     sudo apt-get install zlib1g:arm64
741     sudo apt-get update
742     sudo ldconfig
743
744 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
745
746 ### If apt-get update returns 404 errors for arm64 repos refer to section 5 below.
747
748 ### 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)
749
750 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
751
752     sudo dpkg -i zlib1g_1.2.8.dfsg-2ubuntu4_arm64.deb
753
754 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
755
756 ## Unable to install arm64 packages after adding arm64 architecture
757
758 ### 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:
759
760 ### From stackoverflow [here](https://askubuntu.com/questions/430705/how-to-use-apt-get-to-download-multi-arch-library/430718).
761
762 ### Open /etc/apt/sources.list with your preferred text editor.
763
764 ### Mark all the current (default) repos as \[arch=<current_os_arch>], e.g.
765
766 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
767
768     deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ xenial main restricted
769
770 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
771
772 ### Then add the following:
773
774 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
775
776     deb [arch=arm64] http://ports.ubuntu.com/ xenial main restricted
777     deb [arch=arm64] http://ports.ubuntu.com/ xenial-updates main restricted
778     deb [arch=arm64] http://ports.ubuntu.com/ xenial universe
779     deb [arch=arm64] http://ports.ubuntu.com/ xenial-updates universe
780     deb [arch=arm64] http://ports.ubuntu.com/ xenial multiverse
781     deb [arch=arm64] http://ports.ubuntu.com/ xenial-updates multiverse
782     deb [arch=arm64] http://ports.ubuntu.com/ xenial-backports main restricted universe multiverse
783
784 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
785
786 ### Update and install again:
787
788 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
789
790     sudo apt-get install zlib1g:arm64
791     sudo apt-get update
792     sudo ldconfig
793
794 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
795
796 ## Undefined references to google::protobuf:: functions
797
798 ### When compiling armNN there are multiple errors of the following type:
799     ```
800     libarmnnCaffeParser.so: undefined reference to `google::protobuf:*
801     ```
802 ### Missing or out of date protobuf compilation libraries.
803     Use the command 'protoc --version' to check which version of protobuf is available (version 3.5.1 is required).
804     Follow the instructions above to install protobuf 3.5.1
805     Note this will require you to recompile Caffe for x86_64
806
807 ## Errors on strict-aliasing rules when compiling the Compute Library
808
809 ### When compiling the Compute Library there are multiple errors on strict-aliasing rules:
810
811 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
812
813     cc1plus: error: unrecognized command line option ‘-Wno-implicit-fallthrough’ [-Werror]
814
815 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
816
817 ### Add Werror=0 to the scons command:
818
819 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
820
821     scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" -j8 internal_only=0 Werror=0
822
823 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
824
825 **/
826 }