The following dependencies are needed to compile/build/run.
- gcc/g++
- gstreamer 1.0 and its relatives
- glib 2.0
- meson >= 0.50
The nnstreamer releases are at a PPA repository. In order to install it, use:
$ sudo apt-add-repository ppa:nnstreamer
$ sudo apt install nnstreamer
Use the nnstreamer PPA to resolve additional build-dependencies (tensorflow/tensorflow-lite).
Install build tools if needed:
$ sudo apt install pbuilder debootstrap devscripts
The following example configuration is for Ubuntu 16.04:
$ cat ~/.pbuilderrc
DISTRIBUTION=xenial
COMPONENTS="main restricted universe multiverse"
OTHERMIRROR="deb http://archive.ubuntu.com/ubuntu xenial main restricted universe multiverse |\
deb http://archive.ubuntu.com/ubuntu xenial-security main restricted universe multiverse |\
deb http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse |\
deb [trusted=yes] http://ppa.launchpad.net/nnstreamer/ppa/ubuntu xenial main"
$ sudo ln -s ~/.pbuilderrc /root/.pbuilderrc
$ sudo pbuilder create
Run pdebuild to build and get the package.
$ pdebuild
$ ls -al /var/cache/pbuilder/result/*.deb
Refer to PbuilderHowto for more about pdebuild.
Approach 1. Build with Debian/Ubuntu tools
Clone the needed repositories
$ git clone https://github.com/myungjoo/SSAT ssat
$ git clone https://git.tizen.org/cgit/platform/upstream/tensorflow
$ git clone https://github.com/nnsuite/nnstreamer
Alternatively, you may simply download binary packages from PPA (ssat and tensorflow):
$ sudo apt-add-repository ppa:nnstreamer
$ sudo apt install ssat tensorflow-dev tensorflow-lite-dev libprotobuf-dev
Fix tensorflow for it to build properly
You may skip this if you have downloaded binary packages from PPA.
There is a shell script call at tensorflow/contrib/lite/Makefile that may fail, depending on the shell you're using. The best is to replace the ARCH detection macro (it is named renamed to HOST_ARCH on tensorflow upstream) from:
ARCH := $(shell if [[ $(shell uname -m) =~ i[345678]86 ]]; then echo x86_32; else echo $(shell uname -m); fi)
to:
ARCH := $(shell uname -m | sed -e 's/i[3-8]86/x86_32/')
Build .deb packages
Installing required dependencies:
$ for i in ssat tensorflow nnstreamer; do \
(cd $i && sudo mk-build-deps --install debian/control && sudo dpkg -i *.deb || break); \
done
Creating the .deb packages:
$ export DEB_BUILD_OPTIONS="parallel=$(($(cat /proc/cpuinfo |grep processor|wc -l) + 1))"
$ for i in ssat tensorflow nnstreamer; do \
(cd $i && time debuild -us -uc || break); \
done
If there is a missing package, debuild will tell you which package is missing.
If you haven't configured debuild properly, yet, you will need to add -uc -us
options to debuild
.
Install the generated *.deb files
The files will be there at the parent dir. E. g. at nnbuilder/.. directory.
In order to install them (should run as root):
$ sudo apt install ./ssat_*.deb ./tensorflow-lite-dev_*.deb ./tensorflow-dev_*.deb
$ sudo apt install ./nnstreamer_0.1.0-1rc1_amd64.deb
If you need nnstreamer development package:
#apt install ./nnstreamer-dev_0.1.0-1rc1_amd64.deb
Approach 2. Build with meson
Install the required packages.
$ sudo apt install meson ninja-build
Build at the git repo root directory, this will install nnstreamer plugins and related files.
$ meson build
$ ninja -C build install
- Installed nnstreamer plugins to
{prefix}/{libdir}/gstreamer-1.0
- Installed subplugins and libraries to
{prefix}/{libdir}
- Installed common header files to
{prefix}/{includedir}
First install the required packages.
$ sudo apt install gbs
Generates .rpm packages:
$ gbs build
gbs build
will execute unit testing as well unlike cmake build.