Search code examples
macoslibvlcsharp

Can't load native VLC dynlib on MacOS: libvlccore.dylib missing from VideoLAN.LibVLC.Mac nuget package


The nuget seems to copy libvlc.dylib at the correct location at build time, but libvlccore.dylib is nowhere to be found (in the output dir or the nuget package). Because of this, I got this exception:

Une exception s'est produite : CLR/LibVLCSharp.Shared.VLCException
Une exception non gérée du type 'LibVLCSharp.Shared.VLCException' s'est produite dans LibVLCSharp.dll: 'Failed to load required native libraries. 
Have you installed the latest LibVLC package from nuget for your target platform?
Search paths include /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlc.dylib,/Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlccore.dylib; /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlc.dylib,; /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc.dylib,; /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/lib/libvlc.dylib,/Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/lib/libvlccore.dylib'

I tried to copy the libvlccore.dylib from my VLC player installation folder, but it still won't work. I can see in the logs that it does load it, but still throw the exception.

Loading /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlccore.dylib
Cannot find /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlccore.dylib
Loading /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlc.dylib
Cannot find /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlc.dylib
Loading 
Cannot find 
Loading /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlc.dylib
Cannot find /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlc.dylib
Loading 
Cannot find 
Loading /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc.dylib
Loading /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/lib/libvlccore.dylib
Loading /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/lib/libvlc.dylib

I'm on MacOS 14.5 on a M1 MacBook Pro.


Solution

  • Apple Silicon support (either through x64 in your attempt, or native ARM) has not been tested for LibVLCSharp, so it is expected that it doesn't work. https://code.videolan.org/videolan/LibVLCSharp/-/issues/363