ivan16luis / javacv

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

Demo: java.lang.UnsatisfiedLinkError - Reason: image not found #125

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install opencv from Mac Ports ( 
http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port )
2. Download and setup javacv in Eclipse
3. Run the Demo code from http://code.google.com/p/javacv/ 

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

Attempted to run the Demo from the javacv main page.

Exception in thread "main" java.lang.UnsatisfiedLinkError: 
/private/var/folders/f5/dhc2ts9n54n_f1l48wnw7m5w0000gn/T/libjniopencv_core242196
5214181288720.dylib:  Library not loaded: lib/libopencv_core.2.3.dylib   
Referenced from: 
/private/var/folders/f5/dhc2ts9n54n_f1l48wnw7m5w0000gn/T/libjniopencv_core242196
5214181288720.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.load(Loader.java:337)
    at com.googlecode.javacpp.Loader.load(Loader.java:271)
    at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:126)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:291)
    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:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:291)
    at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:91)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:291)
    at com.googlecode.javacv.cpp.opencv_features2d.<clinit>(opencv_features2d.java:93)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:291)
    at com.googlecode.javacv.cpp.opencv_objdetect.<clinit>(opencv_objdetect.java:97)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:291)
    at javacvtest.main(javacvtest.java:24)

What version of the product are you using? On what operating system?
 * Mac OS X 10.7.2
 * Eclipse (Indigo)
 * OpenCV 2.2.0 (from MacPorts)
 * JavaCV (bin 2011-10-01)

Please provide any additional information below.

Original issue reported on code.google.com by andrew.c...@gmail.com on 31 Oct 2011 at 8:32

GoogleCodeExporter commented 9 years ago
Please install OpenCV 2.3.1 as documented in the README.txt file, thank you.

Original comment by samuel.a...@gmail.com on 1 Nov 2011 at 4:10

GoogleCodeExporter commented 9 years ago
I installed OpenCV 2.3.1 as directed and am receiving the same error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: 
/private/var/folders/f5/dhc2ts9n54n_f1l48wnw7m5w0000gn/T/libjniopencv_highgui233
9355169067904283.dylib:  Library not loaded: /opt/local/lib/libpng12.0.dylib   
Referenced from: /opt/local/lib/libopenjpeg.1.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.load(Loader.java:337)
    at com.googlecode.javacpp.Loader.load(Loader.java:271)
    at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:91)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:291)
    at com.googlecode.javacv.cpp.opencv_features2d.<clinit>(opencv_features2d.java:93)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:291)
    at com.googlecode.javacv.cpp.opencv_objdetect.<clinit>(opencv_objdetect.java:97)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:291)
    at javacvtest.main(javacvtest.java:24)

Original comment by andrew.c...@gmail.com on 1 Nov 2011 at 9:18

GoogleCodeExporter commented 9 years ago
Have you tried to 1. upgrade MacPorts and then 2. recompile OpenCV 2.3.1?

Original comment by samuel.a...@gmail.com on 2 Nov 2011 at 12:31

GoogleCodeExporter commented 9 years ago
Yes, I have.  The package maintainer just patched OpenCV to 2.3.1  ( 
https://trac.macports.org/ticket/31818 ). I successfully upgraded opencv to 
2.3.1 and attempted to clean and rebuild the demo javacv example.  Receiving 
the same error.  

Exception in thread "main" java.lang.UnsatisfiedLinkError: 
/private/var/folders/f5/dhc2ts9n54n_f1l48wnw7m5w0000gn/T/libjniopencv_highgui723
1495451730374149.dylib:  Library not loaded: /opt/local/lib/libpng12.0.dylib   
Referenced from: /opt/local/lib/libopenjpeg.1.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.load(Loader.java:337)
    at com.googlecode.javacpp.Loader.load(Loader.java:271)
    at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:91)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:291)
    at com.googlecode.javacv.cpp.opencv_features2d.<clinit>(opencv_features2d.java:93)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:291)
    at com.googlecode.javacv.cpp.opencv_objdetect.<clinit>(opencv_objdetect.java:97)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:291)
    at javacvtest.main(javacvtest.java:24)

Original comment by andrew.c...@gmail.com on 3 Nov 2011 at 2:33

