gosseract icon indicating copy to clipboard operation
gosseract copied to clipboard

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

Open WyntersN opened this issue 3 years ago • 12 comments

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)

WyntersN avatar Jan 05 '22 12:01 WyntersN

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

ZhouShiJun5 avatar Feb 23 '22 06:02 ZhouShiJun5

Same issue, but run on Windows10. Please help.

Jiang1145141919810 avatar Apr 04 '22 09:04 Jiang1145141919810

Same issue, on windows 10. Followed the instructions, calling and using tesseract via cli works just fine, but can't seem to build my program.

On arch-linux it worked fine after installing tesseract via pacman.

NicolasGB avatar Apr 21 '22 18:04 NicolasGB

Same issue, Win11

paradox-lab avatar May 16 '22 16:05 paradox-lab

Same issue, Ubuntu 18.04 LTS

ConnorMoodyDev avatar Jun 06 '22 18:06 ConnorMoodyDev

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

k0eff avatar Jun 12 '22 21:06 k0eff

Hello @k0eff did you find a solution, I have the same thing with MacOS Monterey 12.5.1 on M1

sovanna avatar Aug 31 '22 12:08 sovanna

Unfortunately no, it was a research project and I just abandoned it ... Tried a lot of things, like sym linking from various files/paths but it still failed. Would love to hear from the gosseract team...

On Wed, Aug 31, 2022, 15:48 Sovanna @.***> wrote:

Hello @k0eff https://github.com/k0eff did you find a solution, I have the same thing with MacOS Monterey 12.5.1 on M1

— Reply to this email directly, view it on GitHub https://github.com/otiai10/gosseract/issues/234#issuecomment-1232893740, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJRGYDPYQ2B7SYJLDX6LDKDV35IA3ANCNFSM5LJZOBIA . You are receiving this because you were mentioned.Message ID: @.***>

k0eff avatar Aug 31 '22 13:08 k0eff

LD_LIBRARY_PATH ?

otiai10 avatar Aug 31 '22 14:08 otiai10

I've added /opt/homebrew/Cellar/leptonica/1.82.0_1/include in PATH and even /opt/homebrew/Cellar/leptonica/1.82.0_1/include in LD_LIBRARY_PATH

but it didn't work

sovanna avatar Aug 31 '22 16:08 sovanna

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

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

micolore avatar Sep 06 '22 14:09 micolore

@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

Any chances that we can have a fixed lib and get rid of the issue without the need from brew install?

I am trying to deploy a demo on GCP App Engine. I can make it works locally, but cannot deploy to cloud. Any suggestions?

ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build xxx status: FAILURE

#github.com/otiai10/gosseract tessbridge.cpp:5:10: fatal error: tesseract/baseapi.h: No such file or directory #include <tesseract/baseapi.h> ^~~~~~~~~~~~~~~~~~~~~ compilation terminated.

zidianlyu avatar Dec 13 '22 08:12 zidianlyu

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

otiai10 avatar Dec 13 '22 09:12 otiai10

Sure, I create a new issue here: https://github.com/otiai10/gosseract/issues/263

zidianlyu avatar Dec 13 '22 11:12 zidianlyu

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

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

It works, thanks

qomaindo-dev avatar Jan 23 '23 15:01 qomaindo-dev

Any solution this problem?

dickreuter avatar Mar 26 '23 23:03 dickreuter

This brought me to a different error message instead:

/opt/homebrew/Cellar/go/1.21.0/libexec/pkg/tool/darwin_arm64/link: running c++ failed: exit status 1
ld: library not found for -llept
clang: error: linker command failed with exit code 1 (use -v to see invocation)

ariqRam avatar Aug 30 '23 10:08 ariqRam

Hey ,

I have the same issue: github.com/otiai10/gosseract/v2 tessbridge.cpp:5:10: fatal error: 'leptonica/allheaders.h' file not found

go version go version go1.21.0 darwin/amd64

go env

GO111MODULE='auto' GOARCH='amd64' GOBIN='' GOCACHE='/Users/kong/Library/Caches/go-build' GOENV='/Users/kong/Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='darwin' GOINSECURE='' GOMODCACHE='/Users/kong/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/Users/kong/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/local/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/local/go/pkg/tool/darwin_amd64' GOVCS='' GOVERSION='go1.21.0' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='clang' CXX='clang++' CGO_ENABLED='1' GOMOD='/Users/kong/repositories/projects/testocr/go.mod' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/x1/3_w5bjps145btsd2t3s25gf80000gn/T/go-build2258385787=/tmp/go-build -gno-record-gcc-switches -fno-common'

dr-sharon avatar Sep 05 '23 12:09 dr-sharon

This brought me to a different error message instead:

/opt/homebrew/Cellar/go/1.21.0/libexec/pkg/tool/darwin_arm64/link: running c++ failed: exit status 1
ld: library not found for -llept
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I got the same error, could you find a solution?

s3f4 avatar Sep 05 '23 19:09 s3f4

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

s3f4 avatar Sep 05 '23 21:09 s3f4

@s3f4 Can you please provide the procedure to remove leptonica and tesseract ?

Thank you

dr-sharon avatar Sep 05 '23 23:09 dr-sharon

@s3f4 Can you please provide the procedure to remove leptonica and tesseract ?

Thank you

Hi @dr-sharon I had installed these via brew package manager on Macosx and uninstalled with brew uninstall command.

s3f4 avatar Sep 07 '23 21:09 s3f4