Error deploying Qt application on OS X
-
I'm trying to deploy a Qt application on OS X using
macdeployqt
:macdeployqt MyApplication.app -dmg
The application uses the Qwt library, which is being included in the PRO file as follows:
macx: QWT_ROOT = /usr/local/qwt-6.1.0
include ( $${QWT_ROOT}/features/qwt.prf )
When I run the
macdeployqt
command I get the following error message:ERROR: no file at "/Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/qwt"
I'm not sure but it seems the deployment step is looking for the Qwt library on the wrong path, for example:
"/Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/qwt"
When it should be:
"/Library/Frameworks/qwt.framework/Versions/6/qwt"
How can I solve it?
-
on console you write:
man otool |enterhttp://www.manpagez.com/man/1/otool/
or mouse:
http://www.vmeisoft.com/dependency-walker-for-mac/
framework binding to app
install_name_tool -change "$QTDIR/lib/$lib.framework/Versions/4/$lib"
"@executable_path/../Frameworks/$lib.framework/Versions/4/$lib"
"$bundle_bin"echo "...$lib done."
sample:
https://github.com/pehohlva/xhtml_edit_qedit_base/blob/master/mac_bundle/grep.shmacdeployqt make bundle only from qt framework...
or static lib or otool. :-) -
@patrik08 Sorry, but I could not understand your answer (maybe because English is not my first language), can you be more specific/clear on how can I solve it?.
Just a note: the command
macdeployqt MyApplication -dmg
stopped to work after I have installed Qt 5.9. It always worked well when I was using only Qt 5.3.2. -
here..
http://thecourtsofchaos.com/2013/09/16/how-to-copy-and-relink-binaries-on-osx/macdeployqt not understand
Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/qwt -
This is a sample output fromm otool
cd OasisEdit.app/Contents/MacOS OasisEdit MacBook-Pro-di-dev:MacOS dev$ MacBook-Pro-di-dev:MacOS dev$ otool -L ./OasisEdit ./OasisEdit: @rpath/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.9.0, current version 5.9.1) @rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.9.0, current version 5.9.1) @rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.9.0, current version 5.9.1) @rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.9.0, current version 5.9.1) /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) @rpath/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.9.0, current version 5.9.1) @rpath/QtPdfium.framework/Versions/5/QtPdfium (compatibility version 5.5.0, current version 5.5.0) @rpath/QtXml.framework/Versions/5/QtXml (compatibility version 5.9.0, current version 5.9.1) @rpath/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.9.0, current version 5.9.1) @rpath/QtTextToSpeech.framework/Versions/5/QtTextToSpeech (compatibility version 5.9.0, current version 5.9.2) /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/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
after you chance install_name_tool -change
from local framework to bundle dir.. & copy the framework to bundle ... -
@patrik08 thanks for the help, but I'm not finding the path I must change.
There is no
qwt.framework
in my Qt path:/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/
.When I run otool in MyApplication.app I get this:
cd MyApplication.app/Contents/MacOS otool -L ./MyApplication ./MyApplication: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1349.64.0) /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0) qwt.framework/Versions/6/qwt (compatibility version 6.1.0, current version 6.1.0) /opt/local/lib/libboost_system-mt.dylib (compatibility version 0.0.0, current version 0.0.0) /opt/local/lib/libboost_filesystem-mt.dylib (compatibility version 0.0.0, current version 0.0.0) /Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.3.0, current version 5.3.2) /Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.3.0, current version 5.3.2) /Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.3.0, current version 5.3.2) /Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.2) /Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.3.0, current version 5.3.2) /Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtSql.framework/Versions/5/QtSql (compatibility version 5.3.0, current version 5.3.2) /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/libc++.1.dylib (compatibility version 1.0.0, current version 307.5.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.50.2) `
-
@KelvinSP said in Error deploying Qt application on OS X:
qwt.framework/Versions/6/qwt
Ok...
waht is this?
qwt.framework/Versions/6/qwt#!/bin/bash dir=$(pwd) echo "$dir" echo RUNNING Clean .... hight voltage...rm!! rm -rf MyApplication.app .moc .obj .rcc mkspecs Makefile .qmake.stash .qmake.cache find . -name '.DS_Store' -type f -delete find . -name 'Makefile' -type f -delete find . -name 'Makefile.Release' -type f -delete find . -name 'Makefile.Debug' -type f -delete qmake && make && macdeployqt MyApplication.app
run this…
at end rename for 5 min. dir /Users/kelvinsp/Qt5.3.2/ to /Users/kelvinsp/____Qt5.3.2/
test your bundle if run and if not run must link more shared elements…#only at end … if sure lib are inside -dmg
-
Hi,
Because it's locate in
/usr/local/qwt-6.1.0
as you show in your post.The most simple thing to do is to use
install_name_tool
and change the -id property so it contains the full path to the lib. Then it should be locatable by macdeployqt. One other possibility is to use @rpath rather than the full path like shown in @patrik08 example otool call. -
@patrik08 Ok... When I run the
qmake && make && macdeployqt MyApplication.app
command I get the following result:Usage: qmake [mode] [options] [files] QMake has two modes, one mode for generating project files based on some heuristics, and the other for generating makefiles. Normally you shouldn't need to specify a mode, as makefile generation is the default mode for qmake, but you may use this to test qmake on an existing project Mode: -project Put qmake into project file generation mode In this mode qmake interprets files as files to be built, defaults to *; *; *; *.ts; *.xlf; *.qrc Note: The created .pro file probably will need to be edited. For example add the QT variable to specify what modules are required. -makefile Put qmake into makefile generation mode (default) In this mode qmake interprets files as project files to be processed, if skipped qmake will try to find a project file in your current working directory Warnings Options: -Wnone Turn off all warnings; specific ones may be re-enabled by later -W options -Wall Turn on all warnings -Wparser Turn on parser warnings -Wlogic Turn on logic warnings (on by default) -Wdeprecated Turn on deprecation warnings (on by default) Options: * You can place any variable assignment in options and it will be * * processed as if it was in [files]. These assignments will be * * processed before [files] by default. * -o file Write output to file -d Increase debug level -t templ Overrides TEMPLATE as templ -tp prefix Overrides TEMPLATE so that prefix is prefixed into the value -help This help -v Version information -early All subsequent variable assignments will be parsed right before default_pre.prf -before All subsequent variable assignments will be parsed right before [files] (the default) -after All subsequent variable assignments will be parsed after [files] -late All subsequent variable assignments will be parsed right after default_post.prf -norecursive Don't do a recursive search -recursive Do a recursive search -set <prop> <value> Set persistent property -unset <prop> Unset persistent property -query <prop> Query persistent property. Show all if <prop> is empty. -qtconf file Use file instead of looking for qt.conf -cache file Use file as cache [makefile mode only] -spec spec Use spec as QMAKESPEC [makefile mode only] -nocache Don't use a cache file [makefile mode only] -nodepend Don't generate dependencies [makefile mode only] -nomoc Don't generate moc targets [makefile mode only] -nopwd Don't look for files in pwd [project mode only]
-
man insall_name_tool
explains all options. -
Here config target from qwt ...
You can also chance the qmake from qwt and build a static lib..unix { QWT_INSTALL_PREFIX = /usr/local/qwt-$$QWT_VERSION # QWT_INSTALL_PREFIX = /usr/local/qwt-$$QWT_VERSION-qt-$$QT_VERSION } /usr/local/qwt-6.1.3
or adapt th script from https://raw.githubusercontent.com/pehohlva/xhtml_edit_qedit_base/master/mac_bundle/grep.sh
-
Also my best simply solution is:
/// on qwt macdeployqt say: macdeployqt radio.app ERROR: no file at "/Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/qwt"
Also i tested:
console: sudo mkdir -p /Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/ after you make a symply bridge as virtual link. ln -s /usr/local/qwt-6.1.3/lib/qwt.framework/Versions/Current/qwt \ /Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/qwt
at end :
macdeployqt radio.app
make a super job and link & copy all in the bundle :-)
by by ... -
@patrik08 I have tried it and it worked (at least the message it's gone). As I understand it doesn't fix the problem directly but it's a great workaround.
The only problem is that now I'm getting the following errors when trying to run
macdeployqt MyApplication.app -dmg
:ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtSvg.framework/Contents/Info.plist" ERROR: to "MyApplication.app/Contents/Frameworks/QtSvg.framework/Resources/Info.plist" QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtSvg.framework/Resources/Info.plist"): device not open QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtSvg.framework/Resources/Info.plist"): device not open ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtWidgets.framework/Contents/Info.plist" ERROR: to "MyApplication.app/Contents/Frameworks/QtWidgets.framework/Resources/Info.plist" QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtWidgets.framework/Resources/Info.plist"): device not open QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtWidgets.framework/Resources/Info.plist"): device not open ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtGui.framework/Contents/Info.plist" ERROR: to "MyApplication.app/Contents/Frameworks/QtGui.framework/Resources/Info.plist" QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtGui.framework/Resources/Info.plist"): device not open QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtGui.framework/Resources/Info.plist"): device not open ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtCore.framework/Contents/Info.plist" ERROR: to "MyApplication.app/Contents/Frameworks/QtCore.framework/Resources/Info.plist" QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtCore.framework/Resources/Info.plist"): device not open QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtCore.framework/Resources/Info.plist"): device not open ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtPrintSupport.framework/Contents/Info.plist" ERROR: to "MyApplication.app/Contents/Frameworks/QtPrintSupport.framework/Resources/Info.plist" QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtPrintSupport.framework/Resources/Info.plist"): device not open QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtPrintSupport.framework/Resources/Info.plist"): device not open ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtSql.framework/Contents/Info.plist" ERROR: to "MyApplication.app/Contents/Frameworks/QtSql.framework/Resources/Info.plist" QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtSql.framework/Resources/Info.plist"): device not open QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtSql.framework/Resources/Info.plist"): device not open ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtOpenGL.framework/Contents/Info.plist" ERROR: to "MyApplication.app/Contents/Frameworks/QtOpenGL.framework/Resources/Info.plist" QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtOpenGL.framework/Resources/Info.plist"): device not open QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtOpenGL.framework/Resources/Info.plist"): device not open ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtConcurrent.framework/Contents/Info.plist" ERROR: to "MyApplication.app/Contents/Frameworks/QtConcurrent.framework/Resources/Info.plist" QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtConcurrent.framework/Resources/Info.plist"): device not open QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtConcurrent.framework/Resources/Info.plist"): device not open
-
The app run without -dmg?
can you open app & work it?
I like to look this app like this...
https://www.youtube.com/watch?v=hJDvKud8RWs
search Mac Screen Recorder ... -
@KelvinSP said in Error deploying Qt application on OS X:
macdeployqt
The job from macdeployqt is only take all file and relink lib or framework .. if file an all exist its not give problem..
to build a dir/bundle & at end hdiutil create a bzip2 compressed dmg image like a iso file... -
Did you re-run macdeployqt several times on the same app bundle ? If so, you'll get a message telling you that it already has run.
-
@SGaist Yes, I did. I received the following message:
WARNING: Could not find any external Qt frameworks to deploy in "MyApplication.app" WARNING: Perhaps macdeployqt was already used on "MyApplication.app" ? WARNING: If so, you will need to rebuild "MyApplication.app" before trying again.
The DMG file was created but the application still not working (when double clicking).
Note: every time I test a new
macdelpoyqt
command, I rebuild the project first. -
I have uninstalled other qt versions using
brew list
,brew remove qt
andbrew remove qt5
. I also noted that I had pyqt installed (and I was not using it), so I also remove it usingbrew remove pyqt
.Then, I have reinstalled Qt 5.3.2 and had other issues:
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
Which was solved changing the
isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null")))
command from theQt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf
file toisEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))
, as explained here: https://stackoverflow.com/questions/33728905/qt-creator-project-error-xcode-not-set-up-properly-you-may-need-to-confirm-tand
Could not resolve SDK path for 'macosx10.8'
That was solved by changing the
QtPath/5.3/clang_64/mkspecs/qdevice.pri
from!host_build:QMAKE_MAC_SDK = macosx10.8
to!host_build:QMAKE_MAC_SDK = macosx10.12
, as explained here: https://stackoverflow.com/questions/26320677/error-could-not-resolve-sdk-path-for-macosx10-8So, I run the command from my Qt directory:
/Users/kuser/Qt5.3.2/5.3/clang_64/bin/macdeployqt MyApplication.app -dmg
and it worked.
I found these solutions in comments from the following question:
https://stackoverflow.com/questions/19988129/qt5-cannot-find-platform-plugins-mac-os-x