macdeployqt错误:无法解析rpath“;QtGui.framework/Versions/5/QtGui(兼容版本5.5.0,当前版本5.5.0)";

macdeployqt错误:无法解析rpath“;QtGui.framework/Versions/5/QtGui(兼容版本5.5.0,当前版本5.5.0)";,qt,rpath,otool,macdeployqt,Qt,Rpath,Otool,Macdeployqt,我使用qmake在MacBook上编译Qt应用程序项目。 它需要一个名为libcore.dylib的动态库,我将它放入dir$$OUT\u PWD/。/libs 对于compile,我将此代码添加到.pro文件中 win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libs/release else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libs/

我使用qmake在MacBook上编译Qt应用程序项目。
它需要一个名为
libcore.dylib
的动态库,我将它放入dir
$$OUT\u PWD/。/libs


对于compile,我将此代码添加到
.pro
文件中

win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libs/release
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libs/debug
else:unix: LIBS += -L$$OUT_PWD/../libs
LIBS += -lcore
对于跑步,我补充道

macx {
    QMAKE_LFLAGS += -Wl,-rpath,$$OUT_PWD/../libs
}
为了编译
libcore.dylib
,我添加了

win32:CONFIG(release, debug|release): DESTDIR = $$OUT_PWD/../libs/release
else:win32:CONFIG(debug, debug|release): DESTDIR = $$OUT_PWD/../libs/debug
else:unix: DESTDIR = $$OUT_PWD/../libs
macx {
    QMAKE_SONAME_PREFIX = @rpath
}
完成后,我可以直接运行生成的应用程序。
但是当我使用
macdeployqt
部署应用程序时,会出现错误

ERROR: Cannot resolve rpath "QtGui.framework/Versions/5/QtGui (compatibility version 5.5.0, current version 5.5.0)"
ERROR:  using QSet("/Users/sjchao/Documents/QtBuild/project/debug/app/../libs")
ERROR: Cannot resolve rpath "QtCore.framework/Versions/5/QtCore (compatibility version 5.5.0, current version 5.5.0)"
ERROR:  using QSet("/Users/sjchao/Documents/QtBuild/project/debug/app/../libs")
ERROR: Cannot resolve rpath "QtGui.framework/Versions/5/QtGui (compatibility version 5.5.0, current version 5.5.0)"
ERROR:  using QSet("/Users/sjchao/Documents/QtBuild/project/debug/app/../libs")
ERROR: Cannot resolve rpath "QtCore.framework/Versions/5/QtCore (compatibility version 5.5.0, current version 5.5.0)"
ERROR:  using QSet("/Users/sjchao/Documents/QtBuild/project/debug/app/../libs")
ERROR: Cannot resolve rpath "QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.5.0, current version 5.5.0)"
ERROR:  using QSet("/Users/sjchao/Documents/QtBuild/project/debug/app/../libs")
RPATH的QSet不包含
/Users/sjchao/Applications/Qt/5.5/clang_64/lib

但是最终的编译cmd包含
-Wl、-rpath、/Users/sjchao/Applications/Qt/5.5/clang_64/lib
!它是无用的?
我看到了一点
macdeployqt
源代码,然后 我使用
otool-l
查看
LC\u RPATH

Load command 27
          cmd LC_RPATH
      cmdsize 112
         path /Users/sjchao/Documents/QtBuild/project/debug/app/../libs (offset 12)
Load command 28
          cmd LC_RPATH
      cmdsize 64
         path /Users/sjchao/Applications/Qt/5.5/clang_64/lib (offset 12)
请参阅中的一些代码

426 while(i.hasNext()){
427如果(i.next()包含(“cmd LC_RPATH”)和&i.hasNext())&&
428 i.next()包含(“cmdsize”)和&i.hasNext(){
429常量QString&rpathCmd=i.next();
430 int-pathStart=rpathCmd.indexOf(“路径”);
431 int path end=rpathCmd.indexOf(“”);
432如果(路径开始>=0&&pathEnd>=0&&pathStart435个路径你在@sjchao解决了这个问题吗?
426     while (i.hasNext()) {
427         if (i.next().contains("cmd LC_RPATH") && i.hasNext() &&
428         i.next().contains("cmdsize") && i.hasNext()) {
429             const QString &rpathCmd = i.next();
430             int pathStart = rpathCmd.indexOf("path ");
431             int pathEnd = rpathCmd.indexOf(" (");
432             if (pathStart >= 0 && pathEnd >= 0 && pathStart < pathEnd) {
433                 QString rpath = rpathCmd.mid(pathStart + 5, pathEnd - pathStart - 5);
434                 if (resolve) {
435                     rpaths << resolveDyldPrefix(rpath, path, executablePath);
436                 } else {
437                     rpaths << rpath;
438                 }
439             }
440         }
441     }