GoogleCodeExporter commented 9 years ago
The source code provided is a different version than the binary. The binary is 
looking for a 2.3 library in only the relative path lib/ , while the source 
snapshot correctly looks for 2.3.1 in the correct paths. I just compiled the 
source and it worked for me.

Original comment by shipmas...@gmail.com on 9 Dec 2011 at 11:24

GoogleCodeExporter commented 9 years ago
Hi guys,

I'm getting a similar error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: 
/private/var/folders/ll/qq78ztts4rbdgwmv1__9d1lr0000gp/T/javacpp1339691900574264
000/libjniopencv_core.dylib:  Library not loaded: 
@rpath/libopencv_core.2.4.dylib   Referenced from: 
/private/var/folders/ll/qq78ztts4rbdgwmv1__9d1lr0000gp/T/javacpp1339691900574264
000/libjniopencv_core.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:418)
    at com.googlecode.javacpp.Loader.load(Loader.java:368)
    at com.googlecode.javacpp.Loader.load(Loader.java:315)
    at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:131)
    at ImageRecognition.loadFaceImgArray(ImageRecognition.java:323)
    at ImageRecognition.learn(ImageRecognition.java:152)
    at ImageRecognition.<init>(ImageRecognition.java:138)
    at ImageRecognition.main(ImageRecognition.java:772)

I'm running Mac OS X Version 10.7.4 and I have OpenCV-2.4.1 in my root 
directory (/).  I have this working on two Windows machines but I can't figure 
this one out so any help would be greatly appreciated.

Cheers,
Alexei Blue.

Original comment by Alexei_o...@hotmail.com on 14 Jun 2012 at 4:48

GoogleCodeExporter commented 9 years ago
Try to install OpenCV with MacPorts instead http://www.macports.org/

Original comment by samuel.a...@gmail.com on 15 Jun 2012 at 2:02

GoogleCodeExporter commented 9 years ago
Thanks Samuel,

I'm installing with MacPorts but it seems to be getting stuck.   I've heard the 
installation can take hours but it looks like it's getting stuck installing 
llvm-3.0.  Using -v option the last line printed before nothing else happens 
is: 

"make[3] Leaving directory 
`/opt/local/var/macports/build/_opt_local_car_macports_source_rsync.macports.org
_release_tarballs_ports_lang_llvm-3.0/llvm-3.0/work/llvm-3.0.src/lib/Target/MBla
ze'"

Do I just need to be more patient or is there anything you can suggest?

Cheers,
Alexei Blue.

Original comment by Alexei_o...@hotmail.com on 15 Jun 2012 at 12:31

GoogleCodeExporter commented 9 years ago
I have no idea, it does not install llvm here.

Original comment by samuel.a...@gmail.com on 15 Jun 2012 at 12:47

GoogleCodeExporter commented 9 years ago
Weird.  It seems to recognise it as a dependency for me.  I have OpenCV 
download and in root but I'm using the install command.  Should I just 
recompile?  And if so can you give me a command please?

Again, cheers for your help,
Alexei Blue.

Original comment by Alexei_o...@hotmail.com on 15 Jun 2012 at 12:56

GoogleCodeExporter commented 9 years ago
Just follow the instructions here http://guide.macports.org/ and then "port 
install opencv". If you have trouble following that guide, please ask the 
MacPorts developers, not me, thank you.

Original comment by samuel.a...@gmail.com on 15 Jun 2012 at 1:00

GoogleCodeExporter commented 9 years ago
Apologies Samuel,

It looks like things are happening as they should now.  I was using +universal 
with the command which I read somewhere might help with installs using 
macports.  I ensured opencv was uninstalled (port uninstall opencv) and then I 
cleaned out the directory (port clean opencv) and finally I ran the install 
command minus the +universal and dependencies are now downloading again so with 
any luck I'll have it working shortly.

Cheers,
Alexei Blue.

Original comment by Alexei_o...@hotmail.com on 15 Jun 2012 at 1:23

GoogleCodeExporter commented 9 years ago
Hi,

Not sure whether u stil have the problem. I think u need to add a new 
environment key in the run configuration?
I encountered the same problem as you all. But i managed to solve the problem. 
Hope it helps :)

MJ

Original comment by MengJian...@gmail.com on 2 Jan 2013 at 7:11