Building a TF app with dependencies (OpenCV) for ARM target (Beaglebone Black).
- Build (cross compile) TF application using https://github.com/lhelontra/tensorflow-on-arm, using Bazel and TF binary in-source build (tf_cc_binary bazel target). It will have no dependencies, except ones added by your code (OpenCV in my case). No TF runtime needs to be installed on target device.
tensorflow-on-arm config needs changes to build your app target, instead default build-pip-package. Building apps with C API (tf_cc_binary) is described at https://www.tensorflow.org/guide/extend/cc (not available at time of this writting).
For your app Bazel BUILD script you will probably need to specify dependencies (OpenCV libs and include headers in my case), which in turn may depend on their dependencies, so I used -rpath-link option to point to target's sysroot lib folders.
- On target device install OpenCV dependencies. I built OpenCV on device (had to disable Python modules in OpenCV configuration, since BBB has 500Mb RAM