Comments (11)
@ketutgunawan thanks for reporting.
as I answered in #45 (comment)
I guess I could simulate and reproduce your problem, also fixed it. I wish it can help you. I'm waiting for your comment.
http://otiai10.hatenablog.com/entry/2016/10/28/062712
Reproduce the issue
try to install Golang itself
[root@2bc64375ee2c /]# yum search go | grep golang
[root@2bc64375ee2c /]# yum install -y golang
[root@2bc64375ee2c /]# go version
go version go1.6.3 linux/amd64
# successfully
try to get gosseract
[root@2bc64375ee2c /]# go get github.com/otiai10/gosseract
package github.com/otiai10/gosseract: cannot download, $GOPATH not set. For more details see: go help gopath
OK, set $GOPATH
[root@2bc64375ee2c /]# export GOPATH=/
[root@2bc64375ee2c /]# go get github.com/otiai10/gosseract
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/otiai10/gosseract: exec: "git": executable file not found in $PATH
OK, install git
[root@2bc64375ee2c /]# yum install -y git
[root@2bc64375ee2c /]# go get github.com/otiai10/gosseract
go build github.com/otiai10/gosseract/tesseract: g++: exec: "g++": executable file not found in $PATH
OK, install g++
[root@2bc64375ee2c /]# yum install -y gcc-c++
[root@2bc64375ee2c /]# go get github.com/otiai10/gosseract
# github.com/otiai10/gosseract/tesseract
src/github.com/otiai10/gosseract/tesseract/tess.cpp:1:31: fatal error: tesseract/baseapi.h: No such file or directory
#include <tesseract/baseapi.h>
^
compilation terminated.
[root@2bc64375ee2c /]#
OK, the problem is reproduced now
Solution
Install tesseract-ocr
.
for preparation
[root@2bc64375ee2c /]# yum install -y autoconf automake libtool
[root@2bc64375ee2c /]# yum install -y libjpeg-devel libpng-devel libtiff-devel zlib-devel
[root@2bc64375ee2c /]# wget http://www.leptonica.org/source/leptonica-1.72.tar.gz
bash: wget: command not found
[root@2bc64375ee2c /]# yum install -y wget
install leptonica
[root@2bc64375ee2c /]# wget http://www.leptonica.org/source/leptonica-1.72.tar.gz
[root@2bc64375ee2c /]# tar -xzvf leptonica-1.72.tar.gz
[root@2bc64375ee2c /]# cd leptonica-1.72
[root@2bc64375ee2c leptonica-1.72]# ./configure
[root@2bc64375ee2c leptonica-1.72]# make
[root@2bc64375ee2c leptonica-1.72]# make install
# ...
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR`
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH` environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH` environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR` linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf`
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
# ...
[root@2bc64375ee2c leptonica-1.72]#
[root@2bc64375ee2c leptonica-1.72]# cd ..
install tesseract
[root@2bc64375ee2c /]# wget https://github.com/tesseract-ocr/tesseract/archive/3.02.02.tar.gz
[root@2bc64375ee2c /]# tar -xzvf 3.02.02.tar.gz
[root@2bc64375ee2c /]# cd tesseract-3.02.02/
[root@2bc64375ee2c tesseract-3.02.02]# ./autogen.sh
[root@2bc64375ee2c tesseract-3.02.02]# ./configure
[root@2bc64375ee2c tesseract-3.02.02]# make
[root@2bc64375ee2c tesseract-3.02.02]# make install
# ...
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR`
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH` environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH` environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR` linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf`
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
# ...
[root@2bc64375ee2c tesseract-3.02.02]# tesseract --version
tesseract 3.02.02
leptonica-1.72
libjpeg 6b (libjpeg-turbo 1.2.90) : libpng 1.5.13 : libtiff 4.0.3 : zlib 1.2.7
[root@2bc64375ee2c tesseract-3.02.02]#
tesseract-ocr
is successfully installed. It's better to locate tessdata of any language, but skip now.
[root@2bc64375ee2c /]# cd $GOPATH/src/github.com/otiai10/gosseract/
[root@2bc64375ee2c gosseract]# go test
# github.com/otiai10/gosseract
all_test.go:12:2: cannot find package "github.com/otiai10/mint" in any of:
/usr/lib/golang/src/github.com/otiai10/mint (from $GOROOT)
/src/github.com/otiai10/mint (from $GOPATH)
FAIL github.com/otiai10/gosseract [setup failed]
[root@2bc64375ee2c gosseract]# go get -u github.com/otiai10/mint
[root@2bc64375ee2c gosseract]# go test
/tmp/go-build910821104/github.com/otiai10/gosseract/_test/gosseract.test: error while loading shared libraries: liblept.so.4: cannot open shared object file: No such file or directory
exit status 127
FAIL github.com/otiai10/gosseract 0.002s
[root@2bc64375ee2c gosseract]#
# OK, now facing new problem
check files in /usr/local/lib
[root@2bc64375ee2c gosseract]# ls /usr/local/lib/liblept.so.4
/usr/local/lib/liblept.so.4
# Yes, there is
need to add path to shared library
[root@2bc64375ee2c gosseract]# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
[root@2bc64375ee2c gosseract]# go test
Error opening data file /usr/local/share/tessdata/eng.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.
Failed loading language 'eng'
Tesseract could not load any languages!
Could not initialize tesseract.
exit status 1
FAIL github.com/otiai10/gosseract 0.006s
OK, it's almost there. Now we need traineddata for eng
.
[root@2bc64375ee2c gosseract]# wget https://github.com/tesseract-ocr/tessdata/raw/master/eng.traineddata
[root@2bc64375ee2c gosseract]# mv eng.traineddata /usr/local/share/tessdata/
[root@2bc64375ee2c gosseract]# go test
PASS
ok github.com/otiai10/gosseract 0.278s
[root@2bc64375ee2c gosseract]#
Yay!
from gosseract.
Thanks @otiai10 now is work . *****
from gosseract.
Failing again here
wget https://github.com/tesseract-ocr/tessdata/raw/master/eng.traineddata
[root@2bc64375ee2c gosseract]# mv eng.traineddata /usr/local/share/tessdata/
[root@2bc64375ee2c gosseract]# go test
wget https://github.com/tesseract-ocr/tessdata/raw/master/eng.traineddata
[root@2bc64375ee2c gosseract]# mv eng.traineddata /usr/local/share/tessdata/
[root@2bc64375ee2c gosseract]# go test
PASS
from gosseract.
actual_tessdata_num_entries_ <= TESSDATA_NUM_ENTRIES:Error:Assert failed:in file tessdatamanager.cpp, line 50
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7f27c8243270]
runtime stack:
runtime.throw(0x51d77d, 0x2a)
/usr/lib/golang/src/runtime/panic.go:566 +0x95
runtime.sigpanic()
/usr/lib/golang/src/runtime/sigpanic_unix.go:12 +0x2cc
goroutine 7 [syscall, locked to thread]:
runtime.cgocall(0x4d8a50, 0xc420027da0, 0x0)
/usr/lib/golang/src/runtime/cgocall.go:131 +0x110 fp=0xc420027d70 sp=0xc420027d30
github.com/otiai10/gosseract._Cfunc_Init(0x24e6500, 0x0, 0x0)
github.com/otiai10/gosseract/_test/_obj_test/_cgo_gotypes.go:96 +0x45 fp=0xc420027da0 sp=0xc420027d70
github.com/otiai10/gosseract.(*Client).init(0xc420014280)
/src/github.com/otiai10/gosseract/client.go:110 +0x9f fp=0xc420027df0 sp=0xc420027da0
github.com/otiai10/gosseract.(*Client).Text(0xc420014280, 0x0, 0x0, 0x0, 0x0)
/src/github.com/otiai10/gosseract/client.go:130 +0x70 fp=0xc420027ec8 sp=0xc420027df0
github.com/otiai10/gosseract.TestClient_SetImage(0xc420072480)
/src/github.com/otiai10/gosseract/all_test.go:30 +0xd0 fp=0xc420027f88 sp=0xc420027ec8
testing.tRunner(0xc420072480, 0x525df8)
/usr/lib/golang/src/testing/testing.go:610 +0x81 fp=0xc420027fb0 sp=0xc420027f88
runtime.goexit()
/usr/lib/golang/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc420027fb8 sp=0xc420027fb0
created by testing.(*T).Run
/usr/lib/golang/src/testing/testing.go:646 +0x2ec
goroutine 1 [chan receive]:
testing.(*T).Run(0xc4200720c0, 0x518fb9, 0x13, 0x525df8, 0xc42004bd01)
/usr/lib/golang/src/testing/testing.go:647 +0x316
testing.RunTests.func1(0xc4200720c0)
/usr/lib/golang/src/testing/testing.go:793 +0x6d
testing.tRunner(0xc4200720c0, 0xc42004be20)
/usr/lib/golang/src/testing/testing.go:610 +0x81
testing.RunTests(0x525e28, 0x7939e0, 0x4, 0x4, 0xe9ebc5a)
/usr/lib/golang/src/testing/testing.go:799 +0x319
testing.(*M).Run(0xc42004bee8, 0xc42004bf08)
/usr/lib/golang/src/testing/testing.go:743 +0x85
main.main()
github.com/otiai10/gosseract/_test/_testmain.go:66 +0xc6
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/lib/golang/src/runtime/asm_amd64.s:2086 +0x1
exit status 2
FAIL github.com/otiai10/gosseract 0.007s
from gosseract.
@pratty931
Which OS are you using, what is Go version, what did you do actually?
from gosseract.
from gosseract.
https://github.com/otiai10/gosseract/blob/master/test/runtimes/tess4.00_go1.9_CentOS.Dockerfile
This document is newer. Please check it
from gosseract.
from gosseract.
what's your tesseract version
from gosseract.
@pratty931
I can reproduce it. Let's move to #97
from gosseract.
from gosseract.
Related Issues (20)
- Fail on GCP App Engine deployment HOT 6
- gosseract finds no text where tesseract does HOT 2
- Can't build app in docker(/usr/local/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1) HOT 3
- Ocr failed
- Gosseract Windows Compatibility
- leptonica allheaders.h not found HOT 3
- leptonica HOT 3
- Convert image to pdf HOT 1
- undefined: gosseract.NewClient HOT 15
- fatal error: leptonica/allheaders.h: No such file or directory HOT 2
- Fails to OCR file that CLI Tesseract handles perfectly HOT 2
- tessbridge.cpp:5:10: fatal error: 'leptonica/allheaders.h' file not found HOT 1
- `leptonica` a hundredth time! HOT 7
- does not recognize spaces as another found result
- how can i get Orientation in degrees
- Extracting text is not working correctly in v5.3.0-2 in Alpine
- Mac OS run err:ld: library not found for -lleptonica HOT 3
- build for windows arch fail HOT 1
- Linking and DLL runtime issues on Windows HOT 1
- library not found for -llept HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gosseract.