【问题标题】:QT Quick (QML) assemble mac-.bundle -> not a dynamic library error when using macdeployqtQT Quick (QML) assemble mac-.bundle -> 使用 macdeployqt 时不是动态库错误
【发布时间】:2017-03-01 03:49:24
【问题描述】:

我已经为此苦苦挣扎了好几个星期,希望有人觉得这很有用或知道答案。 - 我使用 QT 5.7 和 QT 5.8,两个版本都出现错误。

我有一个 QT Quick 2.0 应用程序,我使用 macdeployqt 在 Mac 上将其构建为动态链接的 .bundle 应用程序。

我使用以下参数调用 macdeployqt: %{buildDir}/imageDatabase.app -qmldir=%{buildDir}/../UserInterface/ -always-overwrite -verbose=2

工作目录是 $QTDIR/bin 因为 macdeploy 需要从 QT-Installation 目录中运行,正如我在这里学到的:https://forum.qt.io/topic/59030/solved-macdeployqt-problem/6

当我尝试运行应用程序时出现以下错误:

  • 双击:应用程序打开,图标出现在底部的栏中,但除此之外没有任何反应
  • 从终端启动应用程序:

输出

Machine:MacOS MyName$ ./tool 
QQmlApplicationEngine failed to load component qrc:/main.qml:1 plugin cannot be 
loaded for module "QtQuick": '/Users/thorstenbux/DAQRI/gitHub/artoolkit6/Source/Utilities/ImageDBSerialiser/build-ui/imageDatabase.app/Contents/PlugIns/quick/libqtquick2plugin.dylib' 
is not a valid Mach-O binary (not a dynamic library)
  • 在相关库上调用 file 会显示以下内容

Machine:MacOS MyName$ file /Users/myname/client/gitHub/tool/SDK/Applications/tool.app/Contents/PlugIns/quick/libqtquickcontrolsplugin.dylib /Users/myname/client/gitHub/tool/SDK/Applications/tool.app/Contents/PlugIns/quick/libqtquickcontrolsplugin.dylib: Mach-O 64-bit dSYM companion file x86_64

看起来它正在加载调试库。

macdeployqt 错误信息如下:

ERROR: Could not parse otool output: "/Users/myname/DAQRI/gitHub/tool/Source/Utilities/tool/build-tool-Desktop_Qt_5_8_0_clang_64bit-Release/tool.app/Contents/PlugIns/quick/libqtquick2plugin.dylib:\n"

有什么想法吗?

【问题讨论】:

    标签: c++ macos qt qtquick2


    【解决方案1】:

    我终于在QT论坛找到了解决办法。看起来 macdeployqt 有一个严重的错误:https://bugreports.qt.io/browse/QTBUG-57265

    您需要在没有-always-overwrite 选项的情况下调用macdeployqt。 非常感谢 Andy Shaw 在这里发布: https://bugreports.qt.io/browse/QTBUG-57265?focusedCommentId=346168&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-346168

    【讨论】:

    • 我遇到了同样的问题,这解决了它。谢谢!
    猜你喜欢
    • 2017-01-16
    • 1970-01-01
    • 2013-11-10
    • 1970-01-01
    • 2022-01-25
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    • 2018-10-14
    相关资源
    最近更新 更多