Building on Windows Systems

Linux is the main development environment recommended ("Windows Subsystem for Linux" can be used for a full Linux Bash environment under Windows), especially with regards to building the TensorFlow Lite for Microcontrollers (TFLu) library, which depends on GNU Make and are using a number of Bash shell scripts. However, there are a number of possibilities for building on a Windows system.

Requirements

  • CMake. E.g. Windows native CMake, MSYS CMake, Cygwin CMake, or MinGW CMake. (Note: Supported generators may differ).
  • make tool. E.g. GNU Make, NMAKE, Jom, mingw32-make, GNU Make under MSYS or Cygwin.
  • ARM toolchain. Arm Clang or GNU Arm Embedded Toolchain

Building with TensorFlow Lite for Microcontrollers

  • Shell. E.g. "MSYS shell", "GIT Bash", or "Cygwin Terminal"
  • GNU Make. (NOTE: required when building TFLu even if another generator is used in CMake).
  • GNU Wget.

Using a prebuilt TensorFlow Lite for Microcontrollers library

A prebuilt TFLu library can be supplied via the variable TFLU_PREBUILT_LIBRARY_PATH. The project can then be built without the requirements under Building with TensorFlow Lite for Microcontrollers (apart from the initially build of the library).

Troubleshooting

There are many options for tools and environment to build in, and the behaviour in each specific development environment might differ slightly.

  • Cross drive locations might not work. If this is the case mount to a usable path in the shell used.
  • There might be issues with NSYS/CMake and some toolchain paths, i.e. 'Program Files (x86)'. Can be solved by mounting in MSYS to a usable path, or the native Windows CMake can be called from the MSYS shell.
  • GNU Wget is needed for downloads in TFLu.
  • There might be issues rebuilding with CMake 3.20, with erroneous dependency make files generated. Update to CMake 3.20.1, or downgrade to an earlier CMake version.
  • May need to unset TMPDIR environmental variable to get FlatBuffers download in TFLu to work.
  • When using Cygwin Terminal there might be error messages concerning '\r' in the TFLu Bash scripts. In this case run dos2unix on these scripts.