Javacpp: liblept.4.dylib library not loaded

2.4k views Asked by At

On my 64 bit Mac OSX Trying to use a native C++ library from a java project just as described in this link:

https://github.com/bytedeco/javacpp-presets/tree/master/tesseract

But I get this error when I run the example, library liblept.4.dylib is not loaded, and I have no idea what to do.

java.lang.UnsatisfiedLinkError: no jnilept in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)

Caused by:java.lang.UnsatisfiedLinkError:/private/var/folders/h8/wpw5p9196v1dz0hcy_s66_5w0000gn/T/javacpp21146551279247/libjnilept.dylib: dlopen(/private/var/folders/h8/wpw5p9196v1dz0hcy_s66_5w0000gn/T/javacpp21146551279247/libjnilept.dylib, 1): Library not loaded: /Users/saudet/projects/bytedeco/javacpp-presets/leptonica/cppbuild/macosx-x86_64/lib/liblept.4.dylib
Referenced from: /private/var/folders/h8/wpw5p9196v1dz0hcy_s66_5w0000gn/T/javacpp21146551279247/libjnilept.dylib

UPDATE: I tried to install tesseract and leptonica libraries via mac ports, this error has disappered but a new error came "java failed to write core dump, problematic frame leptonica..etc"

So I removed all installed libraries again returned back to same error

1

There are 1 answers

5
Samuel Audet On BEST ANSWER

That's an issue that's been fixed: https://github.com/bytedeco/javacpp-presets/issues/46 Not released yet though, but it's easy enough to compile from source. First, get the latest source code for both JavaCPP and the JavaCPP Presets from GitHub, then run mvn install under javacpp, and then, under javacpp-presets, execute bash cppbuild.sh install leptonica tesseract before calling mvn install -pl .,leptonica,tesseract.