Sikuli OCR issue: cannot find liblept.5.dylib

Asked by Juliana XIAO

Hi! RaiMan
I recently updated some of our mac machines to the latest macOS Sonoma 14.0.

tesseract -v
tesseract 5.3.3
 leptonica-1.83.1
  libgif 5.2.1 : libjpeg 8d (libjpeg-turbo 3.0.0) : libpng 1.6.40 : libtiff 4.6.0 : zlib 1.2.11 : libwebp 1.3.2 : libopenjp2 2.5.0

When I try to get text from an image I got the following error:
org.sikuli.script.SikuliXception: OCR: start: Tesseract library problems: dlopen(/Users/rr_admin/Library/Caches/JNA/temp/jna16833560915096266612.tmp, 0x0009): Library not loaded: /usr/local/opt/leptonica/lib/liblept.5.dylib
  Referenced from: <0D1357B6-77AE-3076-A5C0-4C0F365DB8DE> /Users/rr_admin/Library/Caches/JNA/temp/jna16833560915096266612.tmp
  Reason: tried: '/usr/local/opt/leptonica/lib/liblept.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/leptonica/lib/liblept.5.dylib' (no such file), '/usr/local/opt/leptonica/lib/liblept.5.dylib' (no such file), '/usr/lib/liblept.5.dylib' (no such file, not in dyld cache), '/usr/local/Cellar/leptonica/1.83.1/lib/liblept.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/leptonica/1.83.1/lib/liblept.5.dylib' (no such file), '/usr/local/Cellar/leptonica/1.83.1/lib/liblept.5.dylib' (no such file), '/usr/lib/liblept.5.dylib' (no such file, not in dyld cache)

I found the library directory is actually : /usr/local/Cellar/leptonica/1.83.1/lib/libleptonica.6.dylib

****************************************************************************************************
I have an older working mac machine with macOS Big Sur 11.2.3

tesseract -v
tesseract 4.1.1
 leptonica-1.80.0
  libgif 5.2.1 : libjpeg 9d : libpng 1.6.37 : libtiff 4.3.0 : zlib 1.2.11 : libwebp 1.2.0 : libopenjp2 2.4.0

It does have the directory: /usr/local/Cellar/leptonica/1.80.0/lib/liblept.5.dylib

****************************************************************************************************

My question is: how can I solve the problem on newer operating system for mac machine? should I downgrade leptonica?
Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Juliana XIAO
Solved:
Last query:
Last reply:
Revision history for this message
Asif Khan (asifkhan07) said :
#1

To resolve the OCR issue on your newer macOS Sonoma 14.0 machine with Sikuli, consider creating a symlink to the libleptonica.6.dylib file, name it liblept.5.dylib, or set the DYLD_LIBRARY_PATH environment variable to point to the directory containing the required library. Be cautious about downgrading, as it may introduce new issues. Seek advice on Sikuli forums for specific solutions.

Revision history for this message
Juliana XIAO (juliana-x) said :
#2

Hi! Asif,

Thanks for those suggestions, I tried to use DYLD_LIBRARY_PATH environment variable but it did not work.
But the following action did the trick:
I made a copy of the following 3 files under the same directory:
/usr/local/Cellar/leptonica/1.83.1/lib/libleptonica.6.dylib
/usr/local/Cellar/leptonica/1.83.1/lib/libleptonica.a
/usr/local/Cellar/leptonica/1.83.1/lib/libleptonica.dylib

and then renamed the copied ones to the following 3 file names:
/usr/local/Cellar/leptonica/1.83.1/lib/liblept.5.dylib
/usr/local/Cellar/leptonica/1.83.1/lib/liblept.a
/usr/local/Cellar/leptonica/1.83.1/lib/liblept.dylib

and now it is working fine.

Thanks,
Juliana