带有 VS2012 编译器的 32 位 Qt5 构建中的 ICU 支持导致 Qt5 构建失败;因此 Webkit 也是不可构建的 [英] ICU support in a 32-bit build of Qt5 with the VS2012 compiler causes Qt5 build failure; Webkit is also therefore unbuildable

查看:74
本文介绍了带有 VS2012 编译器的 32 位 Qt5 构建中的 ICU 支持导致 Qt5 构建失败;因此 Webkit 也是不可构建的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试使用 VS2012 编译器构建 Qt5 的一连串障碍中遇到了另一个问题.

I have run into another in a long stream of obstacles attempting to build Qt5 with the VS2012 compiler.

启用 ICU 后(配置命令行上的-icu",以及在 VS2012 中正确构建 ICU 的 32 位版本并正确包含所有 ICU 路径(标头、.lib 和 .dll)),行qtbase\src\corelib\codecs\qtextcodec.cpp 中的 688 在询问名称为US-ASCII"的编解码器时返回 NULL 编解码器(ICU 无法返回编解码器).

When ICU is enabled ("-icu" on the configure command line, along with a proper 32-bit build of ICU in VS2012 and proper inclusion of all ICU paths (header, .lib, and .dll)), Line 688 of qtbase\src\corelib\codecs\qtextcodec.cpp returns a NULL codec (ICU fails to return a codec) when asked for a codec whose name is "US-ASCII".

特别是:

QTextCodec* QTextCodec::codecForLocale()
{
    QCoreGlobalData *globalData = QCoreGlobalData::instance();
    if (!globalData)
        return 0;

    QTextCodec *codec = globalData->codecForLocale.loadAcquire();
    if (!codec) {
#ifdef QT_USE_ICU

        // THIS BLOCK IS REACHED WHEN ICU IS ENABLED

        textCodecsMutex()->lock();

        // ***
        // The following codec returned is NULL!!!
        //   (Internally, it sets the codec name to "US-ASCII",
        //    and fails to find a codec with this name)
        // ***
        codec = QIcuCodec::defaultCodecUnlocked();

        textCodecsMutex()->unlock();
#else
        // setupLocaleMapper locks as necessary
        codec = setupLocaleMapper();
#endif
    }

    return codec;
}

稍后,上面提到的 NULL 编解码器变量被取消引用(在lrelease.exe"实用程序的代码中),并且当lrelease.exe"实用程序作为 Qt5 构建过程的一部分运行并尝试执行翻译时,它会由于此 NULL 取消引用而崩溃,并导致 Qt 构建因错误而停止.

Later, the NULL codec variable noted above is dereferenced (in the code for the "lrelease.exe" utility), and when the "lrelease.exe" utility runs as part of the Qt5 build process and attempts to perform a translation, it crashes due to this NULL dereference and causes the Qt build to stop with an error.

进入上述 QIcuCodec::defaultCodecUnlocked() 函数显示编解码器名称被设置为 US-ASCII,并且具有此名称的编解码器不是找到了.

Stepping into the above QIcuCodec::defaultCodecUnlocked() function reveals that the codec name is being set to US-ASCII, and that a codec with this name is not found.

因此似乎不可能在 VS2012 编译器 32 位版本的 Qt5 中包含 ICU 支持.

It therefore seems to be impossible to include ICU support with a VS2012-compiler 32-bit build of Qt5.

更糟糕的是,由于 Webkit 依赖于 Qt5 中的 ICU,这意味着也无法构建 Webkit.

Worse, because Webkit depends on ICU within Qt5, this means that Webkit cannot be built, either.

有人可以告诉我这是否有可能是 VS2012 的 Qt5 的错误,还是我在构建环境中没有正确设置?

Can someone please tell me if this is reasonably likely to be a bug with Qt5 with VS2012, or is there something I am not setting up properly in my build environment?

还有一个好处,那就是知道是否有人能够在启用 ICU 支持的情况下使用 VS2012 编译器构建 Qt5.

Of use, also, would be knowing whether anybody has been able to build Qt5 with the VS2012 compiler with ICU support enabled.

我还在相关的发表评论,Qt 论坛中正在进行的讨论.

I have also posted a comment in a relevant, ongoing thread in the Qt forum.

推荐答案

Qt 默认使用 UTF-8.假设 ICU 51.2,使用定义为 1 的 U_CHARSET_IS_UTF8 重建 ICU.要么:#define it in source\common\unicode\platform.h(请参阅第 523 行附近的注释),或者您也可以将其添加到所有 ICU 项目的构建中在 allinone.sln(例如右键单击,选择属性,选择配置属性>C/C++>预处理器并将其添加到预处理器定义中).

Qt uses UTF-8 as the default. Assuming ICU 51.2, rebuild ICU with U_CHARSET_IS_UTF8 defined to 1. Either: #define it in source\common\unicode\platform.h (see comment starting about around line 523), or you could also add it to the build in all ICU projects in allinone.sln (e.g. right click, select properties, select Configuration Properties>C/C++>Preprocessor and add it to Preprocessor Definitions).

这篇关于带有 VS2012 编译器的 32 位 Qt5 构建中的 ICU 支持导致 Qt5 构建失败;因此 Webkit 也是不可构建的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