2

ok, this problem has been faced several times, but I'm not able to solve it in this circumstances. Few days ago I upgraded my mac to Yosemite. Before that, the project started without problems! (I mean, with Mavericks OS) The Mac is a Pro Retina 13.3" of the last year.

I'm implementing a face recognizer in Java, so I need the APIs by OpenCV and the wrappers by Javacv (I'm using 0.9 version). Following the instructions by Javacv/Javacpp developers, I just linked into my eclipse/java project: javacv.jar, javacpp.jar and opencv-macosx-x86_64.jar. Eclipse says me that everything is fine, but when I try to make it run, I get:

Init, please wait...
Creating detector...
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Users/*/Desktop/javacv-bin/opencv-macosx-x86_64/org/bytedeco/javacpp/macosx-x86_64/libjniopencv_core.dylib: dlopen(/Users/*/Desktop/javacv-bin/opencv-macosx-x86_64/org/bytedeco/javacpp/macosx-x86_64/libjniopencv_core.dylib, 1): Library not loaded: @rpath/libopencv_core.2.4.dylib
  Referenced from: /Users/*/Desktop/javacv-bin/opencv-macosx-x86_64/org/bytedeco/javacpp/macosx-x86_64/libjniopencv_core.dylib
  Reason: no suitable image found.  Did find:
    /Users/*/Desktop/javacv-bin/opencv-macosx-x86_64/org/bytedeco/javacpp/macosx-x86_64/./libopencv_core.2.4.dylib: malformed mach-o image: load command #12 length (0) too small in /Users/*/Desktop/javacv-bin/opencv-macosx-x86_64/org/bytedeco/javacpp/macosx-x86_64/./libopencv_core.2.4.dylib
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1119)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535)
    at org.bytedeco.javacpp.Loader.load(Loader.java:410)
    at org.bytedeco.javacpp.Loader.load(Loader.java:353)
    at org.bytedeco.javacpp.opencv_core.<clinit>(opencv_core.java:10)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:340)
    at org.bytedeco.javacpp.Loader.load(Loader.java:385)
    at org.bytedeco.javacpp.Loader.load(Loader.java:353)
    at org.bytedeco.javacpp.opencv_objdetect$CascadeClassifier.<clinit>(opencv_objdetect.java:618)
    at javacvOpenCvCaptureFrames.Detector.<init>(Detector.java:22)
    at javacvOpenCvCaptureFrames.CaptureFrame.main(CaptureFrame.java:52)
Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/1h/39dk7v3n4ng0phg9ldwnccsh0000gn/T/javacpp8317818567016/libjniopencv_core.dylib: dlopen(/private/var/folders/1h/39dk7v3n4ng0phg9ldwnccsh0000gn/T/javacpp8317818567016/libjniopencv_core.dylib, 1): Library not loaded: @rpath/libopencv_core.2.4.dylib
  Referenced from: /private/var/folders/1h/39dk7v3n4ng0phg9ldwnccsh0000gn/T/javacpp8317818567016/libjniopencv_core.dylib
  Reason: no suitable image found.  Did find:
    /private/var/folders/1h/39dk7v3n4ng0phg9ldwnccsh0000gn/T/javacpp8317818567016/./libopencv_core.2.4.dylib: malformed mach-o image: load command #12 length (0) too small in /private/var/folders/1h/39dk7v3n4ng0phg9ldwnccsh0000gn/T/javacpp8317818567016/./libopencv_core.2.4.dylib
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1814)
    at java.lang.Runtime.load0(Runtime.java:809)
    at java.lang.System.load(System.java:1083)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:524)
    ... 10 more

what sounds strange to me is "malformed mach-o image: load command #12 length (0) too small in" .... what does it mean? I've redownloaded javacv packages several times, but it's always the same story.

Any help will be useful, thank you!

Kevin :)

Kevin
  • 31
  • 1
  • 4
  • The opencv libraries that are present in the 0.9 binary images are broken/malformed. It may not have broken on mavericks, but I have no system to check it on. I rebuilt opencv manually, and repackaged the jar with the rebuilt dylibs and it *seems* to work; but I may be missing something. – Anya Shenanigans Nov 08 '14 at 19:21
  • 1
    Mr Samuel Audet (creator and developer of javacv/javacpp) rebuild packages and, at least for me, they work well now! – Kevin Nov 09 '14 at 14:37
  • Good to know that it was a temporary aberration in the available packages. – Anya Shenanigans Nov 09 '14 at 14:39
  • @Kevin Where can we get the rebuilt packages? – ABT Nov 25 '14 at 16:42
  • 1
    sorry for delay here: https://oss.sonatype.org/content/repositories/snapshots/org/bytedeco/javacpp-presets/ – Kevin Nov 25 '14 at 18:21
  • Sorry to bother, but I can't get it to work at all. I unzipped the javacv 0.9.1 snapshot and also downloaded the ffmpeg and opencv mac jars from the javacpp snapshots and added them all to my build path. I keep on getting: java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.avutil. I even tried adding the other mac jars from the original javacv installation (version 0.9) to the path (such as artoolkitplus-macosx-x86_64.jar) and still nothing. I also tried using Maven project and adding the dependencies from the snapshot repositories. any suggestions/hints? – ABT Nov 28 '14 at 12:37

0 Answers0