[Bug 259930] graphics/opencv: cmake fails, if graphics/tesseract installed

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 19 Nov 2021 07:08:08 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259930

            Bug ID: 259930
           Summary: graphics/opencv: cmake fails, if graphics/tesseract
                    installed
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: rhurlin@FreeBSD.org
                CC: pkubaj@FreeBSD.org, tcberner@freebsd.org
                CC: pkubaj@FreeBSD.org, tcberner@freebsd.org

I have encountered a problem on my system that seems to be related to
graphics/opencv and graphics/tesseract.

If the system already has graphics/tesseract installed, configure does not work
for graphics/opencv: 


-----------------------------------------
CMake Error at /usr/local/cmake/TesseractConfig.cmake:24 (find_package):
  By not providing "FindLeptonica.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Leptonica", but CMake did not find one.

  Could not find a package configuration file provided by "Leptonica" with
  any of the following names:

    LeptonicaConfig.cmake
    leptonica-config.cmake

  Add the installation prefix of "Leptonica" to CMAKE_PREFIX_PATH or set
  "Leptonica_DIR" to a directory containing one of the above files.  If
  "Leptonica" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  contrib/modules/text/cmake/init.cmake:8 (find_package)
  cmake/OpenCVModule.cmake:298 (include)
  cmake/OpenCVModule.cmake:364 (_add_modules_1)
  modules/CMakeLists.txt:7 (ocv_glob_modules)

-- Configuring incomplete, errors occurred!
See also "/usr/ports/graphics/opencv/work/.build/CMakeFiles/CMakeOutput.log".
See also "/usr/ports/graphics/opencv/work/.build/CMakeFiles/CMakeError.log".
*** Error code 1
-----------------------------------------



The mentioned log file CMakeError.log contains:
-----------------------------------------
Determining if the include file sys/videoio.h exists failed with the following
output:
Change Dir: /usr/ports/graphics/opencv/work/.build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/local/bin/ninja cmTC_73ae6 && [1/2] Building C object
CMakeFiles/cmTC_73ae6.dir/CheckIncludeFile.c.o
FAILED: CMakeFiles/cmTC_73ae6.dir/CheckIncludeFile.c.o 
/usr/bin/cc   -O2 -pipe  -fstack-protector-strong -isystem /usr/local/include
-fno-strict-aliasing   -fsigned-char -W -Wall -Werror=return-type
-Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat
-Werror=format-security -Wmissing-declarations -Wmissing-prototypes
-Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo
-Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor
-Wno-unnamed-type-template-args -Wno-comment
-Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion
-fdiagnostics-show-option -Wno-long-long -pthread -Qunused-arguments
-ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden
-fvisibility-inlines-hidden  -O2 -pipe  -fstack-protector-strong -isystem
/usr/local/include -fno-strict-aliasing  -DNDEBUG -fPIE -MD -MT
CMakeFiles/cmTC_73ae6.dir/CheckIncludeFile.c.o -MF
CMakeFiles/cmTC_73ae6.dir/CheckIncludeFile.c.o.d -o
CMakeFiles/cmTC_73ae6.dir/CheckIncludeFile.c.o -c
/usr/ports/graphics/opencv/work/.build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/usr/ports/graphics/opencv/work/.build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10:
fatal error: 'sys/videoio.h' file not found
#include <sys/videoio.h>
         ^~~~~~~~~~~~~~~
1 error generated.

ninja: build stopped: subcommand failed.
-----------------------------------------



OpenCV seems to use an internal tesseract if no external one is found on the
system. Once tesseract is present, the file FindLeptonica.cmake is also needed,
but it is not installed by graphics/leptonica, graphics/tesseract or
graphics/opencv.

This all seems to have become a problem only since graphics/tesseract switched
from autoconf to cmake [1]

[1]
https://cgit.freebsd.org/ports/commit/?id=3f1cf94980fdec66bdb115c46c94635ec3b54572


You can easily reproduce the erroneous behavior in Poudriere by temporarily
defining the following dependency in the graphics/opencv Makefile and then
building it:

LIB_DEPENDS+=libtesseract.so:graphics/tesseract

-- 
You are receiving this mail because:
You are the assignee for the bug.