arl / macdeployqtfix Goto Github PK
View Code? Open in Web Editor NEWTo bundle a Qt application on Mac OSX, there is macdeployqt. To finish the job there is macdeployqtfix! :white_check_mark:
License: MIT License
To bundle a Qt application on Mac OSX, there is macdeployqt. To finish the job there is macdeployqtfix! :white_check_mark:
License: MIT License
HI,
thanks for your code, it saved my life!
I stll have something weird happening with my code.
The code (https://github.com/aflux/neutrino/) links on libPythonQt (http://pythonqt.sourceforge.net/) which links on Python.
I installed homebrew and compiled pythonqt by hand
Then I compile my code and run both macdeployqt and macdeployqtfix.py and everything is fine except the Python framework linked by pythonqt
As you can see the dependencies of both Pythonqt libs are still pointing to /usr/local/Frameworks (although Python Frameworks get copied in my .app)
It should be macdeployqt job to fix this, but it seems it has a lot of problems....
I ended up fixing this with install_name_tool, but I was wondering if it was possible to add a hook to your script to fix this issue too.
many thanks!
These are the dependencies of Pytohnqt:
otool -L lib/libPythonQt.dylib
lib/libPythonQt.dylib:
libPythonQt.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
/usr/local/opt/qt5/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.5.0, current version 5.5.0)
/usr/local/opt/qt5/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.5.0, current version 5.5.0)
/usr/local/opt/qt5/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.5.0, current version 5.5.0)
/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
otool -L lib/libPythonQt_QtAll.dylib
lib/libPythonQt_QtAll.dylib:
libPythonQt_QtAll.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
libPythonQt.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/opt/qt5/lib/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets (compatibility version 5.5.0, current version 5.5.0)
/usr/local/opt/qt5/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.5.0, current version 5.5.0)
/usr/local/opt/qt5/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.5.0, current version 5.5.0)
/usr/local/opt/qt5/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.5.0, current version 5.5.0)
/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/usr/local/opt/qt5/lib/QtWebKit.framework/Versions/5/QtWebKit (compatibility version 5.5.0, current version 5.5.0)
/usr/local/opt/qt5/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.5.0, current version 5.5.0)
/usr/local/opt/qt5/lib/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.5.0, current version 5.5.0)
/usr/local/opt/qt5/lib/QtOpenGL.framework/Versions/5/QtOpenGL (compatibility version 5.5.0, current version 5.5.0)
/usr/local/opt/qt5/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.5.0, current version 5.5.0)
/usr/local/opt/qt5/lib/QtMultimediaWidgets.framework/Versions/5/QtMultimediaWidgets (compatibility version 5.5.0, current version 5.5.0)
/usr/local/opt/qt5/lib/QtMultimedia.framework/Versions/5/QtMultimedia (compatibility version 5.5.0, current version 5.5.0)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
/usr/local/opt/qt5/lib/QtXmlPatterns.framework/Versions/5/QtXmlPatterns (compatibility version 5.5.0, current version 5.5.0)
/usr/local/opt/qt5/lib/QtSql.framework/Versions/5/QtSql (compatibility version 5.5.0, current version 5.5.0)
/usr/local/opt/qt5/lib/QtXml.framework/Versions/5/QtXml (compatibility version 5.5.0, current version 5.5.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
The script seems to fail running on Python 3.12:
Traceback (most recent call last):
File "/Users/runner/work/Mudlet/b/ninja/macdeployqtfix.py", line 394, in <module>
main()
File "/Users/runner/work/Mudlet/b/ninja/macdeployqtfix.py", line 384, in main
if fix_main_binaries():
^^^^^^^^^^^^^^^^^^^
File "/Users/runner/work/Mudlet/b/ninja/macdeployqtfix.py", line 322, in fix_main_binaries
if fix_binary(GlobalConfig.exepath):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/runner/work/Mudlet/b/ninja/macdeployqtfix.py", line 306, in fix_binary
for dep in get_dependencies(binary):
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/runner/work/Mudlet/b/ninja/macdeployqtfix.py", line 63, in get_dependencies
deps = [s.strip().split(' ')[0] for s in proc_out.stdout.splitlines()[1:] if s]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/runner/work/Mudlet/b/ninja/macdeployqtfix.py", line 63, in <listcomp>
deps = [s.strip().split(' ')[0] for s in proc_out.stdout.splitlines()[1:] if s]
^^^^^^^^^^^^^^^^^^^^
TypeError: a bytes-like object is required, not 'str'
Error: Process completed with exit code 1.
Thanks a lot for this great tool that makes it possible for me to use macdeployqt
on current versions of Qt with brew on Travis CI for https://github.com/pbek/QOwnNotes!
And a big thank you to @iltommi for fixing the problems with brew!
This was bugging me for ages in QOwnNotes! macdeployqt
is still broken in Qt 5.8, but the app works like a charm after running macdeployqtfix
! (Qt 5.5.1 on brew was the last version where macdeployqt
worked.)
Hi,
the dependencies that the tool mainly finds start like @rpath/QtWidgets.framework/Versions/5/QtWidgets
However, they are not recognized by the tool to be a lib, so nothing happens.
The tool will add all platform files etc., but no lib, which is why the app will not start afterwards with the crash message that the library QtWidgets could not be found. Any ideas?
Edit:
Okay, it seemed that there was some error in macdeployqt
already which lied in differing versions of Xcode and install_name_tool. The latter comes from command line tools, which need to be exactly the same as the ones of Xcode. Command line tools can be found here: https://developer.apple.com/download
Then, macdeployqt
will have fewer errors and macdeployqtfix
can do its job. Thank you for this great tool!
It would be quite simple to prepare a travis script that builds a Qt application, then checks that macdeployqtfix
does its job.
Best thing would be to trigger the macdeployqt
problem with a minimal qt command line app, so as to be able to check that it doesn't run, due to missing deps, after the macdeployqt
step, but runs correctly, after the macdeployqtfix
step.
Hi,
first of all thank you for this nifty script. One problem I have, though. It does not copy the PlugIns/platforms libs. And get this error:
This application failed to start because it could not find or load the Qt platform plugin "cocoa".
Reinstalling the application may fix this problem. The program has unexpectedly finished.
Recommendation to use $(brew --prefix qt5)/bin/qmake -query QT_INSTALL_PREFIX
to detect a sane default for qtpath
so that automated build systems can use whichever qt version is available to the system.
Pardon my lack of python knowledge, the proof of concept is provided in shell script format.
#!/bin/bash
# wtfpl license
# If "qtpath" is already set internally, use the prefix provided
if [ -z "$qtpath" ]; then
which brew > /dev/null 2>&1
if [ $? -eq 0 ]; then
# Homebrew is installed, the Qt "bin" prefix needs to be calculated first
which qmake > /dev/null 2>&1
if [ $? -ne 0 ]; then
# Add Qt "bin" to the search path, so we can call "qmake -query"
export PATH=PATH:$(brew --prefix qt5)/bin
fi
fi
qtpath="$(qmake -query QT_INSTALL_PREFIX)/"
echo $qtpath
fi
Sample output:
/usr/local/Cellar/qt5/5.6.1/
Hi,
I used to use your tool for generating my app bundle on travis-ci. But lately some changes did break our build with such errors from macdeployqtfix:
python macdeployqtfix.py build/$APP.app/Contents/MacOS/[secure] /usr/local/Cellar/qt5/5.*/
Traceback (most recent call last):
File "macdeployqtfix.py", line 15, in <module>
import ipdb
ImportError: No module named ipdb
Any idea on the cause of that?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.