Comments (3)
After I set this:
go env -w CGO_CXXFLAGS="-O2 -g -ID:\Programme\cygwin64\usr\include"
(If somebody is maybe confused whats in the include folder:)
My error was a different one:
# command-line-arguments
D:\Programme\Go\pkg\tool\windows_amd64\link.exe: running g++ failed: exit status 1
D:/Programme/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llept
D:/Programme/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ltesseract
D:/Programme/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llept
D:/Programme/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ltesseract
collect2.exe: error: ld returned 1 exit status
from gosseract.
I spent a lot of time solving this problem. I'm on the Windows platform, but I think it should be similar for other platforms.
First, I installed MSYS2 and used it to install the MinGW toolchain.
Then, I installed Leptonica using pacman. As for Tesseract, I compiled and installed it from source code.
Once I made sure both packages were installed correctly, I used the following command:
pkg-config --cflags --libs lept tesseract
If it shows:
-IC:/msys64/mingw64/include/leptonica -IC:/msys64/mingw64/include -LC:/msys64/mingw64/lib -lleptonica -ltesseract -larchive -lcurl
then everything is fine.
After that, I made modifications to otiai10's code in client.go:
/*
#cgo pkg-config: lept tesseract
#cgo CXXFLAGS: -std=c++0x
#cgo CPPFLAGS: -Wno-unused-result
#include <stdlib.h>
#include <stdbool.h>
#include "tessbridge.h"
*/
import "C"
That solved the problem.
By the way, you also need to set an environment variable TESSDATA_PREFIX to let Tesseract know where your training data is stored.
For example, mine is set to: C:\msys64\usr\local\share\tessdata.
from gosseract.
I bumped into this same issue on MacOS Ventura 13.5. It seems like that with the latest library versions installed by Homebrew ([email protected], [email protected]), one of two things need to happen in order to get this library to work.
- Edit this line to read
-lleptonica
and then set the environment variables as suggested in #234 - Use the
pkg-config
suggestion above.
The latter doesn't require any environment variables, so it seems a much more portable way to get up and running. I don't fully understand the ramifications of using pkg-config, though. If it doesn't introduce backward incompatibility, would you be open to using it?
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 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.