caprica / vlcj

Java framework for the vlc media player
http://www.capricasoftware.co.uk/projects/vlcj
1.1k stars 260 forks source link

Apple M1 (darwin-aarch64/libvlc.dylib) not found #1192

Closed kodeplateform closed 1 year ago

kodeplateform commented 1 year ago

Hello ,

Thanks for your work, I'm using this project on JetpackCompose to have a player for desktop side. I'm surprise it works well on Windows but seems like the library for apple arm64 is missing ? I used an CallbackMediaPlayerComponent to avoid pb on osx and vlc suppports m1 since 3.0.12 so i dont really understand ?

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'vlc':
dlopen(libvlc.dylib, 0x0009): tried: 'libvlc.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibvlc.dylib' (no such file), '/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/./libvlc.dylib' (no such file), '/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/../lib/libvlc.dylib' (no such file), '/usr/lib/libvlc.dylib' (no such file, not in dyld cache), 'libvlc.dylib' (no such file), '/usr/lib/libvlc.dylib' (no such file, not in dyld cache)
dlopen(libvlc.dylib, 0x0009): tried: 'libvlc.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibvlc.dylib' (no such file), '/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/./libvlc.dylib' (no such file), '/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/../lib/libvlc.dylib' (no such file), '/usr/lib/libvlc.dylib' (no such file, not in dyld cache), 'libvlc.dylib' (no such file), '/usr/lib/libvlc.dylib' (no such file, not in dyld cache)
dlopen(/Users/air/Library/Frameworks/vlc.framework/vlc, 0x0009): tried: '/Users/air/Library/Frameworks/vlc.framework/vlc' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/air/Library/Frameworks/vlc.framework/vlc' (no such file), '/Users/air/Library/Frameworks/vlc.framework/vlc' (no such file), '/System/Library/Frameworks/vlc.framework/vlc' (no such file, not in dyld cache)
dlopen(/Library/Frameworks/vlc.framework/vlc, 0x0009): tried: '/Library/Frameworks/vlc.framework/vlc' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/vlc.framework/vlc' (no such file), '/Library/Frameworks/vlc.framework/vlc' (no such file), '/System/Library/Frameworks/vlc.framework/vlc' (no such file, not in dyld cache)
dlopen(/System/Library/Frameworks/vlc.framework/vlc, 0x0009): tried: '/System/Library/Frameworks/vlc.framework/vlc' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/vlc.framework/vlc' (no such file), '/System/Library/Frameworks/vlc.framework/vlc' (no such file, not in dyld cache)
Native library (darwin-aarch64/libvlc.dylib) not found 
caprica commented 1 year ago

Those problems are related to JNA (a library the vlcj uses for native code integration), not vlcj itself.

You can try updating the version of JNA in your project to the latest.

kodeplateform commented 1 year ago

Thanks for your answer, but how can I do that ?

I use gradle with buil.gradle.kts and ive only : implementation("uk.co.caprica:vlcj:4.8.2")

caprica commented 1 year ago

Override the JNA dependency that vlcj uses with a newer one.

Gradle documentation will tell you how. I use Maven in my projects, not Gradle.

kodeplateform commented 1 year ago

Ok not sure of what I find but I've same error with :

implementation("uk.co.caprica:vlcj:4.8.2") { exclude(group = "net.java.dev.jna", module = "jna") } implementation("net.java.dev.jna:jna:5.13.0") implementation("net.java.dev.jna:jna-platform:5.13.0")

caprica commented 1 year ago

Well, it's possible that JNA does not (yet?) support your CPU architecture, maybe search the JNA issues at GitHub for anyone with a similar issue.

There really isn't anything that can be fixed in vlcj here.

In the long term, when Java FFM API is stable (probably JDK 21 or JDK 22) then vlcj will move to it, and JNA will no longer be needed. This means your CPU architecture is almost certainly going to be support then, but this could be six months to a year away.

caprica commented 1 year ago

Maybe also just make sure you're not seeing something similar to #1189, I don't think so, but it doesn't hurt to check.

kodeplateform commented 1 year ago

Thanks for your time again. I think I misunderstood the project ? To me this library was to have a access to the core player of VLC from Java ?

Because I just made this error disappeared by installing the official vlc app on the mac, is this normal behavior ?

edit: yes seems like (same kindof error) on windows too if vlc app is not installed

caprica commented 1 year ago

Well, yes... you need to have VLC installed first.

In principle you don't need to install the VLC app, you could just install all of the shared libraries. On Windows that would work. On macOS and Linux that is much more problematic.

It simply isn't practical to include VLC's libraries with vlcj directly, since like I mentioned in the case of Linux at least you generally just can't copy shared libraries from one build of Linux (say Ubuntu) to some other different distribution of Linux.

For this reason, the vlcj project has always said to install VLC first, or you use the OS package system to install your vlcj package which would have a dependency on VLC being installed first.

kodeplateform commented 1 year ago

Ok thank you for your help, my problem is solved then