无法在 mac 上安装 qwt 设计器插件
Posted
技术标签:
【中文标题】无法在 mac 上安装 qwt 设计器插件【英文标题】:Can't install qwt designer plugin on mac 【发布时间】:2016-07-06 08:23:54 【问题描述】:我无法在我的 Mac 上安装 qwt 设计器插件。 我已经下载了 v 6.1.3,并成功安装了 qmake、make 和 sudo make。
问题是在 /usr/local/qwt-6.1.3/lib 下我只有文件 qwt.framework,而不是像安装指南所说的 libqwt.5.dylib 之类的文件。出于这个原因,我不遵循指南....
【问题讨论】:
【参考方案1】:首先,Qwt 6 现在使用了一个框架。这意味着不再有qwt.dylib
文件。如果您想链接到它,只需将其添加到您的 .pro
文件中:
include ( /usr/local/opt/qwt/features/qwt.prf )
CONFIG += qwt
或者你的 qwt 安装文件夹在哪里。
原则上你可以简单地设置一个环境变量,例如
QT_PLUGIN_PATH="/usr/local/opt/qwt/lib/qt5/plugins:$QT_PLUGIN_PATH"
export QT_PLUGIN_PATH
但无论出于何种原因,这对我都不起作用。
扯掉了一些头发,但这是我通过自制软件让它工作的方法。
1) brew install qt5 qwt
2)brew cask install qt-creator
3) 将插件 dylib 复制到您的 Qt Creator 插件文件夹:
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) 将框架(递归)复制到 App 的 Frameworks 文件夹中:
sudo cp -R /usr/local/Cellar/qwt/6.1.3_1/lib/qwt.framework /Applications/Qt\ Creator.app/Contents/Frameworks/
5) 尝试运行 Qt Creator 并在您尝试打开表单设计器时发现它崩溃了。嘘。
6) 在插件dylib上运行otool -L
:
> 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)
此时你可以对比一个实际工作的插件,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)
好的,所以我们需要链接到本地版本的 Qt。您需要小心查找对 Qt 框架的每个引用。在这种情况下有两个地方:
1) 在插件dylib中
2) 在框架库中
这是我跑的:
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
请注意,在 qwt 中,有对 QtOpenGL
的引用。但是这个框架没有包含在我的 Qt Creator 版本中,所以我把它指向/usr/local/opt/ ...
。好像没什么区别。
最后我otool
的结果是:
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)
和:
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)
然后当你打开 Qt Creator 你应该看到这个:
【讨论】:
经过数小时的挫折,这是我让 Qwt 在 Mac 上运行的唯一方法!也能够适应非自制版本。 @Matt Eding,太棒了!如果您在使用安装了自制软件的库制作软件包时遇到问题,我还有一个方便的脚本来递归修复路径问题:github.com/jveitchmichaelis/deeplabel/blob/master/… 我发现当您安装自制软件时,软件包库往往指向 usr/local 这不是便携,应用程序会在其他机器上中断。以上是关于无法在 mac 上安装 qwt 设计器插件的主要内容,如果未能解决你的问题,请参考以下文章
12.手机端如何拖动组件--WEB设计器JQUERY插件讲解(含源码)
由于pyqt5 Python中没有qt插件初始化错误,Qt设计器无法启动