Search code examples
cmaketesseractleptonica

tesseract compile issue: leptonica_OUTPUT_NAME is not set


I am trying to compile the source code of Tesseract Open Source OCR Engine (https://github.com/tesseract-ocr/tesseract).

But when running cmake, I always get the following error:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: leptonica_OUTPUT_NAME linked by target "libtesseract" in directory /home/test/github/tesseract

I have already downloaded the source code of leptonica (http://www.leptonica.com/download.html) and installed it.

I am wondering which value should I set to leptonica_OUTPUT_NAME.


Solution

  • I ran into the same problem. It seems that

    find_package(PkgConfig REQUIRED)
    pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION})
    

    in CMakeLists.txt has problems finding leptonica whereas cmake's find_package just works fine:

    if(NOT EXISTS ${PROJECT_SOURCE_DIR}/.cppan)
    #    if (NOT Leptonica_DIR AND NOT MSVC)
    #        find_package(PkgConfig REQUIRED)
    #        pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION})
    #    else()
            find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED CONFIG)
    #    endif()
    else()
    

    For completeness (both compiled from sources):

    • tesseract 4.00.00alpha
    • leptonica-1.74.4