Macdeployqt 找不到要部署的任何外部 Qt 框架
Macdeployqt could not find any external Qt frameworks to deploy
我在Qt/Qml中制作了一个简单的动画。
我可以很好地构建发布版本,没有错误。它也能正常运行。项目完成后,我尝试像这样用 macdeployqt
部署它:
./Qt/5.6/clang_64/bin/macdeployqt /Users/etcg/Documents/qt/build-Windmill-Animation-Executer-Desktop_Qt_5_6_0_clang_64bit-Release/Windmill-Animation-Executer.app
但它给了我以下错误:
WARNING:
WARNING: Could not find any external Qt frameworks to deploy in "/Users/etcg/Documents/qt/build-Windmill-Animation-Executer-Desktop_Qt_5_6_0_clang_64bit-Release/Windmill-Animation-Executer.app"
WARNING: Perhaps macdeployqt was already used on "/Users/etcg/Documents/qt/build-Windmill-Animation-Executer-Desktop_Qt_5_6_0_clang_64bit-Release/Windmill-Animation-Executer.app" ?
WARNING: If so, you will need to rebuild "/Users/etcg/Documents/qt/build-Windmill-Animation-Executer-Desktop_Qt_5_6_0_clang_64bit-Release/Windmill-Animation-Executer.app" before trying again.
是我做错了什么,还是我的Qt安装有问题?我该如何解决这个问题?
注意:这是我第一次使用macdeployqt
。
编辑:
为了检查依赖库,我运行 otool -L
.
otool -L /Users/etcg/Documents/qt/build-Windmill-Animation-Executer-Desktop_Qt_5_6_0_clang_64bit-Release/Windmill-Animation-Executer.app/Contents/MacOS/Windmill-Animation-Executer
的结果是这样的:
/Users/etcg/Documents/qt/build-Windmill-Animation-Executer-Desktop_Qt_5_6_0_clang_64bit-Release/Windmill-Animation-Executer.app/Contents/MacOS/Windmill-Animation-Executer:
@rpath/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.6.0, current version 5.6.0)
@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.6.0, current version 5.6.0)
@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.6.0, current version 5.6.0)
@rpath/QtQml.framework/Versions/5/QtQml (compatibility version 5.6.0, current version 5.6.0)
@rpath/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.6.0, current version 5.6.0)
@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.6.0, current version 5.6.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)
跟着我们在chat, it seems that you managed to get it working, so that's great! As I suspected, your @rpath
was misleading (Qt's fault I guess). So the way to fix it is to link the Qt libraries using @executable_path
instead of @rpath
(you can go here中的讨论就知道区别了)。
为此,请按照下列步骤操作:
1/ 运行 可执行文件 本身 :您将收到如下错误消息:
dyld: Library not loaded: @rpath/Qt*.framework/Versions/5/Qt*
Referenced from:
your_executable_name
Reason: image not found Trace/BPT trap: 5
其中 *
是 Qt 库的名称。您被告知该库未被很好地引用,因此 您必须更改引用它的路径 。
2/ 要做到这一点,使用命令 install_name_tool
像这样:
install_name_tool -change @rpath/Qt*.framework/Versions/5/Qt* @executable_path/your/path/to/the/framework/Qt*.framework/Versions/5/Qt* /your/path/to/your/executable
现在,您已经更改了路径(您可以使用 otool -L
检查)。
3/ 如果更改正确,要么你没有问题了,要么你必须为其他 Qt 库执行此操作。实际上,*
可以是 Quick
,但也可以是 Gui
、Network
等(实际上是 Qt 库)。所以回到第 1 步!
完成所有库后,您的应用程序将按照您的需要启动。
我在Qt/Qml中制作了一个简单的动画。
我可以很好地构建发布版本,没有错误。它也能正常运行。项目完成后,我尝试像这样用 macdeployqt
部署它:
./Qt/5.6/clang_64/bin/macdeployqt /Users/etcg/Documents/qt/build-Windmill-Animation-Executer-Desktop_Qt_5_6_0_clang_64bit-Release/Windmill-Animation-Executer.app
但它给了我以下错误:
WARNING:
WARNING: Could not find any external Qt frameworks to deploy in "/Users/etcg/Documents/qt/build-Windmill-Animation-Executer-Desktop_Qt_5_6_0_clang_64bit-Release/Windmill-Animation-Executer.app"
WARNING: Perhaps macdeployqt was already used on "/Users/etcg/Documents/qt/build-Windmill-Animation-Executer-Desktop_Qt_5_6_0_clang_64bit-Release/Windmill-Animation-Executer.app" ?
WARNING: If so, you will need to rebuild "/Users/etcg/Documents/qt/build-Windmill-Animation-Executer-Desktop_Qt_5_6_0_clang_64bit-Release/Windmill-Animation-Executer.app" before trying again.
是我做错了什么,还是我的Qt安装有问题?我该如何解决这个问题?
注意:这是我第一次使用macdeployqt
。
编辑:
为了检查依赖库,我运行 otool -L
.
otool -L /Users/etcg/Documents/qt/build-Windmill-Animation-Executer-Desktop_Qt_5_6_0_clang_64bit-Release/Windmill-Animation-Executer.app/Contents/MacOS/Windmill-Animation-Executer
的结果是这样的:
/Users/etcg/Documents/qt/build-Windmill-Animation-Executer-Desktop_Qt_5_6_0_clang_64bit-Release/Windmill-Animation-Executer.app/Contents/MacOS/Windmill-Animation-Executer:
@rpath/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.6.0, current version 5.6.0)
@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.6.0, current version 5.6.0)
@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.6.0, current version 5.6.0)
@rpath/QtQml.framework/Versions/5/QtQml (compatibility version 5.6.0, current version 5.6.0)
@rpath/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.6.0, current version 5.6.0)
@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.6.0, current version 5.6.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)
跟着我们在chat, it seems that you managed to get it working, so that's great! As I suspected, your @rpath
was misleading (Qt's fault I guess). So the way to fix it is to link the Qt libraries using @executable_path
instead of @rpath
(you can go here中的讨论就知道区别了)。
为此,请按照下列步骤操作:
1/ 运行 可执行文件 本身 :您将收到如下错误消息:
dyld: Library not loaded: @rpath/Qt*.framework/Versions/5/Qt*
Referenced from: your_executable_name
Reason: image not found Trace/BPT trap: 5
其中 *
是 Qt 库的名称。您被告知该库未被很好地引用,因此 您必须更改引用它的路径 。
2/ 要做到这一点,使用命令 install_name_tool
像这样:
install_name_tool -change @rpath/Qt*.framework/Versions/5/Qt* @executable_path/your/path/to/the/framework/Qt*.framework/Versions/5/Qt* /your/path/to/your/executable
现在,您已经更改了路径(您可以使用 otool -L
检查)。
3/ 如果更改正确,要么你没有问题了,要么你必须为其他 Qt 库执行此操作。实际上,*
可以是 Quick
,但也可以是 Gui
、Network
等(实际上是 Qt 库)。所以回到第 1 步!
完成所有库后,您的应用程序将按照您的需要启动。