【问题标题】:Qt windeployqt for debug version does'nt copy all dll's用于调试版本的 Qt windeployqt 不会复制所有 dll
【发布时间】:2018-02-13 15:24:12
【问题描述】:

我在 Windows 10 下的 qt 部署有问题。一开始,我在 Windows 10 上使用 QtCreator 4.5.0 和 Qt 5.10。对于部署,我像这个问题中的 awnser 一样配置我的项目文件(@ 987654321@) 一年多以来,它运行良好,但自去年年底以来就没有了。 如果我构建发布版本一切都很好,但在调试模式下,一些 dll 丢失了。如果我手动复制这些程序运行正确,否则不会显示任何图标。到目前为止,我可以在 git 中看到它,项目文件中没有任何修改,因为它终于可以正常工作了。


项目文件中的部署行:



    #######################################
    # Deploy Settings

    TARGET_CUSTOM_EXT = .exe
    DEPLOY_COMMAND = windeployqt

    ProgramData.path = C:/ProgramData/Application
    ProgramData.files += ressource/xml/config.xml
    ProgramData.files += ressource/xml/user.xml
    ProgramData.files += ressource/xml/documentation.xml
    INSTALLS += ProgramData

    # copy to make install
    CONFIG( release ) {
        AdditionalFiles.path = $${OUT_PWD}/$${DESTDIR}/ressource
        AdditionalFiles.files += ressource/xml/config.xml
        AdditionalFiles.files += ressource/xml/user.xml
        AdditionalFiles.files += ressource/xml/documentation.xml
        AdditionalFiles.files += ressource/install.nsi
        AdditionalFiles.files += release_notes/*.txt
        INSTALLS += AdditionalFiles
    }

    CONFIG( debug, debug|release ) {
        DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/debug/$${TARGET}$${TARGET_CUSTOM_EXT}))
    } else {
        DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/release/$${TARGET}$${TARGET_CUSTOM_EXT}))
    }

    QMAKE_POST_LINK += $${DEPLOY_COMMAND} $${DEPLOY_TARGET}


这是我完整的项目文件:


    QT       += core gui network widgets winextras

    TARGET = Application
    TEMPLATE = app

    TRANSLATIONS = \
        translation/Application_de.ts \
        translation/Application_en.ts \
        translation/Application_es.ts \
        translation/Application_fr.ts \
        translation/Application_nl.ts

    # Settings for favicon/tasksymbol
    win32:RC_ICONS += ressource/favicon/favicon.ico


    QMAKE_CXXFLAGS += -std=c++11
    DEFINES = QT_MESSAGELOGCONTEXT

    build_pass:CONFIG(debug, debug|release) {
        CONFIG += warn_on
    }

    #######################################
    # Build dir settings

    Release:DESTDIR = release
    Release:OBJECTS_DIR = release/.obj
    Release:MOC_DIR = release/.moc
    Release:RCC_DIR = release/.rcc
    Release:UI_DIR = release/.ui

    Debug:DESTDIR = debug
    Debug:OBJECTS_DIR = debug/.obj
    Debug:MOC_DIR = debug/.moc
    Debug:RCC_DIR = debug/.rcc
    Debug:UI_DIR = debug/.ui

    #######################################
    # Deploy Settings

    TARGET_CUSTOM_EXT = .exe
    DEPLOY_COMMAND = windeployqt

    ProgramData.path = C:/ProgramData/Application
    ProgramData.files += ressource/xml/config.xml
    ProgramData.files += ressource/xml/user.xml
    ProgramData.files += ressource/xml/documentation.xml
    INSTALLS += ProgramData

    # copy to make install
    CONFIG( release ) {
        AdditionalFiles.path = $${OUT_PWD}/$${DESTDIR}/ressource
        AdditionalFiles.files += ressource/xml/config.xml
        AdditionalFiles.files += ressource/xml/user.xml
        AdditionalFiles.files += ressource/xml/documentation.xml
        AdditionalFiles.files += ressource/install.nsi
        AdditionalFiles.files += release_notes/*.txt
        INSTALLS += AdditionalFiles
    }

    CONFIG( debug, debug|release ) {
        DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/debug/$${TARGET}$${TARGET_CUSTOM_EXT}))
    } else {
        DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/release/$${TARGET}$${TARGET_CUSTOM_EXT}))
    }

    QMAKE_POST_LINK += $${DEPLOY_COMMAND} $${DEPLOY_TARGET}

    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which as been marked as deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS

    #######################################
    # Main Project entry
    include ( src/app.pri)

    #######################################
    # Resource files

    RESOURCES += \
        ressource/Images/Images.qrc

    #######################################
    # Distfiles
    DISTFILES += \
        ressource/install.nsi \
        favicon.ico

    # XML Files
    DISTFILES += \
        ressource/config.xml \
        ressource/user.xml \    
        ressource/documentation.xml

    # Release Notes
    DISTFILES += \
        release_notes/4_2_0.txt \
        release_notes/4_2_3.txt \
        release_notes/4_3_0.txt \
        release_notes/Template.txt

    # Translation
    DISTFILES += \
        translation/convert_cute_TS_to_gnu_PO.sh \
        translation/convert_gnu_PO_to_cute_TS.sh

windeployqt --list 调试和发布版本映射的输出:

有人有什么想法或提示让我找到错误吗?

谢谢 斯文·阿诺·乔彭

【问题讨论】:

  • offtop - 您忘记在两个屏幕截图的最后一个 powershell 输出字符串中覆盖您的超级机密应用程序名称
  • 谢谢,这不是那么秘密,但不能太公开,这是这个项目的一部分:-D
  • 提交错误报告?

标签: qt qt5.10 windeployqt


【解决方案1】:

我无法解释为什么缺少 dll,但我可以告诉您,您可以通过在命令行中指定它们来手动强制它们。在下面的示例中,openglprintsupport 库被专门调用以进行复制。您还会注意到我们使用. 作为我们的目标。这使得windeployqt 查看所有 exe 和 dll 文件,看看它们还需要什么。

示例: windeployqt --opengl --printsupport .

【讨论】:

    【解决方案2】:
    • 我认为您不需要这些配置除非windeployqt 在debug 模式下并不真正工作。请注意,几乎所有 qt 二进制文件都包括debugrelease 二进制文件。

    • 要强制调试二进制文件的工具使用 --debug ,而 --release 生成发布二进制文件。

    windeployqt --debug --list mapping

    工具的一些选项:

    windeployqt:
      -?, -h, --help            Displays this help.
      -v, --version             Displays version information.
      --debug                   Assume debug binaries.
      --release                 Assume release binaries.
    

    【讨论】:

      【解决方案3】:

      在我将 Qt 5.9.1 更新到 5.10.1 并将 Creator 从 4.50 更新到 4.5.1 之后。 部署工具工作正常......这似乎是一个版本问题,但因为我没有找到具体问题,它只是推测性的。感谢您的回答!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-03-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多