如何在Debian 12中安装Leptonica 1.85及解决vcpkg编译检测异常
问题:Debian 12中安装Leptonica 1.85或替代Tesseract OCR方案
背景
- 在Debian 12中尝试使用TesseractOCR NuGet包时,发现其依赖Leptonica 1.85版本(
libleptonica-1.85.0.dll.so),但系统apt源仅提供1.82版本:# 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).
尝试的安装方法及错误
按照Leptonica官方指引,使用vcpkg安装Leptonica,执行了以下命令:
apt install git gcc git clone https://github.com/Microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.sh # "./bootstrap-vcpkg.bat" 适用于powershell ./vcpkg integrate install ./vcpkg install leptonica
执行./vcpkg install leptonica时触发错误:
error: vcpkg was unable to detect the active compiler's information.
已确认gcc已正确安装:
# gcc --version gcc (Debian 12.2.0-14+deb12u1) 12.2.0
./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.
需求
寻求在Debian 12中安装Leptonica 1.85的可行方法,或是能替代Tesseract OCR的方案。
内容的提问来源于stack exchange,提问作者Andrus
相关产品推荐
相关产品推荐

