Code Monkey home page Code Monkey logo

Comments (3)

axi92 avatar axi92 commented on July 19, 2024

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:)
grafik

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.

rockage avatar rockage commented on July 19, 2024

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.

stevevls avatar stevevls commented on July 19, 2024

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.

  1. Edit this line to read -lleptonica and then set the environment variables as suggested in #234
  2. 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.