blob: 6153b03fa7031a9d4ae9e6a170b98be6445e39d4 [file] [log] [blame]
Ryan OShea2bbfaa72020-02-12 16:15:27 +00001/// Copyright (c) 2020 ARM Limited.
Ryan OSheaf3a43232020-02-12 16:15:27 +00002///
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
25namespace armnn{
26/** @mainpage Introduction
27
28@tableofcontents
29@section S0_1_armnn ArmNN
30
31Arm 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
33There 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
35There 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
37There 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
39There 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
41There is a guide for backend development <a href="backends.xhtml">here</a>.
42<br/><br/><br/><br/>
43
44@section S1_license License
45
46Arm NN is provided under the [MIT](https://spdx.org/licenses/MIT.html) license.
47
48__**MIT License**__
49
50Copyright (c) 2017-2020 ARM Limited.
51
52Permission is hereby granted, free of charge, to any person obtaining a copy
53of this software and associated documentation files (the "Software"), to deal
54in the Software without restriction, including without limitation the rights
55to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
56copies of the Software, and to permit persons to whom the Software is
57furnished to do so, subject to the following conditions:
58
59The above copyright notice and this permission notice shall be included in all
60copies or substantial portions of the Software.
61
62THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
63IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
64FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
65AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
66LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
67OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
68SOFTWARE.
69
70
71Individual files contain the following tag instead of the full license text.
72
73 SPDX-License-Identifier: MIT
74
75This 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
80The 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
84Before 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
86To 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
88Signed-off-by: John Doe <john.doe@example.org>
89
90You must use your real name, no pseudonyms or anonymous contributions are accepted.
91
92@subsection S2_2_releases Releases
93
94Official 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
98The 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
102Contributions 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
103credentials.
104
105Only reviewed contributions can go to the master branch of Arm NN.
106
107@subsection S2_5_continuous_integration Continuous Integration
108
109Contributions 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
113We 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
126Arm 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
133Arm 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
135The 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
137The 'armnn/samples' directory contains SimpleSample.cpp, a very basic example of the ArmNN SDK API in use.
138
139The '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
141The '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
143The '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.
144Static 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>
163These are step by step instructions for using the Android NDK to build ArmNN.
164They have been tested on a clean install of Ubuntu 18.04, and should also work with other OS versions.
165The instructions show how to build the ArmNN core library and the optional TensorFlow parser.
166All 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.
James Ward590f3f72020-12-02 10:20:48 +0000179 wget https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip
180 unzip android-ndk-r20b-linux-x86_64.zip
181 export NDK=~/armnn-devenv/toolchains/android-ndk-r20b
Ryan OSheaf3a43232020-02-12 16:15:27 +0000182
183~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184
James Ward590f3f72020-12-02 10:20:48 +0000185 You may want to append `export NDK=~/armnn-devenv/toolchains/android-ndk-r20b` to your `~/.bashrc` (or `~/.bash_profile` in Mac OS).
Ryan OSheaf3a43232020-02-12 16:15:27 +0000186
187## <a name="buildBoost">Build the Boost C++ libraries</a>
188
189### Download Boost version 1.64:
190
James Ward590f3f72020-12-02 10:20:48 +0000191#### <b>Note:</b> as of ArmNN version 20.11, Boost is no longer required to build the core ArmNN code. Boost is, however, still required to build the unit tests.
192
Ryan OSheaf3a43232020-02-12 16:15:27 +0000193~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
194 mkdir ~/armnn-devenv/boost
195 cd ~/armnn-devenv/boost
196 wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2
197 tar xvf boost_1_64_0.tar.bz2
198
199~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
200
201### Build:
202
203 (Requires gcc if not previously installed: `sudo apt install gcc`)
204~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
205
206 echo "using gcc : arm : aarch64-linux-android-clang++ ;" > $HOME/armnn-devenv/boost/user-config.jam
207 cd ~/armnn-devenv/boost/boost_1_64_0
208 ./bootstrap.sh --prefix=$HOME/armnn-devenv/boost/install
209 ./b2 install --user-config=$HOME/armnn-devenv/boost/user-config.jam \
210 toolset=gcc-arm link=static cxxflags=-fPIC --with-filesystem \
211 --with-test --with-log --with-program_options -j16
212
213~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
214
215## <a name="buildCL">Build the Compute Library</a>
216
217### Clone the Compute Library:
218
219 (Requires Git if not previously installed: `sudo apt install git`)
220
221~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
222
223 cd ~/armnn-devenv
224 git clone https://github.com/ARM-software/ComputeLibrary.git
225
226~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227
228### Build:
229
230 (Requires SCons if not previously installed: `sudo apt install scons`)
231~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
232
233 cd ComputeLibrary
234 scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" \
235 benchmark_tests=0 validation_tests=0 os=android -j16
236
237~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
238
239## <a name="buildProtobuf">Build Google's Protobuf library</a>
240
241### Clone protobuf:
242
243~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
244
James Ward590f3f72020-12-02 10:20:48 +0000245 mkdir -p ~/armnn-devenv/google
Ryan OSheaf3a43232020-02-12 16:15:27 +0000246 cd ~/armnn-devenv/google
247 git clone https://github.com/google/protobuf.git
248 cd protobuf
James Ward590f3f72020-12-02 10:20:48 +0000249 git checkout -b v3.12.0 v3.12.0
Ryan OSheaf3a43232020-02-12 16:15:27 +0000250
251~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
252
253### Build a native (x86) version of the protobuf libraries and compiler (protoc):
254
255 (Requires cUrl, autoconf, llibtool, and other build dependencies if not previously installed: `sudo apt install curl autoconf libtool build-essential g++`)
256
257~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
258
259 ./autogen.sh
260 mkdir x86_build
261 cd x86_build
262 ../configure --prefix=$HOME/armnn-devenv/google/x86_pb_install
263 make install -j16
264 cd ..
265
266~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
267
268### Build the arm64 version of the protobuf libraries:
269
270~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
271
272 mkdir arm64_build
273 cd arm64_build
274 CC=aarch64-linux-android-clang \
275 CXX=aarch64-linux-android-clang++ \
276 CFLAGS="-fPIE -fPIC" LDFLAGS="-pie -llog" \
277 ../configure --host=aarch64-linux-android \
278 --prefix=$HOME/armnn-devenv/google/arm64_pb_install \
279 --with-protoc=$HOME/armnn-devenv/google/x86_pb_install/bin/protoc
280 make install -j16
281 cd ..
282
283~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
284
285## <a name="downloadTF">Download TensorFlow</a>
286### Clone TensorFlow source code:
287
288~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
289
290 cd ~/armnn-devenv/google/
291 git clone https://github.com/tensorflow/tensorflow.git
292 cd tensorflow/
James Ward590f3f72020-12-02 10:20:48 +0000293 git checkout fcc4b966f1265f466e82617020af93670141b009 # Tensorflow version 2.3.1
Ryan OSheaf3a43232020-02-12 16:15:27 +0000294
295~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
296
Ryan OSheaf3a43232020-02-12 16:15:27 +0000297## <a name="buildArmNN">Build ArmNN</a>
298
299### Clone ArmNN source code:
300
301~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
302
303 cd ~/armnn-devenv/
304 git clone https://github.com/ARM-software/armnn.git
305
306~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
307
308### Generate TensorFlow protobuf definitions:
309
310~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
311
312 cd ~/armnn-devenv/google/tensorflow
313 ~/armnn-devenv/armnn/scripts/generate_tensorflow_protobuf.sh \
314 $HOME/armnn-devenv/google/tf_pb $HOME/armnn-devenv/google/x86_pb_install
315
316~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
317
318### Build ArmNN:
319
320 (Requires CMake if not previously installed: `sudo apt install cmake`)
321
James Ward590f3f72020-12-02 10:20:48 +0000322 <b>Note: </b> please specify the ANDROID_API version.
323 e.g. for version 27 `export ANDROID_API=27`
324
Ryan OSheaf3a43232020-02-12 16:15:27 +0000325~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
326
327 mkdir ~/armnn-devenv/armnn/build
328 cd ~/armnn-devenv/armnn/build
James Ward590f3f72020-12-02 10:20:48 +0000329 CXX=aarch64-linux-android${ANDROID_API}-clang++ \
330 CC=aarch64-linux-android${ANDROID_API}-clang \
Ryan OSheaf3a43232020-02-12 16:15:27 +0000331 CXX_FLAGS="-fPIE -fPIC" \
332 cmake .. \
James Ward590f3f72020-12-02 10:20:48 +0000333 -DCMAKE_ANDROID_NDK=$NDK \
Ryan OSheaf3a43232020-02-12 16:15:27 +0000334 -DCMAKE_SYSTEM_NAME=Android \
James Ward590f3f72020-12-02 10:20:48 +0000335 -DCMAKE_SYSTEM_VERSION=$ANDROID_API \
Ryan OSheaf3a43232020-02-12 16:15:27 +0000336 -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
James Ward590f3f72020-12-02 10:20:48 +0000337 -DCMAKE_SYSROOT=$HOME/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/sysroot \
338 -DCMAKE_EXE_LINKER_FLAGS="-pie -llog -lz" \
Ryan OSheaf3a43232020-02-12 16:15:27 +0000339 -DARMCOMPUTE_ROOT=$HOME/armnn-devenv/ComputeLibrary/ \
340 -DARMCOMPUTE_BUILD_DIR=$HOME/armnn-devenv/ComputeLibrary/build \
341 -DBOOST_ROOT=$HOME/armnn-devenv/boost/install/ \
342 -DARMCOMPUTENEON=1 -DARMCOMPUTECL=1 -DARMNNREF=1 \
343 -DTF_GENERATED_SOURCES=$HOME/armnn-devenv/google/tf_pb/ -DBUILD_TF_PARSER=1 \
344 -DPROTOBUF_ROOT=$HOME/armnn-devenv/google/arm64_pb_install/
James Ward590f3f72020-12-02 10:20:48 +0000345 make -j16
Ryan OSheaf3a43232020-02-12 16:15:27 +0000346
347~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
348
349## <a name="runArmNNUnitTests">Run the ArmNN unit tests on an Android device</a>
350
351
352### Push the build results to an Android device and make symbolic links for shared libraries:
353 Currently adb version we have used for testing is 1.0.41.
354
355~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
356
357 adb push libarmnnTfParser.so /data/local/tmp/
358 adb push libarmnn.so /data/local/tmp/
359 adb push UnitTests /data/local/tmp/
360 adb push $NDK/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so /data/local/tmp/
James Ward590f3f72020-12-02 10:20:48 +0000361 adb push $HOME/armnn-devenv/google/arm64_pb_install/lib/libprotobuf.so /data/local/tmp/libprotobuf.so.3.12.0.0
362 adb shell 'ln -s libprotobuf.so.23.0.0 /data/local/tmp/libprotobuf.so.23'
363 adb shell 'ln -s libprotobuf.so.23.0.0 /data/local/tmp/libprotobuf.so'
Ryan OSheaf3a43232020-02-12 16:15:27 +0000364
365~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
366
367### Push the files needed for the unit tests (they are a mix of files, directories and symbolic links):
368
369~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
370
371 adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/testSharedObject
372 adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/testSharedObject/* /data/local/tmp/src/backends/backendsCommon/test/testSharedObject/
373
374 adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/testDynamicBackend
375 adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/testDynamicBackend/* /data/local/tmp/src/backends/backendsCommon/test/testDynamicBackend/
376
377 adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath1
378 adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath1/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath1/
379
380 adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2
381 adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath2/Arm_CpuAcc_backend.so /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/
382 adb shell ln -s Arm_CpuAcc_backend.so /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/Arm_CpuAcc_backend.so.1
383 adb shell ln -s Arm_CpuAcc_backend.so.1 /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/Arm_CpuAcc_backend.so.1.2
384 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
385 adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath2/Arm_GpuAcc_backend.so /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/
386 adb shell ln -s nothing /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath2/Arm_no_backend.so
387
388 adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath3
389
390 adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath5
391 adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath5/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath5/
392
393 adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath6
394 adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath6/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath6/
395
396 adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath7
397
398 adb shell mkdir -p /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath9
399 adb push -p ~/armnn-devenv/armnn/build/src/backends/backendsCommon/test/backendsTestPath9/* /data/local/tmp/src/backends/backendsCommon/test/backendsTestPath9/
400
401 adb shell mkdir -p /data/local/tmp/src/backends/dynamic/reference
402 adb push -p ~/armnn-devenv/armnn/build/src/backends/dynamic/reference/Arm_CpuRef_backend.so /data/local/tmp/src/backends/dynamic/reference/
403
404~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
405
406### Run ArmNN unit tests:
407
408~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
409
410 adb shell 'LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/UnitTests'
411
412~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
413
414 If libarmnnUtils.a is present in `~/armnn-devenv/armnn/build/` and the unit tests run without failure then the build was successful.
415<br/><br/><br/><br/>
416
417@subsection S3_2_cross_compilations_build_guide Cross Compilation Build Guide
418
419<ul>
420 <li> [Introduction](#introduction) </li>
421 <li> [Cross-compiling ToolChain](#installCCT) </li>
422 <li> [Build and install Google's Protobuf library](#buildProtobuf) </li>
423 <li> [Build Caffe for x86_64](#buildCaffe) </li>
424 <li> [Build Boost library for arm64](#installBaarch) </li>
425 <li> [Build Compute Library](#buildCL) </li>
426 <li> [Build ArmNN](#buildANN) </li>
427 <li> [Run Unit Tests](#unittests) </li>
428 <li> [Troubleshooting and Errors](#troubleshooting) </li>
429</ul>
430
431
432## <a name="introduction">Introduction</a>
433These 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.
434The instructions show how to build the ArmNN core library and the Boost, Protobuf, Caffe and Compute Libraries necessary for compilation.
435
436## <a name="installCCT">Cross-compiling ToolChain</a>
437
438### Install the standard cross-compilation libraries for arm64:
439
440~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
441
442 sudo apt install crossbuild-essential-arm64
443
444~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
445
446## <a name="buildProtobuf">Build and install Google's Protobuf library</a>
447
James Ward590f3f72020-12-02 10:20:48 +0000448### Get protobuf-all-3.12.0.tar.gz from [here](https://github.com/protocolbuffers/protobuf/releases/tag/v3.12.0).
Ryan OSheaf3a43232020-02-12 16:15:27 +0000449
450### Extract:
451
452~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
453
James Ward590f3f72020-12-02 10:20:48 +0000454 tar -zxvf protobuf-all-3.12.0.tar.gz
455 cd protobuf-3.12.0
Ryan OSheaf3a43232020-02-12 16:15:27 +0000456
457~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
458
459### Build a native (x86_64) version of the protobuf libraries and compiler (protoc):
460 (Requires cUrl, autoconf, llibtool, and other build dependencies if not previously installed: sudo apt install curl autoconf libtool build-essential g++)
461
462~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
463
464 mkdir x86_64_build
465 cd x86_64_build
466 ../configure --prefix=$HOME/armnn-devenv/google/x86_64_pb_install
467 make install -j16
468 cd ..
469
470~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
471
472### Build the arm64 version of the protobuf libraries:
473
474~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
475
476 mkdir arm64_build
477 cd arm64_build
478 CC=aarch64-linux-gnu-gcc \
479 CXX=aarch64-linux-gnu-g++ \
480 ../configure --host=aarch64-linux \
481 --prefix=$HOME/armnn-devenv/google/arm64_pb_install \
482 --with-protoc=$HOME/armnn-devenv/google/x86_64_pb_install/bin/protoc
483 make install -j16
484 cd ..
485
486~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
487
488## <a name="buildCaffe">Build Caffe for x86_64</a>
489
490### Ubuntu 16.04 installation. These steps are taken from the full Caffe installation documentation [here](http://caffe.berkeleyvision.org/install_apt.html)
491
492### Install dependencies:
493
494~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
495
496 sudo apt-get install libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev
497 sudo apt-get install --no-install-recommends libboost-all-dev
498 sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
499 sudo apt-get install libopenblas-dev
500 sudo apt-get install libatlas-base-dev
501
502~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
503
504### Download Caffe-Master from [here](https://github.com/BVLC/caffe).
505
506~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
507
508 git clone https://github.com/BVLC/caffe.git
509 cd caffe
510 cp Makefile.config.example Makefile.config
511
512~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
513
514### Adjust Makefile.config as necessary for your environment, for example:
515
516~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
517
518 #CPU only version:
519 CPU_ONLY := 1
520
521 #Add hdf5 and protobuf include and library directories (Replace $HOME with explicit /home/username dir):
522 INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/ $HOME/armnn-devenv/google/x86_64_pb_install/include/
523 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/
524
525~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
526
527### Setup environment:
528
529~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
530
531 export PATH=$HOME/armnn-devenv/google/x86_64_pb_install/bin/:$PATH
532 export LD_LIBRARY_PATH=$HOME/armnn-devenv/google/x86_64_pb_install/lib/:$LD_LIBRARY_PATH
533
534~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
535
536### Compilation with Make:
537
538~~~~~~~~~~~~~~~~.sh
539
540 make all
541 make test
542 make runtest
543
544~~~~~~~~~~~~~~~~
545
546 These should all run without errors
547### caffe.pb.h and caffe.pb.cc will be needed when building ArmNN's Caffe Parser
548
549## <a name="installBaarch">Build Boost library for arm64</a>
550
551### Build Boost library for arm64
552 Download Boost version 1.64 from [here](http://www.boost.org/doc/libs/1_64_0/more/getting_started/unix-variants.html).
553 Using any version of Boost greater than 1.64 will fail to build ArmNN, due to different dependency issues.
554
555~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
556 tar -zxvf boost_1_64_0.tar.gz
557 cd boost_1_64_0
558 echo "using gcc : arm : aarch64-linux-gnu-g++ ;" > user_config.jam
559 ./bootstrap.sh --prefix=$HOME/armnn-devenv/boost_arm64_install
560 ./b2 install toolset=gcc-arm link=static cxxflags=-fPIC --with-filesystem --with-test --with-log --with-program_options -j32 --user-config=user_config.jam
561
562~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
563
564## <a name="buildCL">Build Compute Library</a>
565
566### Building the Arm Compute Library:
567
568~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
569
570 git clone https://github.com/ARM-software/ComputeLibrary.git
571 cd ComputeLibrary/
572 scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" -j8 internal_only=0
573
574~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
575
576## <a name="buildANN">Build ArmNN</a>
577
578### Compile ArmNN for arm64:
579
580~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
581
582 git clone https://github.com/ARM-software/armnn.git
583 cd armnn
584 mkdir build
585 cd build
586
587~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
588
589### 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:
590
591~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
592
593 #!/bin/bash
594 CXX=aarch64-linux-gnu-g++ \
595 CC=aarch64-linux-gnu-gcc \
596 cmake .. \
597 -DARMCOMPUTE_ROOT=$HOME/armnn-devenv/ComputeLibrary \
598 -DARMCOMPUTE_BUILD_DIR=$HOME/armnn-devenv/ComputeLibrary/build/ \
599 -DBOOST_ROOT=$HOME/armnn-devenv/boost_arm64_install/ \
600 -DARMCOMPUTENEON=1 -DARMCOMPUTECL=1 -DARMNNREF=1 \
601 -DCAFFE_GENERATED_SOURCES=$HOME/armnn-devenv/caffe/build/src \
602 -DBUILD_CAFFE_PARSER=1 \
603 -DPROTOBUF_ROOT=$HOME/armnn-devenv/google/x86_64_pb_install/ \
James Ward590f3f72020-12-02 10:20:48 +0000604 -DPROTOBUF_LIBRARY_DEBUG=$HOME/armnn-devenv/google/arm64_pb_install/lib/libprotobuf.so.23.0.0 \
605 -DPROTOBUF_LIBRARY_RELEASE=$HOME/armnn-devenv/google/arm64_pb_install/lib/libprotobuf.so.23.0.0
Ryan OSheaf3a43232020-02-12 16:15:27 +0000606
607~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
608
609### Run the build
610
611~~~~~~~~~~~~~.sh
612
613 make -j32
614
615~~~~~~~~~~~~~
616
617## <a name="unittests">Run Unit Tests</a>
618
619### Copy the build folder to an arm64 linux machine
620
James Ward590f3f72020-12-02 10:20:48 +0000621### Copy the libprotobuf.so.23.0.0 library file to the build folder
Ryan OSheaf3a43232020-02-12 16:15:27 +0000622
623### cd to the build folder on your arm64 machine and set your LD_LIBRARY_PATH to its current location:
624
625~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
626
627 cd build/
628 export LD_LIBRARY_PATH=`pwd`
629
630~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
631
James Ward590f3f72020-12-02 10:20:48 +0000632### Create a symbolic link to libprotobuf.so.23.0.0:
Ryan OSheaf3a43232020-02-12 16:15:27 +0000633
634~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
635
James Ward590f3f72020-12-02 10:20:48 +0000636 ln -s libprotobuf.so.23.0.0 ./libprotobuf.so.23
Ryan OSheaf3a43232020-02-12 16:15:27 +0000637
638~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
639
640### Run the UnitTests:
641
642~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
643
644 ./UnitTests
645 Running 567 test cases...
646
647 *** No errors detected
648
649~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
650
651## <a name="troubleshooting">Troubleshooting and Errors:</a>
652## Error adding symbols: File in wrong format
653
654### When building armNN:
655
656~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
657
658 /usr/local/lib/libboost_log.a: error adding symbols: File in wrong format
659 collect2: error: ld returned 1 exit status
660 CMakeFiles/armnn.dir/build.make:4028: recipe for target 'libarmnn.so' failed
661 make[2]: *** [libarmnn.so] Error 1
662 CMakeFiles/Makefile2:105: recipe for target 'CMakeFiles/armnn.dir/all' failed
663 make[1]: *** [CMakeFiles/armnn.dir/all] Error 2
664 Makefile:127: recipe for target 'all' failed
665 make: *** [all] Error 2
666
667~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
668
669### Boost libraries are not compiled for the correct architecture, try recompiling for arm64
670
671## Virtual memory exhausted
672### When compiling the boost libraries:
673
674~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
675
676 virtual memory exhausted: Cannot allocate memory
677
678~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
679
680### Not enough memory available to compile. Increase the amount of RAM or swap space available.
681
682
683## Unrecognized command line option '-m64'
684
685### When compiling the boost libraries:
686
687~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
688
689 aarch64-linux-gnu-g++: error: unrecognized command line option ‘-m64’
690
691~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
692
693### Clean the boost library directory before trying to build with a different architecture:
694
695~~~~~~~~~~~~~~~~~~~.sh
696
697 sudo ./b2 clean
698
699~~~~~~~~~~~~~~~~~~~
700
701### It should show the following for arm64:
702
703~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
704
705 - 32-bit : no
706 - 64-bit : yes
707 - arm : yes
708
709~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
710
711
712## Missing libz.so.1
713
714### When compiling armNN:
715
716~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
717
James Ward590f3f72020-12-02 10:20:48 +0000718 /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)
Ryan OSheaf3a43232020-02-12 16:15:27 +0000719
720~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
721
722### Missing arm64 libraries for libz.so.1, these can be added by adding a second architecture to dpkg and explicitly installing them:
723
724~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
725
726 sudo dpkg --add-architecture arm64
727 sudo apt-get install zlib1g:arm64
728 sudo apt-get update
729 sudo ldconfig
730
731~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
732
733### If apt-get update returns 404 errors for arm64 repos refer to section 5 below.
734
735### 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)
736
737~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
738
739 sudo dpkg -i zlib1g_1.2.8.dfsg-2ubuntu4_arm64.deb
740
741~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
742
743## Unable to install arm64 packages after adding arm64 architecture
744
745### 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:
746
747### From stackoverflow [here](https://askubuntu.com/questions/430705/how-to-use-apt-get-to-download-multi-arch-library/430718).
748
749### Open /etc/apt/sources.list with your preferred text editor.
750
751### Mark all the current (default) repos as \[arch=<current_os_arch>], e.g.
752
753~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
754
755 deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ xenial main restricted
756
757~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
758
759### Then add the following:
760
761~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
762
763 deb [arch=arm64] http://ports.ubuntu.com/ xenial main restricted
764 deb [arch=arm64] http://ports.ubuntu.com/ xenial-updates main restricted
765 deb [arch=arm64] http://ports.ubuntu.com/ xenial universe
766 deb [arch=arm64] http://ports.ubuntu.com/ xenial-updates universe
767 deb [arch=arm64] http://ports.ubuntu.com/ xenial multiverse
768 deb [arch=arm64] http://ports.ubuntu.com/ xenial-updates multiverse
769 deb [arch=arm64] http://ports.ubuntu.com/ xenial-backports main restricted universe multiverse
770
771~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
772
773### Update and install again:
774
775~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
776
777 sudo apt-get install zlib1g:arm64
778 sudo apt-get update
779 sudo ldconfig
780
781~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
782
783## Undefined references to google::protobuf:: functions
784
785### When compiling armNN there are multiple errors of the following type:
786 ```
787 libarmnnCaffeParser.so: undefined reference to `google::protobuf:*
788 ```
789### Missing or out of date protobuf compilation libraries.
790 Use the command 'protoc --version' to check which version of protobuf is available (version 3.5.1 is required).
791 Follow the instructions above to install protobuf 3.5.1
792 Note this will require you to recompile Caffe for x86_64
793
794## Errors on strict-aliasing rules when compiling the Compute Library
795
796### When compiling the Compute Library there are multiple errors on strict-aliasing rules:
797
798~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
799
800 cc1plus: error: unrecognized command line option ‘-Wno-implicit-fallthrough’ [-Werror]
801
802~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
803
804### Add Werror=0 to the scons command:
805
806~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.sh
807
808 scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" -j8 internal_only=0 Werror=0
809
810~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
811
812**/
813}
Ryan OShea2bbfaa72020-02-12 16:15:27 +0000814