opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.2k stars 5.74k forks source link

Opencv3.2 text module build failed in macOS10.12 #920

Open logic1988 opened 7 years ago

logic1988 commented 7 years ago

I have encountered the following problems: /Users/logic/Desktop/opencv_contrib/modules/text/src/precomp.hpp:51:10: 'tesseract/baseapi.h' file not found The cmake file seems no path configuration for tesseract. Manually add tesseract search path, the problem solved.

alalek commented 7 years ago

Please add failed command line. For "makefile" generator you can use make VERBOSE=1 command.

karterotte commented 7 years ago

I tried to build opencv on my mac(sierra:10.12) the cmaker command like this:

cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D OPENCV_EXTRA_MODULES_PATH=/Users/.../opencv_contrib/modules \ -D PYTHON2_LIBRARY=/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib \ -D PYTHON2_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/2.7/lib \ -D PYTHON2_EXECUTABLE=$VIRTUAL_ENV/bin/python \ -D BUILD_opencv_python2=ON \ -D BUILD_opencv_python3=OFF \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D INSTALL_C_EXAMPLES=OFF \ -D BUILD_EXAMPLES=ON ..

and when i tried make -j4 ,it would report this error when the process scrolled to [62%]

In file included from /Users/.../opencv_contrib/modules/text/src/ocr_beamsearch_decoder.cpp:43: /Users/.../opencv_contrib/modules/text/src/precomp.hpp:51:10: fatal error: 'tesseract/baseapi.h' file not found

both opencv and opencv_contrib(7238cd2) are master branch

this is my tesseract version:

tesseract 3.04.01 leptonica-1.74 libjpeg 8d : libpng 1.6.27 : libtiff 4.0.7 : zlib 1.2.8

alalek commented 7 years ago

@karterotte Try to add -DENABLE_PRECOMPILED_HEADERS=OFF CMake option. Or disable "text" module via -DBUILD_opencv_text=OFF.

karterotte commented 7 years ago

thanks. It works!

timotheecour commented 6 years ago

@alalek adding -DENABLE_PRECOMPILED_HEADERS=OFF didn't work -DBUILD_opencv_text=OFF did work but obviously not a good solution

malasang commented 5 years ago

@karterotte Try to add -DENABLE_PRECOMPILED_HEADERS=OFF CMake option. Or disable test module via -DBUILD_opencv_text=OFF.

set opencv_text off,thx

wu-yy commented 5 years ago

also, I add -DENABLE_PRECOMPILED_HEADERS=OFF \ -DBUILD_opencv_text=OFF when cmake. It works!

miteshparmar1 commented 5 years ago

Did the above:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
    -D PYTHON3_LIBRARY=`python -c 'import subprocess ; import sys ; s = subprocess.check_output("python-config --configdir", shell=True).decode("utf-8").strip() ; (M, m) = sys.version_info[:2] ; print("{}/libpython{}.{}.dylib".format(s, M, m))'` \
    -D PYTHON3_INCLUDE_DIR=`python -c 'import distutils.sysconfig as s; print(s.get_python_inc())'` \
    -D PYTHON3_EXECUTABLE=$VIRTUAL_ENV/bin/python \
    -D BUILD_opencv_python2=OFF \
    -D BUILD_opencv_python3=ON \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D INSTALL_C_EXAMPLES=OFF \
    -D OPENCV_ENABLE_NONFREE=ON \
    -D BUILD_EXAMPLES=ON \
    -D ENABLE_PRECOMPILED_HEADERS=OFF \
    -D BUILD_opencv_text=OFF ..

But now fails at 86%: [ 86%] Linking CXX executable ../../bin/example_tutorial_core_various [ 86%] Built target example_tutorial_core_various make: *** [all] Error 2

native-api commented 5 years ago

As per https://github.com/opencv/opencv_contrib/pull/2056#issuecomment-476005674, this turned out to have already been fixed in master and 3.4. So this issue can be closed.