问题
I am unable to install qwt designer plugin on my Mac. I have downloaded v 6.1.3, and successfully did qmake, make and sudo make install.
The problem is that under /usr/local/qwt-6.1.3/lib I have only the file qwt.framework, and not something like libqwt.5.dylib, as the installation guide says. For this reason I con't follow the guide....
回答1:
Firstly Qwt 6 now uses a framework. That means there is no qwt.dylib
file any more. If you want to link to it, you simply add this to your .pro
file:
include ( /usr/local/opt/qwt/features/qwt.prf )
CONFIG += qwt
Or wherever your qwt install folder is.
In principle you can simply set an environment variable e.g.
QT_PLUGIN_PATH="/usr/local/opt/qwt/lib/qt5/plugins:$QT_PLUGIN_PATH"
export QT_PLUGIN_PATH
But this didn't work for me for whatever reason.
Tore some hair out, but here's how I got it working via homebrew.
1) brew install qt5 qwt
2) brew cask install qt-creator
3) Copy the plugin dylib to your Qt Creator plugin folder:
sudo cp /usr/local/opt/qwt/lib/qt5/plugins/designer/libqwt_designer_plugin.dylib /Applications/Qt Creator.app/Contents/PlugIns/designerlibqwt_designer_plugin.dylib
4) Copy the framework (recursively) into the App's Frameworks folder:
sudo cp -R /usr/local/Cellar/qwt/6.1.3_1/lib/qwt.framework /Applications/Qt\ Creator.app/Contents/Frameworks/
5) Attempt to run Qt Creator and find it crashes when you try to open the form designer. Boo.
6) Run otool -L
on the plugin dylib:
> otool -L libqwt_designer_plugin.dylib
/usr/local/opt/qwt/lib/qt5/plugins/designer/libqwt_designer_plugin.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/Cellar/qwt/6.1.3_1/lib/qwt.framework/Versions/6/qwt (compatibility version 6.1.0, current version 6.1.3)
/usr/local/opt/qt5/lib/QtDesigner.framework/Versions/5/QtDesigner (compatibility version 5.7.0, current version 5.7.0)
/usr/local/opt/qt5/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.7.0, current version 5.7.0)
/usr/local/opt/qt5/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.7.0, current version 5.7.0)
/usr/local/opt/qt5/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.7.0, current version 5.7.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/QtXml.framework/Versions/5/QtXml (compatibility version 5.7.0, current version 5.7.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/libc++.1.dylib (compatibility version 1.0.0, current version 307.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
At this point you can compare to a plugin that actually works, qtquick:
libqquickwidget.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/QtDesigner.framework/Versions/5/QtDesigner (compatibility version 5.7.0, current version 5.7.0)
@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.7.0, current version 5.7.0)
@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.7.0, current version 5.7.0)
@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.7.0, current version 5.7.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)
@rpath/QtXml.framework/Versions/5/QtXml (compatibility version 5.7.0, current version 5.7.0)
@rpath/QtQuickWidgets.framework/Versions/5/QtQuickWidgets (compatibility version 5.7.0, current version 5.7.0)
@rpath/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.7.0, current version 5.7.0)
@rpath/QtQml.framework/Versions/5/QtQml (compatibility version 5.7.0, current version 5.7.0)
@rpath/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.7.0, current version 5.7.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/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)
Ok, so we need to link to the local versions of Qt. You need to be careful about finding every reference to a Qt framework. In this case there are two places:
1) In the plugin dylib
2) In the framework library
Here's what I ran:
sudo install_name_tool -change "/usr/local/opt/qt5/lib/QtGui.framework/Versions/5/QtGui" "@rpath/Frameworks/QtGui.framework/Versions/5/QtGui" libqwt_designer_plugin.dylib
sudo install_name_tool -change "/usr/local/opt/qt5/lib/QtCore.framework/Versions/5/QtCore" "@rpath/Frameworks/QtCore.framework/Versions/5/QtCore" libqwt_designer_plugin.dylib
sudo install_name_tool -change "/usr/local/opt/qt5/lib/QtWidgets.framework/Versions/5/QtWidgets" "@rpath/Frameworks/QtWidgets.framework/Versions/5/QtWidgets" libqwt_designer_plugin.dylib
sudo install_name_tool -change "/usr/local/opt/qt5/lib/QtDesigner.framework/Versions/5/QtDesigner" "@rpath/Frameworks/QtDesigner.framework/Versions/5/QtDesigner" libqwt_designer_plugin.dylib
sudo install_name_tool -change "/usr/local/opt/qt5/lib/QtXml.framework/Versions/5/QtXml" "@rpath/Frameworks/QtXml.framework/Versions/5/QtXml" libqwt_designer_plugin.dylib
sudo install_name_tool -change "/usr/local/Cellar/qwt/6.1.3_1/lib/qwt.framework/Versions/6/qwt" "@rpath/Frameworks/qwt.framework/Versions/6/qwt" libqwt_designer_plugin.dylib
sudo install_name_tool -change "/usr/local/opt/qt5/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport" "@rpath/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport" qwt
sudo install_name_tool -change "/usr/local/opt/qt5/lib/QtWidgets.framework/Versions/5/QtWidgets" "@rpath/Frameworks/QtWidgets.framework/Versions/5/QtWidgets" qwt
sudo install_name_tool -change "/usr/local/opt/qt5/lib/QtCore.framework/Versions/5/QtCore" "@rpath/Frameworks/QtCore.framework/Versions/5/QtCore" qwt
sudo install_name_tool -change "/usr/local/opt/qt5/lib/QtGui.framework/Versions/5/QtGui" "@rpath/Frameworks/QtGui.framework/Versions/5/QtGui" qwt
sudo install_name_tool -change "/usr/local/opt/qt5/lib/QtSvg.framework/Versions/5/QtSvg" "@rpath/Frameworks/QtSvg.framework/Versions/5/QtSvg" qwt
sudo install_name_tool -change "/usr/local/opt/qt5/lib/QtConcurrent.framework/Versions/5/QtConcurrent" "@rpath/Frameworks/QtConcurrent.framework/Versions/5/QtConcurrent" qwt
Note that in qwt, there's a reference to QtOpenGL
. However this framework wasn't included in my version of Qt Creator so I left it pointing to /usr/local/opt/ ...
. Didn't seem to make a difference.
Finally the result of my otool
is:
otool -L qwt
qwt:
/usr/local/opt/qwt/lib/qwt.framework/Versions/6/qwt (compatibility version 6.1.0, current version 6.1.3)
@rpath/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.7.0, current version 5.7.0)
@rpath/Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.7.0, current version 5.7.0)
@rpath/Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.7.0, current version 5.7.0)
@rpath/Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.7.0, current version 5.7.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)
@rpath/Frameworks/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.7.0, current version 5.7.0)
/usr/local/opt/qt5/lib/QtOpenGL.framework/Versions/5/QtOpenGL (compatibility version 5.7.0, current version 5.7.0)
@rpath/Frameworks/QtConcurrent.framework/Versions/5/QtConcurrent (compatibility version 5.7.0, current version 5.7.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/libc++.1.dylib (compatibility version 1.0.0, current version 307.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
and:
otool -L libqwt_designer_plugin.dylib
libqwt_designer_plugin.dylib:
/usr/local/opt/qwt/lib/qt5/plugins/designer/libqwt_designer_plugin.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/Frameworks/qwt.framework/Versions/6/qwt (compatibility version 6.1.0, current version 6.1.3)
@rpath/Frameworks/QtDesigner.framework/Versions/5/QtDesigner (compatibility version 5.7.0, current version 5.7.0)
@rpath/Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.7.0, current version 5.7.0)
@rpath/Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.7.0, current version 5.7.0)
@rpath/Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.7.0, current version 5.7.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)
@rpath/Frameworks/QtXml.framework/Versions/5/QtXml (compatibility version 5.7.0, current version 5.7.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/libc++.1.dylib (compatibility version 1.0.0, current version 307.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
Then when you open up Qt Creator you should see this:
来源:https://stackoverflow.com/questions/38219373/cant-install-qwt-designer-plugin-on-mac