我用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安装有问题?我该如何解决这个问题?
Note:这是我第一次使用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)发布于 2016-06-10 13:04:20
按照我们在聊天中的讨论,您似乎成功地使它工作了,所以这很好!正如我所怀疑的,你的@rpath是误导的(我猜是Qt的错)。因此,修复它的方法是使用@executable_path而不是@rpath链接Qt库(您可以通过这里来了解两者之间的区别)。
要做到这一点,请遵循以下步骤:
1/运行可执行的本身:您将得到如下错误消息:
dyld:未加载的库:@rpath/Qt*..framework/Versions/5/Qt* 参考来源: your_executable_name 原因:图像未找到跟踪/BPT陷阱: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检查该路径)。
如果更改是正确的,那么要么您不再有问题了,要么您必须为其他Qt库这样做。的确,*可以是Quick,但也可以是Gui、Network等(Qt,实际上)。所以回到第一步!
一旦您完成了所有的lib,您的应用程序就会开始您想要的。
https://stackoverflow.com/questions/37702034
复制相似问题