homebrew-core: qt5: Output of macdeployqt not working after update to 5.15.10_1

brew gist-logs <formula> link OR brew config AND brew doctor output

% brew config
HOMEBREW_VERSION: 4.1.7
ORIGIN: https://github.com/Homebrew/brew
HEAD: d4444b563e24ac7c05a93121c464c02dfa04d44f
Last commit: 3 days ago
Core tap JSON: 30 Aug 21:02 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 4
Homebrew Ruby: 2.6.10 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.10_1/bin/ruby
CPU: quad-core 64-bit penryn
Clang: 13.0.0 build 1300
Git: 2.41.0 => /usr/local/bin/git
Curl: 7.87.0 => /usr/bin/curl
macOS: 11.7.6-x86_64
CLT: 13.2.0.0.1.1638488800
Xcode: N/A

% brew doctor
Your system is ready to brew.

Verification

  • My “brew doctor output” says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.
  • I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.

What were you trying to do (and why)?

I want to build an application with Qt, create a bundle with macdeployqt and run the bundled application. See exact steps below.

Note that this worked fine until Qt 5.15.10, but it stopped working with Qt5.15.10_1 which was released 2 days ago. For verification, I run the steps below on a system which still had Qt 5.15.10 installed, and it worked fine. Then I updated Qt, tried it again and the error occurs.

This issue breaks CI of LibrePCB. CI worked fine 2 days ago (logs). Since yesterday, it fails with the mentioned error (logs). I saw that commit 9b99c9a256280d85a33ab7d8118e59c0ff0a3b6e was added just in between these two CI runs so it might be related to this problem.

I guess macdeployqt does not work properly (it now runs much faster than normal) but I don’t know if the problem is located within macdeployqt or somewhere else.

What happened (include all command output)?

After building a Qt application bundle (see steps below), the application doesn’t work but just prints this error to the console:

qt.qpa.plugin: Could not load the Qt platform plugin "cocoa" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: cocoa.

zsh: abort      ./test.app/Contents/MacOS/test

What did you expect to happen?

The application bundle should start and a graphical message box must appear.

Step-by-step reproduction instructions (by running brew commands)

# CMakeLists.txt

cmake_minimum_required(VERSION 3.5)
project(test LANGUAGES CXX)
find_package(Qt5 COMPONENTS Gui Widgets REQUIRED)
add_executable(test MACOSX_BUNDLE main.cpp)
target_link_libraries(test PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets)
// main.cpp

#include <QtWidgets>
#include <QtCore>

int main(int argc, char* argv[]) {
  QApplication app(argc, argv);
  QMessageBox::information(0, "Test", "Works!");
  return 0;
}
brew install qt@5 cmake
brew link qt@5
export CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake
cmake .
make
macdeployqt test.app -dmg -always-overwrite
./test.app/Contents/MacOS/test # run application

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 1
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Rebottled qt@5 (#141242) and its dependencies glib (#141248) & freetype (#141250).

It may take some extra time for these to be available via API. Once available, you can try updating and reinstalling locally, e.g. brew update && brew reinstall qt@5 glib freetype.

Let us know if any other issues for qt@5 usage.

Note this may not fix usage with other Qt5 modules, Qt6 usage, or CMake usage that links to formulae that are still using modified RPATHs. Each formula will need to be rebottled individually.

Thanks for the fix. 🙏

Unfortunately, I still have a problem when using cpack (https://github.com/hluk/CopyQ/actions/runs/6039477239/job/16449187277) - now it complains about a different library (libsharpyuv - not sure where it comes from):

 + cpack
CPack: Create package using DragNDrop
CPack: Install projects
CPack: - Run preinstall target for: copyq
CPack: - Install project: copyq []
CMake Error at /usr/local/Cellar/cmake/3.27.4/share/cmake/Modules/BundleUtilities.cmake:458 (message):
  otool -l failed: 1

  error:
  /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool-classic:
  can't open file: @rpath/libsharpyuv.0.dylib (No such file or directory)

Just to confirm, there’s no way to get the old (working) Qt5 binaries installed with brew (in an automated, headless way), right?

Not easily. Don’t know if there is a workaround via API mode but some users occasionally use Git/Tap mode (HOMEBREW_NO_INSTALL_FROM_API) and checkout older git commit as workaround. This does lock in some older versions of formulae from that commit.

Homebrew could try a rebottle of qt@5 if others agree to it as that currently doesn’t rewrite RPATHs.


Responding to my own comment

Bit curious if this also impacts CMake’s fixup_bundle or if they do something different.

I think this broke fixup_bundle based on wxmaxima failure in #139981, e.g.

  -- fixup_bundle
  --   app='/tmp/wxmaxima-20230820-24435-14myu5f/wxmaxima-Version-23.08.0/build-wxm/src/wxmaxima.app'
  --   libs=''
  --   dirs=''
  --   ignoreItems=''
  -- fixup_bundle: preparing...
  -- warning: embedded item does not exist '/opt/opt/libpng/lib/libpng16.16.dylib'
  -- 
  warning: cannot resolve item '@loader_path/../../../../opt/libpng/lib/libpng16.16.dylib'
  
    possible problems:
      need more directories?
      need to use InstallRequiredSystemLibraries?
      run in install tree instead of build tree?