houqp / leptess

Productive and safe Rust binding for leptonica and tesseract
https://houqp.github.io/leptess/leptess/index.html
MIT License
258 stars 29 forks source link

Linker error on macOS #62

Open yosefahab opened 6 months ago

yosefahab commented 6 months ago

I'm having an issue including leptess (also tesseract) into a project. As soon as i include anything i get a linker error complaining about not finding the leptonica, tesseract libraries:

...
= note: ld: warning: search path '"/opt/homebrew/Cellar/leptonica/1.84.1/lib"' not found
        ld: warning: search path '/opt/homebrew/Cellar/libarchive/3.7.2/lib' not found
        ld: warning: search path '"/opt/homebrew/Cellar/tesseract/5.3.4_1/lib"' not found
        ld: library 'lept' not found
        clang: error: linker command failed with exit code 1 (use -v to see invocation)

target: macOS Sonoma v14.4.1 with clang 15.0.0. leptess = "0.14.0"

could it be related to clang version being updated? (similar to https://github.com/ccouzens/tesseract-sys/issues/6) I did clone this repo independently and it worked without any issues though.

ccouzens commented 6 months ago

Hi, sorry you're having an issue building.

To help debug, can you run:

pkg-config --libs lept
ls /opt/homebrew/Cellar/leptonica/1.84.1/lib

On my work Mac I see

-L/opt/homebrew/Cellar/leptonica/1.84.1/lib -lleptonica

and

cmake
libleptonica.6.dylib
libleptonica.a
libleptonica.dylib
pkgconfig

could it be related to clang version being updated? (similar to https://github.com/ccouzens/tesseract-sys/issues/6)

I don't think it's that precise issue, as that was worked around with this.

I did clone this repo independently and it worked without any issues though.

Is the issue only when leptess is used as a dependency? But you can run cargo test on this repository?

Thanks, Chris

yosefahab commented 6 months ago

Hello! np we can figure it out hopefully. I'm getting the exact same output as yours.

as for

Is the issue only when leptess is used as a dependency? But you can run cargo test on this repository?

To rephrase, I am unable to compile my project nor run my unit tests. i CAN however clone the leptess repository and run its test cases successfully.

Its important to mention that this is actually a new and sudden thing, however im not sure what would cause this (a version upgrade or something completely unrelated to this project)