构建 Qt 5.4.1 失败并出现链接器错误

Building Qt 5.4.1 fails with linker error

我正在尝试根据 http://wiki.qt.io/Building_Qt_5_from_Git 的描述构建 Qt 5.4.1,但没有成功。有趣的是:我收到关于某些缺失符号的链接器错误,而不是关于可能来自缺失附加包的缺失库的错误!所以我假设 Qt 本身有问题。这就是我正在做的事情:

使用 VS2013 在 windows 下构建,使用以下选项进行配置:

-debug-and-release -release -force-debug-info -nomake tests -nomake examples -qt-zlib -qt-libjpeg -qt-libpng -opengl desktop -plugin-sql-sqlite

在使用 "nmake" 成功构建很长时间后,它最终失败并出现此错误:

link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /OPT:REF /INCREMENTAL:NO /DLL /SUBSYSTEM:WINDOWS /VERSION:5.41 /MANIFEST:embed /OUT:D:\Qt\Qt5.4.1.4.1\src\qtbase\lib\Qt5WebKit.dll@C:\Users\USER~1\AppData\Local\Temp\nm4CC8.tmp
Creating library D:\Qt\Qt5.4.1.4.1\src\qtbase\lib\Qt5WebKit.lib and object D:\Qt\Qt5.4.1.4.1\src\qtbase\lib\Qt5WebKit.exp WebCore.lib(TextAllInOne.obj) : error LNK2019: unresolved external symbol "public: static void __cdecl WebCore::TextCodecWin::registerExtendedEncodingNames(void (__cdecl*)(char const *,char const *))" (?registerExtendedEncodingNames@TextCodecWin@WebCore@@SAXP6AXPBD0@Z@Z) referenced in function "char const * __cdecl WebCore::atomicCanonicalTextEncodingName<unsigned char>(unsigned char const *,unsigned int)" (??$atomicCanonicalTextEncodingName@E@WebCore@@YAPBDPBEI@Z)WebCore.lib(TextAllInOne.obj) : error LNK2019: unresolved external symbol "public: static void __cdecl WebCore::TextCodecWin::registerExtendedCodecs(void (__cdecl*)(char const *,class WTF::PassOwnPtr<class WebCore::TextCodec> (__cdecl*)(class WebCore::TextEncoding const &,void const *),void const *))" (?registerExtendedCodecs@TextCodecWin@WebCore@@SAXP6AXPBDP6A?AV?PassOwnPtr@VTextCodec@WebCore@@@WTF@@ABVTextEncoding@2@PBX@Z2@Z@Z) referenced in function "char const * __cdecl WebCore::atomicCanonicalTextEncodingName<unsigned char>(unsigned char const *,unsigned int)" (??atomicCanonicalTextEncodingName@E@WebCore@@YAPBDPBEI@Z)
D:\Qt\Qt5.4.1.4.1\src\qtbase\lib\Qt5WebKit.dll : fatal error LNK1120: 2 unresolved externals

为了便于阅读,这是链接器错误消息的相关部分:

unresolved external symbol "public: static void __cdecl WebCore::TextCodecWin::registerExtendedCodecs(void (__cdecl*)(char const *,class WTF::PassOwnPtr<class WebCore::TextCodec> (__cdecl*)(class WebCore::TextEncoding const &,void const *),void const *))"(?registerExtendedCodecs@TextCodecWin@WebCore@@SAXP6AXPBDP6A?AV?PassOwnPtr@VTextCodec@WebCore@@@WTF@@ABVTextEncoding@2@PBX@Z2@Z@Z)
referenced in function "char const * __cdecl WebCore::atomicCanonicalTextEncodingName<unsigned char>(unsigned char const *,unsigned int)" (??atomicCanonicalTextEncodingName@E@WebCore@@YAPBDPBEI@Z)

有什么解决办法吗?

您可以在extendTextCodecMaps中的qtwebkit/Source/WebCore/platform/text/TextEncodingRegistry.cpp:301中将#if OS(WINDOWS)更改为#if OS(WINCE)

查看ChangeLog-2012-10-02 原来只用于Windows CE。