Ubuntu系统下Bazel编译Tensorflow环境

编写此文主要为了介绍在Ubuntu16.04上搭建Tensorflow-lite编译环境,涉及目标硬件为Armv7架构,8核Cortex-A7。

1、开发环境介绍:

OS:Ubuntu16.04 64位

目标平台:Armv7

交叉工具链:gcc-linaro-arm-linux-gnueabihf-4.9-2014.9_linux

Tensorflow版本:2.0.0

2、下载Tensorflow

git clone https://github.com/tensorflow/tensorlfow.git

3、安装Bazel

打开网页,使用第一种方法:Use the binary installer

https://docs.bazel.build/versions/master/install-ubuntu.html

1) sudo apt-get install pkg-config zip g++ zlib1g-dev unzip python3

2)打开链接:https://github.com/bazelbuild/bazel/releases,下载最新sh文件:bazel-0.29.0-installer-linux-x86_64.sh

3)运行Bazel:chmod +x bazel-0.29.0-installer-linux-x86_64.sh

./bazel-0.29.0-installer-linux-x86_64.sh --user

--user flag installs bazel to the $HOME/bin directory on your system and set .bazelrc path to $HOME/.bazelrc

4)set up your environment:

export PATH="$PATH:$HOME/bin"

you can also add this command to your ~/.bashrc file.