【问题标题】:Integrating Crashpad with a Windows Qt application将 Crashpad 与 Windows Qt 应用程序集成
【发布时间】:2020-06-15 20:05:12
【问题描述】:

我们正在尝试将 Crashpad 与我们的 Qt 应用程序集成,但遇到了几个错误。我们构建了 Crashpad 并尝试使用 .pro 文件中的以下 sn-p 将其链接到我们的应用程序:

# Crashpad rules for Windows
win32 {
    LIBS += -L$$PWD/Crashpad/Libraries/Windows/ -lbase
    LIBS += -L$$PWD/Crashpad/Libraries/Windows/ -lclient
    LIBS += -L$$PWD/Crashpad/Libraries/Windows/ -lutil
}

在构建时,我们遇到了大量类似于以下的链接器错误:

base.lib(base.file_path.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MDd_DynamicDebug' in main.obj

我们看到了 post 并决定使用 /MDd 标志构建 Crashpad。将新库复制到上面列出的目录后,使用 Qt 构建会产生以下错误:

fatal error C1007: unrecognized flag '-Ot' in 'p2'

为什么 MSVC 会抛出此错误?我们正在使用 14.0 MSVC 工具集进行构建。

【问题讨论】:

    标签: c++ windows qt crashpad


    【解决方案1】:

    这里的问题最终是工具集不匹配。 Ninja 使用 MSVC 2019 工具集构建了 Crashpad。问题机器上安装的 Qt 版本是 5.14.2,它使用了 MSVC 2017 工具集。一旦我们安装了 5.15.0 套件并使用 MSVC 2019 构建配置构建,此错误就消失了。

    此外,一旦我们解决了之前的错误,就会出现 4 个新错误:

    util.lib(util.registration_protocol_win.obj) : error LNK2001: unresolved external symbol __imp_BuildSecurityDescriptorW
    util.lib(util.registration_protocol_win.obj) : error LNK2001: unresolved external symbol ConvertStringSecurityDescriptorToSecurityDescriptorW
    util.lib(util.registration_protocol_win.obj) : error LNK2001: unresolved external symbol __imp_BuildExplicitAccessWithNameW
    base.lib(base.rand_util.obj) : error LNK2001: unresolved external symbol SystemFunction036
    

    这些错误已通过与Advapi32 链接解决:

    # Crashpad rules for Windows
    win32 {
        LIBS += -L$$PWD/Crashpad/Libraries/Windows/ -lbase
        LIBS += -L$$PWD/Crashpad/Libraries/Windows/ -lclient
        LIBS += -L$$PWD/Crashpad/Libraries/Windows/ -lutil
        LIBS += -lAdvapi32
    }
    

    可以在here 找到与 Crashpad 集成的示例 Windows Qt 应用程序。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-23
      • 1970-01-01
      • 2015-08-23
      • 1970-01-01
      相关资源
      最近更新 更多