Skip to content
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

osxbundle: fix Vulkan dylib install name #15285

Closed

Conversation

al3xtjames
Copy link

MoltenVK from Homebrew hardcodes the install name of libMoltenVK.dylib to point to the Homebrew prefix:

$ otool -l mpv.app/Contents/Frameworks/libMoltenVK.dylib | grep -A2 LC_ID_DYLIB
          cmd LC_ID_DYLIB
      cmdsize 72
         name /usr/local/opt/molten-vk/lib/libMoltenVK.dylib (offset 24)

Update dylib_unhell to update the install name in libMoltenVK.dylib to avoid depending on the Homebrew prefix.

MoltenVK from Homebrew hardcodes the install name of libMoltenVK.dylib
to point to the Homebrew prefix:

$ otool -l mpv.app/Contents/Frameworks/libMoltenVK.dylib | grep -A2 LC_ID_DYLIB
          cmd LC_ID_DYLIB
      cmdsize 72
         name /usr/local/opt/molten-vk/lib/libMoltenVK.dylib (offset 24)

Update dylib_unhell to update the install name in libMoltenVK.dylib to
avoid depending on the Homebrew prefix.
Copy link

github-actions bot commented Nov 9, 2024

Download the artifacts for this pull request:

Windows
macOS

@al3xtjames
Copy link
Author

After doing some additional testing I don't think is necessary - MoltenVK successfully loads even if the path specified by the install name doesn't exist. I was trying to fix the case where /usr/local/bin/mpv is a symlink to /Applications/mpv.app/Contents/MacOS/mpv. Trying to run /usr/local/bin/mpv --gpu-api=vulkan -v shows that Vulkan initialization fails with VK_ERROR_INCOMPATIBLE_DRIVER, but /Applications/mpv.app/Contents/MacOS/mpv --gpu-api=vulkan -v works fine. Changing the install name of libMoltenVK.dylib doesn't fix it.

@al3xtjames al3xtjames closed this Nov 9, 2024
@Akemi
Copy link
Member

Akemi commented Nov 15, 2024

there is nothing broken i would say. the vulkan loader dynamically searchs in certain paths for the drivers and loaders:

the Contents/Resources/vulkan/icd.d/MoltenVK_icd.json (in the bundle), which we copy from found vulkan/moltenvk installation, is modified to point to the corresponding libMoltenVK.dylib ("library_path": "../../../Frameworks/libMoltenVK.dylib",). that dylib is also copied to the bundle.

just means the driver/loader is properly found within your bundle (relative path), but not found on your system because it's not installed to any of the standard search paths of vulkan/moltenvk.

@al3xtjames
Copy link
Author

Yeah, I came to the same conclusion after a while. I ended up working around it by replacing the symlink with a wrapper script that invokes /Applications/mpv.app/Contents/MacOS/mpv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants