Ask Your Question

Revision history [back]

OpenCV 4 make failed - precomp.hpp:54:10: fatal error: ‘tesseract/baseapi.h’ file not found

G'day, I was following the "Install OpenCV 4 on MacOS" tutorial found at PyImageSearch. I got to the step where you "make -j4" without any errors. However, at around 55% through the build, make crashes with the following error:

make: *** [all] Error 2

I repeated the make command using the --verbose option, and was able to find a number of errors during the build that look like this:

[ 55%] Building CXX object modules/text/CMakeFiles/opencv_text.dir/src/ocr_holistic.cpp.o
In file included from /*[sanitised]*/opencv_contrib/modules/text/src/ocr_beamsearch_decoder.cpp:43:
/*[sanitised]*/opencv_contrib/modules/text/src/precomp.hpp:54:10: fatal error: 'tesseract/baseapi.h' file not found
#include <tesseract/baseapi.h>
         ^~~~~~~~~~~~~~~~~~~~~

My environment is macOS Mojave 10.14.3, python3=3.7.2, OpenCV=4.0.0 using Homebrew.

I've trawled the forums and have tried the following fixes/work arounds without success:

  • uninstall / reinstall tesseract
  • unlink / link tesseract via Homebrew
  • uninstalled tesseract and tried to make without it

I've posted on the PyImageSearch forum but havent had any luck there yet.

Any assistance would be appreciated.

Cheers