dyld: Library not loaded when using Qt QtWebEngine

微笑、不失礼 提交于 2019-12-12 04:05:43

问题


I am getting this error when trying to run my app after using macdeployqt.

dyld: Library not loaded: @executable_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick Referenced from: /x/build-x-Desktop_Qt_5_4_2_clang_64bit-Release/x.app/Contents/Frameworks/QtWebEngineCore.framework/Versions/5/QtWebEngineCore Reason: image not found

It only happens with a QtWebEngine app. I have another that builds just fine usingn QtWebKit.

My otool results seem fine:

jimmys-MacBook-Air:osx jimmy$ otool -L /development/_build_desktop/Application-Screensaver/Webshots\ Desktop.app/Contents/MacOS/Desktop /development/_build_desktop/Application-Screensaver/Webshots Desktop.app/Contents/MacOS/Desktop: /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 20.0.0) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 48.0.0) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1056.16.0) /System/Library/Frameworks/StoreKit.framework/Versions/A/StoreKit (compatibility version 1.0.0, current version 232.11.0) @loader_path/../Frameworks/QtWebEngineWidgets.framework/Versions/5/QtWebEngineWidgets (compatibility version 5.4.0, current version 5.4.2) @loader_path/../Frameworks/QtWebEngine.framework/Versions/5/QtWebEngine (compatibility version 5.4.0, current version 5.4.2) @loader_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.4.0, current version 5.4.2) @loader_path/../Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.4.0, current version 5.4.2) @loader_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.4.0, current version 5.4.2) /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0) @loader_path/../Frameworks/QtQml.framework/Versions/5/QtQml (compatibility version 5.4.0, current version 5.4.2) @loader_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.4.0, current version 5.4.2) @loader_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.4.0, current version 5.4.2) @loader_path/../Frameworks/QtWebEngineCore.framework/Versions/5/QtWebEngineCore (compatibility version 5.4.0, current version 5.4.2) /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/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1265.21.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.17.0) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 59.0.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

Thanks, Jimmy


回答1:


Sorry, looks like the answer is in this bug report:

https://bugreports.qt.io/browse/QTBUG-41611

If your application includes QtWebEngine the macdeployqt application should also deploy QtWebEngineProcess and the support files needed. Currently this needs to be done manually.

FOR 5.4 YOU MUST RUN macdeployqt THE FOLLOWING WAY:

macdeployqt <TARGET>.app -executable=<TARGET>.app/Contents/MacOS/<TARGET>

macdeployqt only uses @loader_path when the -executable switch is non-empty, so passing an arbitrary exectable there triggers the behavior we need to let QtWebEngineProcess use the same Qt binaries as the main application executable.



来源:https://stackoverflow.com/questions/30677457/dyld-library-not-loaded-when-using-qt-qtwebengine

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!