Closed ElhemEnohpi closed 10 months ago
you need to roughly do this: https://github.com/mpv-player/mpv/issues/10387#issuecomment-1180578175
the bundle script is not able to resolve the dependencies in those cases and wasn't meant to.
@ElhemEnohpi I have also tried to package the dependencies of MPV into an app, and I borrowed from iina's script to reduce the dependency according to my needs, and used dylibbundler for packaging.
I hope it will be helpful to you.
@Akemi thanks for your help, I'm now able to get the standalone app built. I used otool -L
to search all the dylibs in $(brew --prefix)/lib
and found the libs that were referencing the missing ones. The following fixes it:
install_name_tool -change "@rpath/libsharpyuv.0.dylib" "$(brew --prefix)/lib/libsharpyuv.0.dylib" "$(brew --prefix)/lib/libwebp.7.dylib"
codesign --force -s - "$(brew --prefix)/lib/libwebp.7.dylib"
install_name_tool -change "@rpath/libwebp.7.dylib" "$(brew --prefix)/lib/libwebp.7.dylib" "$(brew --prefix)/lib/libwebpdemux.2.dylib"
install_name_tool -change "@rpath/libsharpyuv.0.dylib" "$(brew --prefix)/lib/libsharpyuv.0.dylib" "$(brew --prefix)/lib/libwebpdemux.2.dylib"
codesign --force -s - "$(brew --prefix)/lib/libwebpdemux.2.dylib"
install_name_tool -change "@rpath/libwebp.7.dylib" "$(brew --prefix)/lib/libwebp.7.dylib" "$(brew --prefix)/lib/libwebpmux.3.dylib"
install_name_tool -change "@rpath/libsharpyuv.0.dylib" "$(brew --prefix)/lib/libsharpyuv.0.dylib" "$(brew --prefix)/lib/libwebpmux.3.dylib"
codesign --force -s - "$(brew --prefix)/lib/libwebpmux.3.dylib"
I also disabled vapoursynth in meson_options.txt, because it was failing on looking for Python. Then I had to do this, as noted in Compiling distro releases for macOS · mpv-player/mpv Wiki
rm build/mpv.app/Contents/MacOS/mpv-bundle
mv build/mpv.app/Contents/MacOS/mpv build/mpv.app/Contents/MacOS/mpv-bundle
ln -s mpv-bundle build/mpv.app/Contents/MacOS/mpv
codesign --force --deep -s - build/mpv.app
Hopefully someone will start distributing a Universal Binary mpv app one of these days, but this is good enough for my purposes at the moment. I did find some info in issue #8533, and these scripts, but I didn't try it:
@xfangfang it turned out to be a bit simpler to do it the above way, but thanks for the suggestion.
@ElhemEnohpi Can you try this bundle.sh script ?
https://github.com/eko5624/mpv-macos-intel/blob/main/bundle.sh
@eko5624 Why? In any case, sorry, no. I'm sure it's a good script, but I'm not familiar enough with what it's doing, there are many 'sudo' commands, no documentation, and I don't have time to figure it out myself. Whatever it is, it's not building a Universal Binary, so I don't have a need for it at the moment. I was able to compile using the standard mpv osxbundle.py script.
@ElhemEnohpi Ok then. You can remove 'sudo'. I use 'sudo' because github actions need it. This script is using for making bundle. I don't have an Apple silicon (M1 / M2) laptop, so I don't know how to build Universal Binary, sorry.
Important Information
Provide following Information:
Reproduction steps
I'm trying to get a static/standalone mpv app for Apple Silicon. I followed some instructions here: How to build mpv & mpv.app on an Apple silicon (M1 / M2) Mac
But the build fails, with missing lib files, when trying to build it standalone. It looks like a problem with the osxbundle.py or dylib-unhell.py scripts, but I don't really know... sorry if it has to do with Homebrew or something instead.
Expected behavior
mpv and a standalone app bundle are built.
Actual behavior
A working cli mpv is built. A working app bundle can be built with
./TOOLS/osxbundle.py --skip-deps build/mpv
, but trying to bundle the dependencies with./TOOLS/osxbundle.py build/mpv
fails. First, an error about missing libbrotlicommon, described in #10063, which is fixed with this:After that, an error about missing libwebp.7.dylib and libsharpyuv.0.dylib, which I don't know how to fix. The app bundle fails to launch.
If there's any other way to build or obtain a standalone app for Apple Silicon, please let me know. The links in https://mpv.io/installation/ don't provide it. It would be great if there were working instructions or helper scripts to build it from source.
system python3, "TOOLS/osxbundle.py", "-s", "build/mpv"
to the Brew formula, but it also fails if I try to build it standalone with bundled dependencies, without-s
.Log file