# 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:
#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
• 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

edit retag close merge delete

Sort by » oldest newest most voted

Hi !

I experienced the same problem and it seems the tesseract package is broken a little so its include dir is just not added to system include.

And if you sure the package is installed it is just necessary to check the path to its include and allow make to find it.

In my case the path is:

/usr/local/Cellar/tesseract/4.0.0_1/include


So I added it like this:

CXXFLAGS=-isystem\ /usr/local/Cellar/tesseract/4.0.0_1/include cmake <ALL_CMAKE_ARGS_HERE>


Another method is:

cmake -DCMAKE_CXX_FLAGS=-isystem\ /usr/local/Cellar/tesseract/4.0.0_1/include <OTHER_CMAKE_ARGS_HERE>


Hope it helps.

more

Official site

GitHub

Wiki

Documentation