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

ld: library not found for -llept #248

Closed
thynquest opened this issue May 27, 2022 · 5 comments
Closed

ld: library not found for -llept #248

thynquest opened this issue May 27, 2022 · 5 comments

Comments

@thynquest
Copy link

Hello there

I am trying to install gosseract on a macbook m1 but I have the following error with lept library
ld: library not found for -llept
clang: error: linker command failed with exit code 1 (use -v to see invocation)

and this is the command line I use
LD_LIBRARY_PATH="-L/opt/homebrew/Cellar/leptonica/1.82.0/lib" CGO_CXXFLAGS="-I/opt/homebrew/Cellar/leptonica/1.82.0/include/ -I/opt/homebrew/Cellar/tesseract/5.1.0/include" go get -t github.com/otiai10/gosseract/v2

but despite my effort I do not see what is wrong here

Environment

go version

go version go1.17 darwin/arm64

tesseract --version
tesseract 5.1.0
 leptonica-1.82.0
  libgif 5.2.1 : libjpeg 9e : libpng 1.6.37 : libtiff 4.3.0 : zlib 1.2.11 : libwebp 1.2.2 : libopenjp2 2.4.0
 Found NEON
 Found libarchive 3.6.1 zlib/1.2.11 liblzma/5.2.5 bz2lib/1.0.8 liblz4/1.9.3 libzstd/1.5.2
 Found libcurl/7.79.1 SecureTransport (LibreSSL/3.3.6) zlib/1.2.11 nghttp2/1.45.1

thank you for you help.

@TuringZhu
Copy link

the same to above

$ uname -a 
Darwin xxxx.local 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:24 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T8101 arm64
$ go version
go version go1.17.3 darwin/arm64
$ cat ~/.bash_profile
# lib path
hombrew_path=/usr/local/apps/homebrew/Cellar
export DYLD_LIBRARY_PATH=${hombrew_path}/leptonica/1.82.0/lib/:${hombrew_path}/tesseract/5.1.0/lib/
export C_INCLUDE_PATH=${hombrew_path}/leptonica/1.82.0/include/:${hombrew_path}/tesseract/5.1.0/include/
export CPLUS_INCLUDE_PATH=${hombrew_path}/leptonica/1.82.0/include:${hombrew_path}/tesseract/5.1.0/include/
export LIBRARY_PATH=${hombrew_path}/leptonica/1.82.0/lib/:${hombrew_path}/tesseract/5.1.0/lib/
export LD_LIBRARY_PATH=${hombrew_path}/leptonica/1.82.0/lib/:${hombrew_path}/tesseract/5.1.0/lib/

$ go get -u github.com/otiai10/gosseract/v2
ld: library not found for -llept
clang: error: linker command failed with exit code 1 (use -v to see invocation)
 

@licolas94
Copy link

Hello there

I am trying to install gosseract on a macbook m1 but I have the following error with lept library ld: library not found for -llept clang: error: linker command failed with exit code 1 (use -v to see invocation)

and this is the command line I use LD_LIBRARY_PATH="-L/opt/homebrew/Cellar/leptonica/1.82.0/lib" CGO_CXXFLAGS="-I/opt/homebrew/Cellar/leptonica/1.82.0/include/ -I/opt/homebrew/Cellar/tesseract/5.1.0/include" go get -t github.com/otiai10/gosseract/v2

but despite my effort I do not see what is wrong here

Environment

go version

go version go1.17 darwin/arm64

tesseract --version
tesseract 5.1.0
 leptonica-1.82.0
  libgif 5.2.1 : libjpeg 9e : libpng 1.6.37 : libtiff 4.3.0 : zlib 1.2.11 : libwebp 1.2.2 : libopenjp2 2.4.0
 Found NEON
 Found libarchive 3.6.1 zlib/1.2.11 liblzma/5.2.5 bz2lib/1.0.8 liblz4/1.9.3 libzstd/1.5.2
 Found libcurl/7.79.1 SecureTransport (LibreSSL/3.3.6) zlib/1.2.11 nghttp2/1.45.1

thank you for you help.

I solved this problem in this way

cd /usr/local/lib
sudo ln -s /opt/homebrew/Cellar/leptonica/1.82.0_1/lib/liblept.a ./
sudo ln -s /opt/homebrew/Cellar/leptonica/1.82.0_1/lib/liblept.5.dylib liblept.dylib

@otiai10 otiai10 closed this as completed Dec 14, 2022
@Grelo4ka
Copy link

I am also getting this error

@crikke
Copy link

crikke commented Sep 19, 2023

fixed it by removing
github.com/otiai10/gosseract
from go.mod, should only have github.com/otiai10/gosseract/v2

@DZGodly
Copy link

DZGodly commented Feb 5, 2024

I had the same problem

d@ddeMacBook-Pro ~ % go version   
go version go1.19.3 darwin/amd64
d@ddeMacBook-Pro ~ % uname -a
Darwin ddeMacBook-Pro.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:42:11 PST 2023; root:xnu-8792.81.3~2/RELEASE_X86_64 x86_64
/usr/local/go/pkg/tool/darwin_amd64/link: running clang++ failed: exit status 1
ld: library not found for -llept
clang: error: linker command failed with exit code 1 (use -v to see invocation)

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

7 participants