最近整理了自己电脑上的源码,重新下载并编译了QT5的最新版本。
一开始还都顺利,后来就报错啦:
cd qml\ && ( if not exist Makefile D:\Build\QT5\QT5.4.1_VC2010\qtbase\bi n\qmake D:\Build\QT5\QT5.4.1_VC2010\qtdeclarative\src\qml\qml.pro -o Makefile ) && "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe" -f Mak efile Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe" - f Makefile.Debug Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. echo 2 /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ "D: \\Build\\QT5\\QT5.4.1_VC2010\\qtbase\\lib\\Qt5Qmld.dll.embed.manifest">D:\Build\ QT5\QT5.4.1_VC2010\qtbase\lib\Qt5Qmld.dll_manifest.rc if not exist D:\Build\QT5\QT5.4.1_VC2010\qtbase\lib\Qt5Qmld.dll if exist D:\Build\QT5\QT5.4.1_VC2010\qtbase\lib\Qt5Qmld.dll.embed.manifest del D:\Build\ QT5\QT5.4.1_VC2010\qtbase\lib\Qt5Qmld.dll.embed.manifest if exist D:\Build\QT5\QT5.4.1_VC2010\qtbase\lib\Qt5Qmld.dll.embed.manife st copy /Y D:\Build\QT5\QT5.4.1_VC2010\qtbase\lib\Qt5Qmld.dll.embed.manifest D:\ Build\QT5\QT5.4.1_VC2010\qtbase\lib\Qt5Qmld.dll_manifest.bak link /NOLOGO /DYNAMICBASE /NXCOMPAT /BASE:0x66000000 /DEBUG /DLL /SUBSYS TEM:WINDOWS /VERSION:5.41 /MANIFEST /MANIFESTFILE:D:\Build\QT5\QT5.4.1_VC2010\qt base\lib\Qt5Qmld.dll.embed.manifest /OUT:D:\Build\QT5\QT5.4.1_VC2010\qtbase\lib\ Qt5Qmld.dll @C:\Users\Hansen\AppData\Local\Temp\nm86A5.tmp Creating library D:\Build\QT5\QT5.4.1_VC2010\qtbase\lib\Qt5Qmld.lib and objec t D:\Build\QT5\QT5.4.1_VC2010\qtbase\lib\Qt5Qmld.exp YarrInterpreter.obj : error LNK2019: unresolved external symbol "struct JSC::Yar r::CharacterClass * __cdecl JSC::Yarr::newlineCreate(void)" (?newlineCreate@Yarr @JSC@@YAPAUCharacterClass@12@XZ) referenced in function "public: struct JSC::Yar r::CharacterClass * __thiscall JSC::Yarr::YarrPattern::newlineCharacterClass(voi d)" (?newlineCharacterClass@YarrPattern@Yarr@JSC@@QAEPAUCharacterClass@23@XZ) YarrJIT.obj : error LNK2001: unresolved external symbol "struct JSC::Yarr::Chara cterClass * __cdecl JSC::Yarr::newlineCreate(void)" (?newlineCreate@Yarr@JSC@@YA PAUCharacterClass@12@XZ) YarrPattern.obj : error LNK2001: unresolved external symbol "struct JSC::Yarr::C haracterClass * __cdecl JSC::Yarr::newlineCreate(void)" (?newlineCreate@Yarr@JSC @@YAPAUCharacterClass@12@XZ) YarrInterpreter.obj : error LNK2019: unresolved external symbol "struct JSC::Yar r::CharacterClass * __cdecl JSC::Yarr::wordcharCreate(void)" (?wordcharCreate@Ya rr@JSC@@YAPAUCharacterClass@12@XZ) referenced in function "public: struct JSC::Y arr::CharacterClass * __thiscall JSC::Yarr::YarrPattern::wordcharCharacterClass( void)" (?wordcharCharacterClass@YarrPattern@Yarr@JSC@@QAEPAUCharacterClass@23@XZ ) YarrJIT.obj : error LNK2001: unresolved external symbol "struct JSC::Yarr::Chara cterClass * __cdecl JSC::Yarr::wordcharCreate(void)" (?wordcharCreate@Yarr@JSC@@ YAPAUCharacterClass@12@XZ) YarrPattern.obj : error LNK2001: unresolved external symbol "struct JSC::Yarr::C haracterClass * __cdecl JSC::Yarr::wordcharCreate(void)" (?wordcharCreate@Yarr@J SC@@YAPAUCharacterClass@12@XZ) YarrPattern.obj : error LNK2019: unresolved external symbol "struct JSC::Yarr::C haracterClass * __cdecl JSC::Yarr::digitsCreate(void)" (?digitsCreate@Yarr@JSC@@ YAPAUCharacterClass@12@XZ) referenced in function "public: struct JSC::Yarr::Cha racterClass * __thiscall JSC::Yarr::YarrPattern::digitsCharacterClass(void)" (?d igitsCharacterClass@YarrPattern@Yarr@JSC@@QAEPAUCharacterClass@23@XZ) YarrPattern.obj : error LNK2019: unresolved external symbol "struct JSC::Yarr::C haracterClass * __cdecl JSC::Yarr::spacesCreate(void)" (?spacesCreate@Yarr@JSC@@ YAPAUCharacterClass@12@XZ) referenced in function "public: struct JSC::Yarr::Cha racterClass * __thiscall JSC::Yarr::YarrPattern::spacesCharacterClass(void)" (?s pacesCharacterClass@YarrPattern@Yarr@JSC@@QAEPAUCharacterClass@23@XZ) YarrPattern.obj : error LNK2019: unresolved external symbol "struct JSC::Yarr::C haracterClass * __cdecl JSC::Yarr::nondigitsCreate(void)" (?nondigitsCreate@Yarr @JSC@@YAPAUCharacterClass@12@XZ) referenced in function "public: struct JSC::Yar r::CharacterClass * __thiscall JSC::Yarr::YarrPattern::nondigitsCharacterClass(v oid)" (?nondigitsCharacterClass@YarrPattern@Yarr@JSC@@QAEPAUCharacterClass@23@XZ ) YarrPattern.obj : error LNK2019: unresolved external symbol "struct JSC::Yarr::C haracterClass * __cdecl JSC::Yarr::nonspacesCreate(void)" (?nonspacesCreate@Yarr @JSC@@YAPAUCharacterClass@12@XZ) referenced in function "public: struct JSC::Yar r::CharacterClass * __thiscall JSC::Yarr::YarrPattern::nonspacesCharacterClass(v oid)" (?nonspacesCharacterClass@YarrPattern@Yarr@JSC@@QAEPAUCharacterClass@23@XZ ) YarrPattern.obj : error LNK2019: unresolved external symbol "struct JSC::Yarr::C haracterClass * __cdecl JSC::Yarr::nonwordcharCreate(void)" (?nonwordcharCreate@ Yarr@JSC@@YAPAUCharacterClass@12@XZ) referenced in function "public: struct JSC: :Yarr::CharacterClass * __thiscall JSC::Yarr::YarrPattern::nonwordcharCharacterC lass(void)" (?nonwordcharCharacterClass@YarrPattern@Yarr@JSC@@QAEPAUCharacterCla ss@23@XZ) D:\Build\QT5\QT5.4.1_VC2010\qtbase\lib\Qt5Qmld.dll : fatal error LNK1120: 7 unre solved externals NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0 \VC\BIN\link.EXE"' : return code '0x460' Stop. NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0 \VC\BIN\nmake.exe"' : return code '0x2' Stop. NMAKE : fatal error U1077: 'cd' : return code '0x2' Stop. NMAKE : fatal error U1077: 'cd' : return code '0x2' Stop. NMAKE : fatal error U1077: 'cd' : return code '0x2' Stop.
后来发现,是一开始的时候python没有正确的添加到路径之中,导致一个文件生成失败,从而引起的这个错误。
其解决方法如下:
1、查看文件%QT_HOME%\qtdeclarative\src\qmlRegExpJitTables.h,大小应该为0,删除该文件 2、确保可以执行python命令 3、重新nmake
此外,我的QT5编译环境配置文件如下:
@@set mkspecs=win32-msvc2010 @call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" @set PYTHON_HOME=C:\Languages\Python\Python27 @set PERL_HOME=C:\Languages\Perl5 @set RUBY_HOME=C:\Languages\Ruby\Ruby200x86 @set GNU_HOME=D:\Build\QT5\QT5.4.1_VC2010\gnuwin32 @set PATH=%PATH%;%PYTHON_HOME%;%PERL_HOME%\bin;%RUBY_HOME%\bin;%GNU_HOME%\bin @set DXSDK_DIR=C:\ProgramerTools\DirectX\Microsoft DirectX 9.0 SDK (Summer 2004) @color 02 @title QT5+VS2010 @cmd