I am trying to cross-compile Tensorflow-Lite for Raspberry Pi B+. To do that, I am following these instructions from the official website, which are :
git clone https://github.com/raspberrypi/tools.git rpi_toolsgit clone https://github.com/tensorflow/tensorflow.git tensorflow_srccd tensorflow_src && ./tensorflow/lite/tools/make/download_dependencies.shPATH=../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin:$PATH \ ./tensorflow/lite/tools/make/build_rpi_lib.sh TARGET_ARCH=armv6(step 4b for armv6, which should be the architecture of Raspberry Pi B+)
I tried to cross-compile on OSX 10.13 but the first step gave some conflicts because some files differ only for capital letters, (I am guessing) due to the case insensitiveness of OSX systems:
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_connmark.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_DSCP.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_dscp.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_MARK.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_mark.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_RATEEST.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_rateest.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_TCPMSS.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter/xt_tcpmss.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter_ipv4/ipt_ECN.h'
'arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot/usr/include/linux/netfilter_ipv4/ipt_ecn.h'
In turn, when trying to run step 4, I get this error:
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/core/api/flatbuffer_conversions.o] Error 126
/bin/bash: ../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: cannot execute binary file
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/core/api/op_resolver.o] Error 126
/bin/bash: ../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: cannot execute binary file
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/core/subgraph.o] Error 126
/bin/bash: ../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: cannot execute binary file
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/core/api/tensor_utils.o] Error 126
/bin/bash: ../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: cannot execute binary file
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/core/api/error_reporter.o] Error 126
/bin/bash: ../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: cannot execute binary file
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/experimental/resource/resource_variable.o] Error 126
/bin/bash: ../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: cannot execute binary file
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/c/c_api_experimental.o] Error 126
/bin/bash: ../rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: cannot execute binary file
make: *** [/Users/fra/Documents/TFLiteComp4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/allocation.o] Error 126
I tried to compile also on Ubuntu 18.04, however the 4th step gave me errors. The error output is quite long but looks like this
/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/downloads/ruy/ruy/create_trmul_params.h: In function 'void ruy::detail::FinalizeMulParams(const ruy::MulParams<AccumScalar, DstScalar>&, ruy::ChannelDimension, ruy::Ctx*, ruy::TrMulParams*)': /home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/downloads/ruy/ruy/create_trmul_params.h:388:17: error: 'is_trivially_copyable' is not a member of 'std'
static_assert(std::is_trivially_copyable::value, ""); ^ /home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/downloads/ruy/ruy/create_trmul_params.h:388:57: error: expected primary-expression before '>' token
static_assert(std::is_trivially_copyable::value, ""); ^ /home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/downloads/ruy/ruy/create_trmul_params.h:388:58: error: '::value' has not been declared
static_assert(std::is_trivially_copyable::value, "");........................ [/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/gather.o] Error 1 tensorflow/lite/tools/make/Makefile:333: recipe for target '/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/activations.o' failed make: *** [/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/activations.o] Error 1 tensorflow/lite/tools/make/Makefile:333: recipe for target '/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/mfcc.o' failed make: *** [/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/mfcc.o] Error 1 tensorflow/lite/tools/make/Makefile:333: recipe for target '/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/cumsum.o' failed make: *** [/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/cumsum.o] Error 1 tensorflow/lite/tools/make/Makefile:333: recipe for target '/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/conv.o' failed make: *** [/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src/tensorflow/lite/tools/make/gen/rpi_armv6/obj/tensorflow/lite/kernels/conv.o] Error 1 make: Leaving directory '/home/fra/Documents/TFLiteBuild4RPi/tensorflow_src'
UPDATE
I also did docker pull tensorflow/tensorflow:latest, launch the docker image and do the same commmands but still there are errors even if the page said it was tested on that docker image.