Eclipse / Processing 2.0 / Video / Mac OSX Application Bundle / UnsatisfiedLinkError: Unable to load library 'gstreamer-0.10'
in
Integration and Hardware
•
10 months ago
Once again approaching the subject of the gstreamer native libraries, I have been through a number of forum posts (such as
this and
this) and have found nothing that seems to work for my situation. Here is my scenario:
I have been developing this application in Eclipse 4.2.0 on OSX 10.7.4 with Processing 2.0b6, in which it runs fine. When I attempt to create an
application bundle, it does not work. My application uses the Capture class to get video, run some optical flow analysis on it to create a flow field, and then use that to push around some particle objects.
Here is what it looks like when it runs.
The structure of my Eclipse project is as follows:
InteractiveScreen/
InteractiveScreen/src
InteractiveScreen/data
InteractiveScreen/lib
Inside the "src" folder I have my package and the three classes, InteractiveScreen.java, ColorSpectrum.java, and Particle.java. Inside my "data" folder there are a couple pngs for textures and a main.props file for loading in variables such as screen size, particle attributes, etc. Inside my "lib" folder I have:
core.jar
gluegen-rt-natives-macosx-universal.jar
gluegen-rt.jar
gstreamer-java.jar
jna.jar
jogl-all-natives-macosx-universal.jar
jogl-all.jar
macosx32/ (contains all of the necessary native libraries for video)
video.jar
All of which are added to the build path, except for gluegen-rt-natives-macosx-universal.jar, jogl-all-natives-macosx-universal.jar, and macosx32/. In my build path, I have gluegen and jogl referencing the "lib" directory for their native library location, and I have gstreamer referencing the "lib/macosx" directory for it's native library location.
Once again,
all of this setup runs fine in Eclipse. Now, I export an application bundle via the "
Export > Other > Mac OS X application bundle" menu. The directory structure for that is as follows:
InteractiveScreen.app
InteractiveScreen.app/Contents/
InteractiveScreen.app/Contents/Info.plist
InteractiveScreen.app/Contents/MacOS/
InteractiveScreen.app/Contents/MacOS/JavaApplicationStub
InteractiveScreen.app/Contents/PkgInfo
InteractiveScreen.app/Contents/Resources/
InteractiveScreen.app/Contents/Resources/data/
InteractiveScreen.app/Contents/Resources/data/cloud.png
InteractiveScreen.app/Contents/Resources/data/cloud2.png
InteractiveScreen.app/Contents/Resources/data/main.props
InteractiveScreen.app/Contents/Resources/data/sphere.png
InteractiveScreen.app/Contents/Resources/InteractiveScreen.icns
InteractiveScreen.app/Contents/Resources/Java/
InteractiveScreen.app/Contents/Resources/Java/core.jar
InteractiveScreen.app/Contents/Resources/Java/gluegen-rt-natives-macosx-universal.jar
InteractiveScreen.app/Contents/Resources/Java/gluegen-rt.jar
InteractiveScreen.app/Contents/Resources/Java/gstreamer-java.jar
InteractiveScreen.app/Contents/Resources/Java/jar_0.jar
InteractiveScreen.app/Contents/Resources/Java/jar_1.jar
InteractiveScreen.app/Contents/Resources/Java/jna.jar
InteractiveScreen.app/Contents/Resources/Java/jogl-all-natives-macosx-universal.jar
InteractiveScreen.app/Contents/Resources/Java/jogl-all.jar
InteractiveScreen.app/Contents/Resources/Java/macosx32/
InteractiveScreen.app/Contents/Resources/Java/video.jar
Inside the InteractiveScreen.app/Contents/Resources/Java/macosx32 directory is the massive list of native .dylib files and plugins directory which I will refrain from posting here.
My
Info.plist file reads as such:
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
- <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
- <plist version="1.0">
- <dict>
- <key>CFBundleExecutable</key>
- <string>JavaApplicationStub</string>
- <key>CFBundleGetInfoString</key>
- <string>InteractiveScreen1.0, Copyright datadreamer 2012. All rights reserved.</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleIconFile</key>
- <string>InteractiveScreen.icns</string>
- <key>CFBundleIdentifier</key>
- <string>InteractiveScreen</string>
- <key>CFBundleName</key>
- <string>InteractiveScreen</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>1.0.1</string>
- <key>Java</key>
- <dict>
- <key>WorkingDirectory</key>
- <string>$APP_PACKAGE/Contents/Resources/</string>
- <key>JVMVersion</key>
- <string>1.6*</string>
- <key>MainClass</key>
- <string>it.fabrica.interactivescreen.InteractiveScreen</string>
- <key>Arguments</key>
- <array/>
- <key>VMOptions</key>
- <string>-d32 -Xmx1024m -Djava.library.path=macosx32</string>
- <key>ClassPath</key>
- <string>$JAVAROOT/jar_0.jar:$JAVAROOT/core.jar:$JAVAROOT/gluegen-rt.jar:$JAVAROOT/jogl-all.jar:$JAVAROOT/video.jar:$JAVAROOT/gstreamer-java.jar:$JAVAROOT/jna.jar:$JAVAROOT/jar_1.jar:$JAVAROOT/core.jar:$JAVAROOT/macosx32</string>
- </dict>
- </dict>
- </plist>
Note the
WorkingDirectory entry where I set the
"$APP_PACKAGE/Contents/Resources/" folder as the working directory, and also the
VMOptions entry, where I am forcing the JVM to run in 32 bit mode to accommodate the video library, set the heapspace to allow for 1024mb of memory usage, and added the macosx32 folder to the library path. I am also adding the macosx32 folder to the ClassPath entry, just in case. Unfortunately, neither seem to be making a difference with finding the native libraries for gstreamer. No matter where I place those files, I still get this error:
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Unable to load library 'gstreamer-0.10': dlopen(libgstreamer-0.10.dylib, 9): image not foundat com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:163)
I would really like to figure out what the issue is and how to resolve it so that I can put together a more comprehensive solution for creating application bundles with Processing/Video in the future.
1