Build Qt 5.4 in windows: use VS2010
In this post , I note how to build qt 5.4 in windows.
I had tried lots effort to use VS 2005 as my compiler to pass the building of Qt 5.4
But I did not pass it.
In here , I used the compiler VS2010.
Step 0.
Download Qt 5.4.0 sourcecode from here( or 5.4.1), or from the official website ( I recommend you download the .zip file, the others may be collapse in uncompression) (the uncompressed soource code would greater than 4GB, make sure your compression program support that). Then uncompress this package. For me , the qt folder is at C:\Lib\Qt\qt-everywhere-opensource-src-5.4.0.
Download the python from here, and install it. Set the python path in the windows environment, make sure you could call python compiler in command line.
Step 1.
open the file qt-everywhere-opensource-src-5.4.0\qtbase\mkspecs\win32-msvc2010\qmake.conf, change text beginning from 28th line
to
Step 2.
open a VS 2010 command prompt , it is local in programs -> VS2010-> Visual Studio Tool->
If you use Visual Studio Command Prompt(2010), the building target is 32 bit; otherwise, Visual Studio x64 Win64 Command Prompt(2010) is for 64 bit.
For me, I set for 32 bit.
Move your working folder in the prompt to Qt folder.
3. for my configure, i use
(you should use configure -h at first, to check what are supported parameters. the help note is long, you could use the command "configure -h > help.txt"to save the note as a file.)
(I skip debug, test and example to fast the building)
and type nmake to build the Qt libraries.
4. if you encounter:
Check the file qt-everywhere-opensource-src-5.4.0\qtdeclarative\src\qml\RegExpJitTables.h is empty file or not. if it is empty, delete it. It is you do not installing python yet. After installing and setting python environment, re-open the VS prompt and type nmake.
5. If you encounter uic.exe crashed, you could just type nmake again and and again, until your building has been done completely.
6. After the Building has been done, you should be under the folder
qt-everywhere-opensource-src-5.4.0\
qtbase.
DO NOT go back qt root folder, just type "nmake install", the script would organize libraries and headers to be a portable package (for me it is under qt-everywhere-opensource-src-5.4.0\built).
I had tried lots effort to use VS 2005 as my compiler to pass the building of Qt 5.4
But I did not pass it.
In here , I used the compiler VS2010.
Step 0.
Download Qt 5.4.0 sourcecode from here( or 5.4.1), or from the official website ( I recommend you download the .zip file, the others may be collapse in uncompression) (the uncompressed soource code would greater than 4GB, make sure your compression program support that). Then uncompress this package. For me , the qt folder is at C:\Lib\Qt\qt-everywhere-opensource-src-5.4.0.
Download the python from here, and install it. Set the python path in the windows environment, make sure you could call python compiler in command line.
Step 1.
open the file qt-everywhere-opensource-src-5.4.0\qtbase\mkspecs\win32-msvc2010\qmake.conf, change text beginning from 28th line
QMAKE_CFLAGS_RELEASE = -O2 -MD
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi
QMAKE_CFLAGS_DEBUG = -Zi -MDd
to
QMAKE_CFLAGS_RELEASE = -O2 -MT
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
QMAKE_CFLAGS_DEBUG = -Zi -MTd
Step 2.
open a VS 2010 command prompt , it is local in programs -> VS2010-> Visual Studio Tool->
If you use Visual Studio Command Prompt(2010), the building target is 32 bit; otherwise, Visual Studio x64 Win64 Command Prompt(2010) is for 64 bit.
For me, I set for 32 bit.
Move your working folder in the prompt to Qt folder.
3. for my configure, i use
onfigure -platform win32-msvc2010 -opensource -opengl desktop -release -nomake examples -no-angle -no-openssl -no-icu -skip webkit -no-openvg -nomake tests
(you should use configure -h at first, to check what are supported parameters. the help note is long, you could use the command "configure -h > help.txt"to save the note as a file.)
(I skip debug, test and example to fast the building)
and type nmake to build the Qt libraries.
4. if you encounter:
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)
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
)
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)
..\..\lib\Qt5Qmld.dll : fatal error LNK1120: 7 unresolved 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
make.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.
C:\Lib\Qt\qt-everywhere-opensource-src-5.4.0>
Check the file qt-everywhere-opensource-src-5.4.0\qtdeclarative\src\qml\RegExpJitTables.h is empty file or not. if it is empty, delete it. It is you do not installing python yet. After installing and setting python environment, re-open the VS prompt and type nmake.
5. If you encounter uic.exe crashed, you could just type nmake again and and again, until your building has been done completely.
6. After the Building has been done, you should be under the folder
qt-everywhere-opensource-src-5.4.0\
qtbase.
DO NOT go back qt root folder, just type "nmake install", the script would organize libraries and headers to be a portable package (for me it is under qt-everywhere-opensource-src-5.4.0\built).