Search code examples
c++cmaketflite

Installation TensorFlow lite with cmake crashing


I am trying to install TensorFlow Lite on my Linux machine (Ubuntu 20.04.6 LTS). My aim is to use TFlite in a C++ environment for inference. It should run in combination with OpenCV using Visual Studio code IDE. C++ and OpenCV are working but until now I have troubles installing TFlite.

According to the documentation, the following steps are needed for cmake ( https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/examples/minimal ):

  1. Install cmake tool,
  2. Install libffi7 package,
  3. Clone the TensorFlow repo,
  4. Create Cmake build directory and run Cmake tool,
  5. Build TensorFlow Lite using cmake --build . -j.

This all works fine until step5 cmake --build . -j . This runs until 90% where it crashes and I cannot do anything anymore (the screen freezes).

enter image description here

I checked the Linux system but did not find any suspicious errors in /var/log/kern.log or /var/log/dmesg file.

Any suggestions would be very appreciated !


Solution

  • The -j flag indicates how many jobs run when compiling with cmake. If unspecified, it will use as many as possible. Try changing cmake --build . -j to cmake --build . -j1 which will run a single job. It will take longer but much less likely to overwhelm your computer. After that you can experiment with cmake --build . -j<n> where <n> is the number of jobs you run.