gosseract: tessbridge.cpp:5:10: fatal error: leptonica/allheaders.h: No such file or directory

This text is generated based on ISSUE_TEMPLATE.md. The issue reporter must read and remove this block before submitting.

Summary

>go get  github.com/otiai10/gosseract/v2
# github.com/otiai10/gosseract/v2
tessbridge.cpp:5:10: fatal error: leptonica/allheaders.h: No such file or directory
 #include <leptonica/allheaders.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

uname -a

win11

go env

set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\wynte\AppData\Local\go-build
set GOENV=C:\Users\wynte\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=F:\Users\Wynters\GO\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=F:\Users\Wynters\GO
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=D:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.17
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=F:\Users\Wynters\GO\src\test\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\wynte\AppData\Local\Temp\go-build2624276161=/tmp/go-build -gno-record-gcc-switches

go version

go version go1.17 windows/amd64

tesseract --version

tesseract : 无法将“tesseract”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。

gcc -v

Using built-in specs.
COLLECT_GCC=D:\Program Files\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=D:/Program\ Files/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-posix-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: posix
gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 23 (2 by maintainers)

Most upvoted comments

@sovanna @k0eff @otiai10

OS Monterey 12.4 (M1)

go version go1.18.1 darwin/arm64

Install with brew install tesseract tesseract 5.2.0 leptonica-1.82.0

I got same issue and fix it with this :

export LIBRARY_PATH="/opt/homebrew/lib" export CPATH="/opt/homebrew/include"

It works for me, maybe it can also help you. Thanks

Same issue, but run on Ubuntu 20.04. Please help.

try this command $ sudo apt install libtesseract-dev i’am ok

I can confirm the same issue on MacOS Monterey 12.1 Leptonica and Tesseract have been installed with brew and PATH has been modified to include Leptonica’s dir: /opt/homebrew/Cellar/leptonica/1.82.0/include

However PATH seems to be ignored by tessbridge.cpp

Same issue, but run on Ubuntu 20.04. Please help.

try this command $ sudo apt install libtesseract-dev i’am ok

It works, thanks

I found the solution, remove leptonica and tesseract and build from below commands wget http://www.leptonica.org/source/leptonica-1.78.0.tar.gz tar -xzvf leptonica-1.78.0.tar.gz cd leptonica-1.78.0 ./configure make && make install

git clone https://github.com/tesseract-ocr/tesseract.git cd tesseract ./autogen.sh ./configure make sudo make install

@zidianlyu can you please create a new issue because it’s related to GCP specifically?