move-ucsb / DynamoVis

An exploratory movement visualization tool
GNU General Public License v3.0
29 stars 6 forks source link

Java UnsatisfiedLinkError - is there a solution for Apple Silicon?? #12

Open cachatj opened 11 months ago

cachatj commented 11 months ago

java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/ft/r2l5xjqn2dz_x4n3k0h7f6vc0000gq/T/jogamp_0000/file_cache/jln2972385321995133681/jln6713280780942712952/natives/macosx-universal/libgluegen_rt.dylib

Java(TM) SE Runtime Environment (build 17.0.8+9-LTS-211)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.8+9-LTS-211, mixed mode, sharing)

launching DynamoVis with:

java --add-exports java.desktop/com.apple.eawt=ALL-UNNAMED -jar DynamoVis.jar

Any insights?

merttoka commented 11 months ago

I don't have access to a machine with Apple silicon, but ChatGPT gave the following response based on your error messages (4th option might be the most helpful):

"The error you're seeing is an UnsatisfiedLinkError, which indicates that the Java Virtual Machine (JVM) can't find a native library it needs to run your Java application. Specifically, it's trying to load a dynamic link library (.dylib) which is not present or not compatible.

Considering the details provided and the fact that this is happening on Apple silicon (presumably the M1 chip or its successors), here are a few general steps and considerations to resolve the issue:

  1. Native Library Compatibility: Ensure that the native library (libgluegen_rt.dylib in this case) is compatible with Apple silicon. Many native libraries were initially built for Intel-based Macs, and they might not work out-of-the-box on Apple's new ARM-based architecture.

  2. Java Version: Ensure you're using a version of Java that's compatible with Apple silicon. The provided information shows you're using Java 17, which should have support. However, make sure you downloaded the ARM64 version and not the x86_64 version. You might consider using a distribution like AdoptOpenJDK or Zulu which provides explicit ARM64 builds.

  3. JAVA_LIBRARY_PATH: You might need to set the JAVA_LIBRARY_PATH environment variable to point to the directory containing the .dylib files your application needs.

    export JAVA_LIBRARY_PATH=/path/to/your/dylib/directory

    After setting this, try rerunning your Java application.

  4. Use Rosetta: As a temporary solution, you can use Apple's Rosetta 2 to run your application under x86_64 emulation. This might have performance penalties, but it can be a helpful stopgap solution until native libraries are updated. You can start a terminal under Rosetta by opening Terminal, navigating to Applications > Utilities, duplicating the Terminal app, and then right-clicking on the duplicate and selecting "Get Info" and then "Open using Rosetta". Then, run your Java application from that terminal instance.

  5. Recompile Native Libraries: If you have access to the source code of the native libraries, you might need to recompile them for Apple silicon."

sonofahutmaker commented 11 months ago

Hey @cachatj, I'm running DynamoVis on Apple silicon and it's working fine for me with the same command. Were you able to resolve or are you still facing this?

cachatj commented 11 months ago

Hey! So thankful y’all are responsive on here.

Message ID: @.***>

I was able to downgrade, uninstall, reinstall JAVA a few times to get past the first headache. Got to the point where I could load a track & click to animate….but then nothing would happen, no final output.

My fast Googling I think landed me to forums where it’s a known issue with a particular DDL or DNYDB or whatever and basically it was another rabbit hole I wasn’t interested in going down. So bailed.

Spoke with Someyah as well, and she more clearly described the differences btw movelabs various tools. I think for my use case Dynamno is not most applicable - so no hard feelings.

Again, just stoke y’all are paying attention! Thanks 😊