osxInstaller: add the build Qt's lib dir to fixup_bundle search dirs - #556
Open
rogerawong wants to merge 1 commit into
Open
rogerawong wants to merge 1 commit into
rogerawong wants to merge 1 commit into
Conversation
fixup_bundle resolves the @rpath/Qt*.framework references carried by the Qt platform and style plugins through the rpaths of the walked binaries plus its DIRS argument. The rpaths come from CMAKE_INSTALL_RPATH_USE_LINK_PATH (set in admMainChecks.cmake for exactly this purpose) and are fragile: with a LIBRARY_PATH environment variable set, CMake classifies the Homebrew lib dir as an implicit linker directory and silently omits it from every install rpath, after which packaging fails with otool -l failed: 1 error: otool-classic: can't open file: @rpath/QtCore.framework/Versions/A/QtCore (No such file or directory) The DIRS argument so far only carries /usr/local/lib, which does not exist on a default Apple Silicon install. Append the lib directory of the Qt actually used for the build, derived from Qt6_DIR -- correct for Homebrew on arm64 (/opt/homebrew/lib) and Intel (/usr/local/lib) prefixes and for custom MYQT installations alike -- so packaging no longer depends on which rpaths survive into the installed binaries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Appends Qt's lib dir (from Qt6_DIR) to the packaging search path, so packaging stops depending on which rpaths make it into the installed binaries.
If LIBRARY_PATH is set while building (a common leftover from troubleshooting Homebrew issues), CMake stops writing /opt/homebrew/lib into the install rpaths, and fixup_bundle can no longer resolve the Qt plugin @rpath references. Packaging dies on ARM Macs because the only fallback dir is /usr/local/lib.
The build system already knows where Qt is, so the appended dir is always correct: /opt/homebrew/lib on ARM, /usr/local/lib on x86, or your own folder if you built a custom Qt. Packaging verified with SDL3 on and off.