Skip to content

osxInstaller: add the build Qt's lib dir to fixup_bundle search dirs - #556

Open
rogerawong wants to merge 1 commit into
mean00:masterfrom
rogerawong:macos-fixup-bundle-qt-dir
Open

rogerawong wants to merge 1 commit into
mean00:masterfrom
rogerawong:macos-fixup-bundle-qt-dir

Conversation

@rogerawong

@rogerawong rogerawong commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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.

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>
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.

1 participant