MiaoRong / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

Latest JavaCV does not run with MacPorts #207

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hey guys,

I have tried everything possible to solve this error, I was able to run in 
Windows x86 but I can't compile anything in my MacOSX x64.

I have installed OpenCV using Xcode and port -v opencv +python27 option all the 
linkpaths are correct. One thing that i have found different is inside the code

    public static final String genericIncludepath    = "/opt/local/include/";
    public static final String genericLinkpath       = "/opt/local/lib/:/opt/local/lib64/:/usr/local/lib/:/usr/local/lib64/";

The genericLinkpath for MacOSX does not contains lib64.

What steps will reproduce the problem?
1. Try to run HoughLines or any sample

What is the expected output? What do you see instead?

Exception in thread "main" java.lang.UnsatisfiedLinkError: 
/private/var/folders/qr/j3rwh4h15fncfqgff8__qvcw0000gn/T/libjniopencv_core261228
7037709553365.dylib:  Library not loaded: lib/libopencv_core.2.4.dylib   
Referenced from: 
/private/var/folders/qr/j3rwh4h15fncfqgff8__qvcw0000gn/T/libjniopencv_core261228
7037709553365.dylib   Reason: image not found
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
    at java.lang.Runtime.load0(Runtime.java:770)
    at java.lang.System.load(System.java:1020)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:403)
    at com.googlecode.javacpp.Loader.load(Loader.java:342)
    at com.googlecode.javacpp.Loader.load(Loader.java:316)
    at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:131)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at com.googlecode.javacpp.Loader.load(Loader.java:335)
    at com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:96)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at com.googlecode.javacpp.Loader.load(Loader.java:335)
    at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:91)
    at com.javacv.HoughLines.main(HoughLines.java:32)

What version of the product are you using? On what operating system?
MacOS X 10.7.4

$ java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3646)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode)

JAVACV -- javacv-bin-20120512

echo $PATH
/opt/local/include:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:
/usr/local/bin:/usr/X11/bin

$ ls | grep opencv
opencv_createsamples
opencv_haartraining
opencv_performance
opencv_traincascade

$ ls | grep opencv
libopencv_calib3d.2.4.0.dylib
libopencv_calib3d.2.4.dylib
libopencv_calib3d.dylib
libopencv_contrib.2.4.0.dylib
libopencv_contrib.2.4.dylib
libopencv_contrib.dylib
libopencv_core.2.4.0.dylib
libopencv_core.2.4.dylib
libopencv_core.dylib
libopencv_features2d.2.4.0.dylib
libopencv_features2d.2.4.dylib
libopencv_features2d.dylib
libopencv_flann.2.4.0.dylib
libopencv_flann.2.4.dylib
libopencv_flann.dylib
libopencv_gpu.2.4.0.dylib
libopencv_gpu.2.4.dylib
libopencv_gpu.dylib
libopencv_highgui.2.4.0.dylib
libopencv_highgui.2.4.dylib
libopencv_highgui.dylib
libopencv_imgproc.2.4.0.dylib
libopencv_imgproc.2.4.dylib
libopencv_imgproc.dylib
libopencv_legacy.2.4.0.dylib
libopencv_legacy.2.4.dylib
libopencv_legacy.dylib
libopencv_ml.2.4.0.dylib
libopencv_ml.2.4.dylib
libopencv_ml.dylib
libopencv_nonfree.2.4.0.dylib
libopencv_nonfree.2.4.dylib
libopencv_nonfree.dylib
libopencv_objdetect.2.4.0.dylib
libopencv_objdetect.2.4.dylib
libopencv_objdetect.dylib
libopencv_photo.2.4.0.dylib
libopencv_photo.2.4.dylib
libopencv_photo.dylib
libopencv_stitching.2.4.0.dylib
libopencv_stitching.2.4.dylib
libopencv_stitching.dylib
libopencv_ts.2.4.0.dylib
libopencv_ts.2.4.dylib
libopencv_ts.dylib
libopencv_video.2.4.0.dylib
libopencv_video.2.4.dylib
libopencv_video.dylib
libopencv_videostab.2.4.0.dylib
libopencv_videostab.2.4.dylib
libopencv_videostab.dylib

Original issue reported on code.google.com by alejacqu...@ajsolutions.me on 24 May 2012 at 3:00

GoogleCodeExporter commented 9 years ago

        System.out.println(System.getProperty("os.arch"));  x86_64
    System.out.println(System.getProperty("sun.arch.data.model")); 64

Original comment by alejacqu...@ajsolutions.me on 24 May 2012 at 3:21

GoogleCodeExporter commented 9 years ago
OpenCV 2.4.0 was added to MacPorts only after JavaCV, so I had to build it 
against a manually compiled version of OpenCV from source code.. The next 
release of JavaCV should work with MacPorts, but if you can't wait, you can 
still recompile JavaCV yourself in the meantime.

Original comment by samuel.a...@gmail.com on 24 May 2012 at 5:12

GoogleCodeExporter commented 9 years ago
Ok, fixed in the latest release! Let me know if it doesn't work for some reason

Original comment by samuel.a...@gmail.com on 27 May 2012 at 1:24