Macdeployqt无法找到任何外部Qt框架来部署

时间:2016-06-08 12:06:57

标签: c++ qt deployment qml macdeployqt

我在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)

1 个答案:

答案 0 :(得分:2)

在我们chat的讨论之后,您似乎设法让它运转起来,这太棒了!正如我所怀疑的那样,你的@rpath有误导性(我猜是Qt的错)。因此,修复它的方法是使用@executable_path而不是@rpath链接Qt库(您可以here知道差异)。

为此,请按照以下步骤操作:

1 /运行可执行文件本身:您将收到如下错误消息:

  

dyld:未加载库:@ rpath / Qt * .framework / Versions / 5 / Qt *

     

参考:   your_executable_name

     

原因:未找到图像Trace / 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进行检查)。

3 /如果更改正确,您可以再没有问题,或者您必须为其他Qt库执行此操作。实际上,*可以是Quick,但它也可以是GuiNetwork等(事实上是Qt库)。所以回到第1步!

完成所有库后,您的应用程序将按照您的需要启动。