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

macOS/Qt6/Homebrew deployment issues #69

Closed
jelmervdl opened this issue Dec 1, 2021 · 5 comments
Closed

macOS/Qt6/Homebrew deployment issues #69

jelmervdl opened this issue Dec 1, 2021 · 5 comments
Assignees

Comments

@jelmervdl
Copy link
Collaborator

jelmervdl commented Dec 1, 2021

When running macdeployqt from a Qt 6 installed through Homebrew, the resulting translateLocally.app bundle still refers to libraries only installed on your system locally. macdeployqt tries to fix all these references, but fails. This issue is about this journey, what I've found so far, and hopefully a solution that not just "just use Qt5 for now".

Source macdeployqt: https://github.com/qt/qtbase/blob/f5f7f78766d62b7192b98b96bbd68dab1961e54e/src/tools/macdeployqt/shared/shared.cpp

The issue starts when macdeployqt starts copying the plugins into the application bundle. The Homebrew version of Qt6 is compiled with relative paths:

> otool -l /usr/local/Cellar/qt/6.2.0/share/qt/plugins/platforms/libqcocoa.dylib
...
Load command 35
          cmd LC_RPATH
      cmdsize 48
         path @loader_path/../../../../lib (offset 12)

From the original location, that path resolves to /usr/local/Cellar/qt/6.2.0/lib. However, macdeployqt tries to resolve this after the plugin is copied, and then this path is no longer valid. Then, this path resolves to $BUILD_DIR/lib.

Current work-around I'm trying because it's too stupid to work:

ln -s $(brew --prefix qt)/lib ./lib

Experimenting in #68 with this solution.

@jelmervdl jelmervdl self-assigned this Dec 1, 2021
jelmervdl added a commit that referenced this issue Dec 1, 2021
@jelmervdl
Copy link
Collaborator Author

Oh oh I want to try to set this up! https://localazy.com/blog/how-to-automatically-sign-macos-apps-using-github-actions But I don't think I can add secrets to this repo. Can't find the button for it (but can test it on my own fork!)

@jelmervdl
Copy link
Collaborator Author

No ball.

jelmer@Mac translateLocally.app % Contents/MacOS/translateLocally 
dyld: Library not loaded: @loader_path/libbrotlicommon.1.dylib
  Referenced from: /Volumes/:Users:runner:work:translateLocally:translateLocally:build:translateLocally/translateLocally.app/Contents/Frameworks/libbrotlidec.1.dylib
  Reason: image not found
zsh: abort      Contents/MacOS/translateLocally
jelmer@Mac translateLocally.app % otool -L /Volumes/\:Users\:runner\:work\:translateLocally\:translateLocally\:build\:translateLocally/translateLocally.app/Contents/Frameworks/libbrotlidec.1.dylib 
/Volumes/:Users:runner:work:translateLocally:translateLocally:build:translateLocally/translateLocally.app/Contents/Frameworks/libbrotlidec.1.dylib:
	@executable_path/../Frameworks/libbrotlidec.1.dylib (compatibility version 1.0.0, current version 1.0.9)
	@loader_path/libbrotlicommon.1.dylib (compatibility version 1.0.0, current version 1.0.9)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.0.0)

Looks like macdeployqt did not properly resolve @loader_path (but also no errors in the build logs… it didn't attempt? Is that because macdeployqt thinks libbrotlicommon is a system package maybe? Is Homebrew fundamentally incompatible with macdeployqt?

@jelmervdl
Copy link
Collaborator Author

For anyone not me or Nick: #68 seems to have solved all woes in regards to building distributable macOS bundles by using Qt's own Qt distribution.

@jelmervdl
Copy link
Collaborator Author

jelmervdl commented Dec 3, 2021

Sticking this here for bookmarking & reference:

@XapaJIaMnu
Copy link
Owner

Since we have automatic deployment now, I am going to close this.

XapaJIaMnu added a commit that referenced this issue Dec 14, 2021
Small update to readme with regards to #69
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

No branches or pull requests

2 participants