Hi,
Do you try to use cross-compiling as lissyx states or native gcc compilation as I did?.
It would be nice to know where exactly are you stuck.
The cross-compilation is a better and simpler idea, but anyway I can give you more detailed instructions:
-
Deploy a JESSIE Debian OS distribution in the SD card, you need gcc 4.8 so DO NOT USE STRETCH Debian.
http://dlcdnet.asus.com/pub/ASUS/mb/Linux/Tinker_Board_2GB/20170330-tinker-board-linaro-jessie-alip-v16.zip
WARNING1: be careful with the system date-time in the AsusTK, configure it correctly before continuing
WARNING2: Do NOT execute “sudo apt upgrade”, the libnettle6 will be installed and some transference tools will stop working
#install some prerequisites
sudo apt-get install apt-utils
sudo apt-get update
sudo apt-get install -y pkg-config
sudo apt-get install -y autoconf automake libtool gcc-4.8 g+±4.8
sudo apt-get install -y swig build-essential libssl-dev libffi-dev libgmp3-dev
sudo apt-get install -y openjdk-8-jdk libeigen3-dev
sudo apt-get install -y curl git wget gawk zip zlib1g-dev unzip
sudo apt-get install -y sox libsox-dev
- Create swap area inserting a pendrive with 3Gb or more of free space
sudo blkid #get device, p.e. /dev/sda1
sudo umount /dev/sda1
sudo mkswap /dev/sda1 #get UUIDcode
sudo vi /etc/fstab #insert a new line:
UUID=UUIDcode none swap sw,pri=5 0 0
sudo swapon -a
- Follow Tensorflow instructions to compile natively IN the AsusTK card
git clone https://github.com/mozilla/tensorflow
cd tensorflow
vi ./tensorflow/contrib/makefile/tf_op_files.txt
#add these libraries to get compiled too for DeepSpeech
tensorflow/core/ops/bitwise_ops.cc
tensorflow/core/ops/lookup_ops.cc
./tensorflow/contrib/makefile/download_dependencies.sh
#protobuf compilation
cd tensorflow/contrib/makefile/downloads/protobuf/
./autogen.sh
./configure
make
sudo make install
sudo ldconfig # refresh shared library cache
cd -
#nsync environment and compilation (NOTE1)
export HOST_NSYNC_LIB=tensorflow/contrib/makefile/compile_nsync.sh
export TARGET_NSYNC_LIB="$HOST_NSYNC_LIB"
#tensorflow itself
make -j4 -f tensorflow/contrib/makefile/Makefile HOST_OS=PI TARGET=PI ANDROID_TYPES=-D__ANDROID_TYPES_FULL__
OPTFLAGS="-Os -mfpu=neon-vfpv4 -funsafe-math-optimizations -ftree-vectorize" CXX=g+±4.8
#(wait for 1-2 hours)
#at the end you get the tensorflow objects here,
tensorflow/contrib/makefile/downloads
tensorflow/contrib/makefile/gen
#including the tensorflow.a library with ALL the libraries you need
tensorflow/contrib/makefile/gen/lib/libtensorflow-core.a
#do the symlink as instructed by Mozilla team
ln -s …/DeepSpeech/native_client ./
cd …
- Finally DeepSpeech
git clone https://github.com/mozilla/DeepSpeech
cd DeepSpeech
#Now you have to manually modify the original Mozilla Makefile to add TF libraries and includes to the compilation of deepspeech native client binary, there are many ways to do it.
#add these include paths (if I miss any, the compilation will fail and the error will guide you)
TFDIR ?= $(abspath $(MAKEFILE_DIR)/../../tensorflow)
${TFDIR}/tensorflow/contrib/makefile/downloads
${TFDIR}/tensorflow/contrib/makefile/downloads/eigen
${TFDIR}/tensorflow/contrib/makefile/downloads/gemmlowp
${TFDIR}/tensorflow/contrib/makefile/downloads/nsync/public
${TFDIR}/tensorflow/contrib/makefile/downloads/fft2d
${TFDIR}/tensorflow/contrib/makefile/gen/proto
${TFDIR}/tensorflow/contrib/makefile/gen/host_obj
${TFDIR}/tensorflow/contrib/makefile/gen/protobuf-host/include
#add these extra library paths, this is only an example you can do it your way:
TF_GENDIR := ${TFDIR}/tensorflow/contrib/makefile/gen
TF_LIBPATH := ${TFDIR}/native_client/gen/lib
TF_NSYNCPATH := ${TFDIR}/$(dir ${TARGET_NSYNC_LIB})
#in the compilation line:
-L$(TF_NSYNCPATH) -L$(TF_LIBPATH) -L$(MAKEFILE_DIR)
#add these libraries to deepspeech binary in the compilation line as well:
-lnsync -lstdc++ -lprotobuf -lz -lm -ldl -lpthread -llibtensorflow-core
#Then execute the compilation + link
make
And then you will get the deepspeech binary, as well as generate_trie and the .so libraries.
WARNING1: be careful having the paths correctly set where the libraries are placed, you can use symbolic links or real paths, as your usually do with your compilations
WARNING2: before making DeepSpeech be sure that the NSYNC environment is properly set in the same terminal (look at (NOTE1))
WARNING3: the libtensorflow-core.a is a HUGE lib and will make a maybe too big binary, you can link with required individual .o files at ensorflow/contrib/makefile/gen instead, to get a smaller deepspeech bin
Thats all, I hope it helps.
Mar