2

I made a simple animation in Qt/Qml. I can build the release version fine, with no errors. It also runs correctly. As the project is finished, I tried to deploy it with macdeployqt like this :

./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

but it gives me the following errors:

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.

Am I doing something wrong, or is there something wrong with my Qt installation? How do I fix this problem?

Note: This is my first time using macdeployqt.


Edit :

In order to check the libraires dependencies, I ran otool -L.

The result of 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 is this :

/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)
4

1 回答 1

4

按照我们在聊天中的讨论,您似乎设法让它工作了,太好了!正如我所怀疑的那样,你@rpath的误导(我猜是Qt的错)。所以修复它的方法是使用@executable_path而不是链接Qt库@rpath(你可以去这里了解区别)。

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

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)。

3/如果更改是正确的,要么你没有问题了,要么你必须为其他 Qt 库这样做。确实,*可以是Quick,但也可以是Gui,Network等(实际上是 Qt 库)。所以回到第一步!

完成所有库后,您的应用程序将按您的意愿启动。

于 2016-06-10T13:04:20.953 回答