-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OS X and Win10: Exported apps can't find SimpleOpenNI libs #2
Comments
Hello I will try to get one Windows PC this week to taste on Windows, currently I just have a Mac to support the library. |
I wouldn't worry about Windows support yet--this is a bug that's been in every version of SimpleOpenNI since the beginning. If you can fix the Mac side, I can test on other OSes. Could you add the source of the SimpleOpenNI library itself? Like: |
I try this library for Processing 3.3.7 on Windows10. It goes well. However, export problem does not fix yet. Would you please fix nativLibPath in simpleOpenNI.java. It is explained in wexstorm/simple-openni#73 . |
OK, I think I have a solution--it needed a few changes from the wexstorm one. Sent a PR for 3.4. |
Unfortunately the fix worked for depth but not for NITE--seems like NITE looks in the user's home directory (for some reason) when exported as a library regardless of the path set in the main jar. |
Eek – just ran into this issue... it's not quite clear if it's been fixed or what one needs to do? |
Oh hey, big fan of XYscope. So I've researched this quite a bit, even experimented with recompiling the jar, and my conclusion is it's a path issue with NITE, which we don't have the source for, so it can't be completely fixed. (Hope I'm wrong though.) The good news is, there's a workaround: place the SimpleOpenNI library folder at the root of your boot drive, and all exported apps can find it. This makes it really hard for distribution to civilians, but otherwise it's not even that bad a solution, because you don't need the same 200MB folder for every app. Further good news is it still works up to Win10 and High Sierra. (Haven't tried Mojave.) |
Thaanks + super thanks for quick reply. Ahaa, I was wondering about this when seeing what was changed in your various commits.. yup yup worked great (indeed not sooo user-friendly) but better than a sad gray-screen of nothingness. Is there a flag or snippet to prevent it from including the 200mb library one each export, or simply have to inspect package contents and trash it? If using skeleton tracking, does one still need to install OpenNi2:
My setup already has it.. so hard to test if app runs on fresh machine.. |
I just trash it...don't believe it's necessary to install OpenNI separately but need to test. Fwiw I always install the SenseCast version of OpenNI 1 on a new machine as a good-luck ritual. |
Aha, nice tip (will check if OpenNI 1 suites my needs)– thanks again. |
I don't know if it helps here, but I think NiTE's decision about where to load things from has to do with the current working directoy when you load it. I've recently developed a plugin for Isadora that uses NiTE. To get that to work I had to determine the path the the dylib and then use the chdir() command to set the working directory. My code for this is below. `
` Hopefully that might help you address the problem. Also, I had to muck about with @loader_path to so that everytthing would work properly, but maybe that doesn't apply to you. Best Wishses, |
Whoa, this is the first solid lead I think we've had in the several years this issue has been hanging around. Thanks! |
I've done some research about this problem today. Below are what I have found out: the error info is:
Why this happend?Open static {
String var0 = System.getProperty("os.name").toLowerCase();
String var1 = "SimpleOpenNI";
String var2 = System.getProperty("os.arch").toLowerCase();
if (var0.indexOf("win") >= 0) {
// ...
} else if (var0.indexOf("nix") < 0 && var0.indexOf("linux") < 0) {
if (var0.indexOf("mac") >= 0) {
var1 = "lib" + var1 + ".jnilib";
nativLibPath = getLibraryPathLinux() + "/SimpleOpenNI/library/";
nativDepLibPath = nativLibPath + "osx/";
}
} else {
nativLibPath = "/SimpleOpenNI/library/linux";
if (var2.indexOf("86") >= 0) {
var1 = var1 + "32";
} else if (var2.indexOf("64") >= 0) {
var1 = "lib" + var1 + "64.so";
nativLibPath = getLibraryPathLinux() + "/SimpleOpenNI/library/";
nativDepLibPath = nativLibPath + "linux64/";
}
}
try {
System.load(nativLibPath + var1);
} catch (UnsatisfiedLinkError var5) {
System.out.println("Can't load SimpleOpenNI library (" + var1 + ") : " + var5);
System.out.println("Verify if you installed SimpleOpenNI correctly.\nhttp://code.google.com/p/simple-openni/wiki/Installation");
}
_initFlag = false;
} notice that, the result of public static String getLibraryPathLinux() {
URL var0 = SimpleOpenNI.class.getResource("SimpleOpenNI.class");
if (var0 != null) {
String var1 = var0.toString().replace("%20", " ");
int var2 = var1.indexOf(47);
boolean var3 = true;
int var4 = var1.indexOf("/SimpleOpenNI/library");
return -1 < var2 && -1 < var4 ? var1.substring(var2, var4) : "";
} else {
return "";
}
}
···
Notice this line
```java
int var4 = var1.indexOf("/SimpleOpenNI/library"); SimpleOpenNI tries to find substring How to solve it.A new implementation of
#!/bin/bash
cd "$(dirname ${BASH_SOURCE})"
cd ../..
APP_ROOT=$(pwd)
cd Contents/Java
JAR_LIBS=$(ls *.jar | tr "\n" ":")
JAR_LIBS=${JAR_LIBS}./SimpleOpenNI/library/SimpleOpenNI.jar
APP_NAME=$(basename "${BASH_SOURCE}")
# Caution: if your embedded java has a different version, replace jdk1.8.0_181.jdk with the correct name
# if you didn't choose to embedded java in your exported application, set JAVA_BIN=java to use the global java
JAVA_BIN=${APP_ROOT}/Contents/PlugIns/jdk1.8.0_181.jdk/Contents/Home/jre/bin/java
${JAVA_BIN} \
-Djna.nosys=true \
-Djava.ext.dirs=$APP_ROOT/Contents/PlugIns/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext \
-Xdock:icon=$APP_ROOT/Contents/Resources/sketch.icns \
-Djava.library.path=$APP_ROOT/Contents/Java \
-Dapple.laf.useScreenMenuBar=true \
-Dcom.apple.macos.use-file-dialog-packages=true \
-Dcom.apple.macos.useScreenMenuBar=true \
-Dcom.apple.mrj.application.apple.menu.about.name=${APP_NAME} \
-classpath ${JAR_LIBS} ${APP_NAME} make this file executable chmod +x ./Sketch
|
Amazing! I actually saved the jar source with my fork: https://github.com/n1ckfg/SimpleOpenNI/tree/Processing_3.4_test/SimpleOpenNI/src ...tried a couple path fixes and recompiled but no luck. Do you have an idea of how you would implement that directly in the source? |
FINALLY! Thanks to your fork I was able to apply a definitive fix for the infamous path bug in .exe files. With your build.bat file and small changes to the solution posted in this link, you can easily generate a brand new .jar file which works perfectly with standalone .exe files. Here´s how (requires Processing 3.4 + SimpleOpenNI-Processing_3.4):
This should do the trick. Thanks again! |
Amazing! |
@totovr If we put this solution in a pull request, which branch would you like us to work in? |
Both OS X and Windows solutions tested and working. |
Issue Summary
Works fine in the Processing IDE, but exported apps look at root of the boot drive for the SimpleOpenNI folder, instead of in the correct location. This is an issue shared by all versions of SimpleOpenNI 1.96, including the original Max Rheiner version.
Executed Command (if any)
File > Export Application
Processing Output (if any)
Exported app crashes with gray screen.
Type of Issue
Your System Configuration
Operating system: OS X 10.12, Win10.
The text was updated successfully, but these errors were encountered: