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 


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\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.

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). 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值