cmakedebiantesseractvcpkgleptonica

How to install leptonica 1.85 in Debian 12


Tried to use https://github.com/Sicos1977/TesseractOCR Nuget package in Debian 12. It looks that it requires new version of leptonica libleptonica-1.85.0.dll.so which is not avaliable in Debian:

#apt install liblept5
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
liblept5 is already the newest version (1.82.0-3+b3).

Installing leptonica using instructions from

https://github.com/danbloomberg/leptonica

apt install git gcc
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh # "./bootstrap-vcpkg.bat" for powershell
./vcpkg integrate install
./vcpkg install leptonica

Throws error

error: vcpkg was unable to detect the active compiler's information.

gcc is installed:

#gcc --version
gcc (Debian 12.2.0-14+deb12u1) 12.2.0

How to install libleptonica-1.85 in Debian or is there other way to use Tesseract OCR in Debian?

Full output from ./vcpkg install leptonica

Computing installation plan...
The following packages will be built and installed:
  * giflib:x64-linux@5.2.2#2
    leptonica:x64-linux@1.85.0
  * libjpeg-turbo:x64-linux@3.1.0#1
  * liblzma:x64-linux@5.8.1
  * libpng:x64-linux@1.6.48
  * libwebp[core,libwebpmux,nearlossless,simd]:x64-linux@1.5.0#1
  * openjpeg:x64-linux@2.5.3
  * tiff[core,jpeg,lzma,zip]:x64-linux@4.7.0
  * vcpkg-cmake:x64-linux@2024-04-23
  * vcpkg-cmake-config:x64-linux@2024-05-23
  * zlib:x64-linux@1.3.1
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-linux...
error: while detecting compiler information:
The log file content at "/root/vcpkg/buildtrees/detect_compiler/stdout-x64-linux.log" is:
-- Configuring x64-linux-rel
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:127 (message):
    Command failed: /root/vcpkg/downloads/tools/cmake-3.30.1-linux/cmake-3.30.1-linux-x86_64/bin/cmake /root/vcpkg/scripts/detect_compiler -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/root/vcpkg/packages/detect_compiler_x64-linux -DVCPKG_COMPILER_CACHE_FILE=/root/vcpkg/installed/vcpkg/compiler-file-hash-cache.json -DCMAKE_MAKE_PROGRAM=/root/vcpkg/downloads/tools/ninja/1.12.1-linux/ninja -DCMAKE_SYSTEM_NAME=Linux -DBUILD_SHARED_LIBS=OFF -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/root/vcpkg/scripts/toolchains/linux.cmake -DVCPKG_TARGET_TRIPLET=x64-linux -DVCPKG_SET_CHARSET_FLAG=ON -DVCPKG_PLATFORM_TOOLSET=external -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE -DCMAKE_VERBOSE_MAKEFILE=ON -DVCPKG_APPLOCAL_DEPS=OFF -DCMAKE_TOOLCHAIN_FILE=/root/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON -DVCPKG_CXX_FLAGS= -DVCPKG_CXX_FLAGS_RELEASE= -DVCPKG_CXX_FLAGS_DEBUG= -DVCPKG_C_FLAGS= -DVCPKG_C_FLAGS_RELEASE= -DVCPKG_C_FLAGS_DEBUG= -DVCPKG_CRT_LINKAGE=dynamic -DVCPKG_LINKER_FLAGS= -DVCPKG_LINKER_FLAGS_RELEASE= -DVCPKG_LINKER_FLAGS_DEBUG= -DVCPKG_TARGET_ARCHITECTURE=x64 -DCMAKE_INSTALL_LIBDIR:STRING=lib -DCMAKE_INSTALL_BINDIR:STRING=bin -D_VCPKG_ROOT_DIR=/root/vcpkg -DZ_VCPKG_ROOT_DIR=/root/vcpkg -D_VCPKG_INSTALLED_DIR=/root/vcpkg/installed -DVCPKG_MANIFEST_INSTALL=OFF
    Working Directory: /root/vcpkg/buildtrees/detect_compiler/x64-linux-rel
    Error code: 1
    See logs for more information:
      /root/vcpkg/buildtrees/detect_compiler/config-x64-linux-rel-CMakeCache.txt.log
      /root/vcpkg/buildtrees/detect_compiler/config-x64-linux-rel-out.log
      /root/vcpkg/buildtrees/detect_compiler/config-x64-linux-rel-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_cmake.cmake:344 (vcpkg_execute_required_process)
  scripts/detect_compiler/portfile.cmake:18 (vcpkg_configure_cmake)
  scripts/ports.cmake:206 (include)


error: vcpkg was unable to detect the active compiler's information. See above for the CMake failure output.

Solution

  • Tesseract is easy to install on Debian. Just follow documentation https://tesseract-ocr.github.io/tessdoc/Installation.html or https://notesalexp.org/tesseract-ocr/.
    I doubt .NET wrapper will work on Debian (https://github.com/charlesw/tesseract/issues?q=is%3Aissue%20state%3Aopen%20linux).