Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
WyntersN opened this issue Jan 5, 2022 · 27 comments

Comments

@WyntersN
Copy link

WyntersN commented Jan 5, 2022

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)
@ZhouShiJun5
Copy link

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

@Jiang1145141919810
Copy link

Same issue, but run on Windows10. Please help.

@NicolasGB
Copy link

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.

@paradox-lab
Copy link

Same issue, Win11

@ConnorMoodyDev
Copy link

Same issue, Ubuntu 18.04 LTS

@k0eff
Copy link

k0eff commented Jun 12, 2022

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

@sovanna
Copy link

sovanna commented Aug 31, 2022

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

@k0eff
Copy link

k0eff commented Aug 31, 2022 via email

@otiai10
Copy link
Owner

otiai10 commented Aug 31, 2022

LD_LIBRARY_PATH ?

@sovanna
Copy link

sovanna commented Aug 31, 2022

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

@micolore
Copy link

micolore commented Sep 6, 2022

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

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

@MuhammadHasbiAshshiddieqy
Copy link

MuhammadHasbiAshshiddieqy commented Sep 16, 2022

@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

@zidianlyu
Copy link

zidianlyu commented Dec 13, 2022

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.

@otiai10
Copy link
Owner

otiai10 commented Dec 13, 2022

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

@zidianlyu
Copy link

Sure, I create a new issue here: #263

@qomaindo-dev
Copy link

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

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

It works, thanks

@dickreuter
Copy link

Any solution this problem?

@ariqRam
Copy link

ariqRam commented Aug 30, 2023

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)

@dr-sharon
Copy link

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'

@s3f4
Copy link

s3f4 commented Sep 5, 2023

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
Copy link

s3f4 commented Sep 5, 2023

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

@dr-sharon
Copy link

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

Thank you

@s3f4
Copy link

s3f4 commented Sep 7, 2023

@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.

@yunsteel
Copy link

@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

Thanks!

@k0eff
Copy link

k0eff commented Jun 21, 2024 via email

@pp-X
Copy link

pp-X commented Jul 22, 2024

win 怎么搞

@cplasfwst
Copy link

同问win怎样处理

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests