QT5 Alpha WINDOWS编译

本文详细介绍了如何在Windows环境下编译QT5 Alpha版本,包括从下载源码到安装Perl、MinGW,配置环境变量,直至成功编译qtbase、qtjsbackend、qtxmlpatterns和qtdeclarative等模块。在编译过程中遇到的问题及解决方案也被详细记录,如删除不兼容的宏定义以适应QT5的变动。
摘要由CSDN通过智能技术生成

WINDOWS安装正常流程:

  1. http://releases.qt-project.org/qt5.0/alpha/获取源码包。
  2. 从perl.org上下载perl,自动添加perl路径的环境变量。(此步是因为configure.bat脚本解析需要)
  3. 下载mingw-get-inst-20111118.exe,安装最新的mingw 4.6.1(C、C++、msys),把mingw的路径增加到系统PATH环境变量中。(此步一是因为configure.bat脚本解析需要编译器,另外是为了支持gcc的命令行参数-fno-keep-inline-dllexport,QTSDK 1.2自带的mingw 4.4不支持此参数)
  4. 将python.exe的路径增加到系统环境变量中。(此步是因为qtjsbackend需要)
  5. 重启WINDOWS。
  6. mingw-get install mintty
  7. cd qtbase
  8. configure -debug -opensource -confirm-license -nomake examples -nomake tests -fast
    将-developer-build改成-debug,因为这样-developer-build生成的库对qt creator不友好。
  9. mingw32-make,qtbase编译成功。

  10. cd qtjsbackend
  11. qmake
  12. mingw32-make,qtjsbackend编译成功。

  13. cd qtxmlpatterns
  14. qmake
  15. mingw32-make,qtxmlpatterns编译成功。

  16. cd qtdeclarative(依赖qtjsbackend和xmlpatterns),把qtdeclarative\modules\qt_declarative.pri中QT.qtdeclarative.DEFINES全删了。那些宏是因为QML把类名又从QDeclarative改成QQML了,然后定义了一串宏为了兼容之前使用QML的旧代码,不是QT5哦。QT5 alpha又没有旧代码。
  17. qmake
  18. mingw32-make,编译成功。

  19. cd qt3d(依赖qtdeclarative)
  20. qmake
  21. mingw32-make,编译成功。

在qmake时,会把模块下面modules\xxx.pri拷贝到qtbase\mkspecs\modules下。

=======================================================================================================

遇到的问题:

编译qtbase时出现:

问题1:

g++ -c -fno-keep-inline-dllexport -g -frtti -fexceptions -mthreads -Wall -DUNICO
DE -DQT_LARGEFILE_SUPPORT -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_FROM_
ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_GEOM_VARIA
NT -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_STL -DQT_NO_SYSTEMLOCALE -DQT_NO_THRE
AD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NO_DEPRECATED -DQT_NODLL -
I"..\..\..\include" -I"..\..\..\include\QtCore" -I"..\..\..\include\QtCore\5.0.0
" -I"..\..\..\include\QtCore\5.0.0\QtCore" -I"..\..\3rdparty\zlib" -I"..\..\..\m
kspecs\win32-g++" -o tmp\obj\debug_shared\qlatincodec.o ..\..\corelib\codecs\qla
tincodec.cpp
cc1plus.exe: error: unrecognized command line option "-fno-keep-inline-dllexport
"
mingw32-make[2]: *** [tmp/obj/debug_shared/qlatincodec.o] Error 1
mingw32-make[2]: Leaving directory `G:/qt-everywhere-opensource-src-5.0.0/qtbase
/src/tools/bootstrap'
mingw32-make[1]: *** [debug] Error 2
mingw32-make[1]: Leaving directory `G:/qt-everywhere-opensource-src-5.0.0/qtbase
/src/tools/bootstrap'
原因:一开始使用QTSDK的mingw,不支持-fno-keep-inline-dllexport。下载新的mingw解决。


编译qtjsbackend时出现:

问题1:

process_begin: CreateProcess(NULL, python G:/qt-everywhere-opensource-src-5.0.0/
qtjsbackend/src/v8/../3rdparty/v8/tools/js2c.py generated-debug/libraries.cpp CO
RE off G:/qt-everywhere-opensource-src-5.0.0/qtjsbackend/src/v8/../3rdparty/v8/s
rc/macros.py ..\3rdparty\v8\src\runtime.js ..\3rdparty\v8\src\v8natives.js ..\3r
dparty\v8\src\array.js ..\3rdparty\v8\src\string.js ..\3rdparty\v8\src\uri.js ..
\3rdparty\v8\src\math.js ..\3rdparty\v8\src\messages.js ..\3rdparty\v8\src\apina
tives.js ..\3rdparty\v8\src\date.js ..\3rdparty\v8\src\regexp.js ..\3rdparty\v8\
src\json.js ..\3rdparty\v8\src\liveedit-debugger.js ..\3rdparty\v8\src\mirror-de
bugger.js ..\3rdparty\v8\src\debug-debugger.js, ...) failed.
make (e=2):
mingw32-make[3]: *** [generated-debug/libraries.cpp] Error 2
mingw32-make[3]: Leaving directory `G:/qt-everywhere-opensource-src-5.0.0/qtjsba
ckend/src/v8'
mingw32-make[2]: *** [debug-install] Error 2
mingw32-make[2]: Leaving directory `G:/qt-everywhere-opensource-src-5.0.0/qtjsba
ckend/src/v8'
mingw32-make[1]: *** [sub-v8-install_subtargets-ordered] Error 2
mingw32-make[1]: Leaving directory `G:/qt-everywhere-opensource-src-5.0.0/qtjsba
ckend/src'
mingw32-make: *** [module-qtjsbackend-src-install_subtargets] Error 2
原因:python路径没有添加。


编译qtdeclarative时出现:
问题1:
windres -i qmldbg_qtquick2d_resource.rc -o debug\qmldbg_qtquick2d_resource_res.o
 --include-dir=. -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_PLUGIN -DQT_QUIC
K_LIB -DQDeclarativeAbstractAnimation=QQuickAbstractAnimation -DQDeclarativeAbst
ractBinding=QQmlAbstractBinding -DQDeclarativeAbstractBoundSignal=QQmlAbstractBo
undSignal -DQDeclarativeAccessible=QQmlAccessible -DQDeclarativeAccessibleAttach
ed=QQmlAccessibleAttached -DQDeclarativeAccessorProperties=QQmlAccessorPropertie
s -DQDeclarativeAction=QQuickAction -DQDeclarativeActionEvent=QQuickActionEvent
-DQDeclarativeAnimationGroup=QQuickAnimationGroup -DQDeclarativeAnimationPropert
yUpdater=QQuickAnimationPropertyUpdater -DQDeclarativeApplication=QQuickApplicat
ion -DQDeclarativeBehavior=QQuickBehavior -DQDeclarativeBind=QQuickBind -DQDecla
rativeBinding=QQmlBinding -DQDeclarativeBindingProfiler=QQmlBindingProfiler -DQD
eclarativeBoundSignal=QQmlBoundSignal -DQDeclarativeBuiltinFunctions=QQmlBuiltin
Functions -DQDeclarativeBulkValueAnimator=QQuickBulkValueAnimator -DQDeclarative
ChangeSet=QQuickChangeSet -DQDeclarativeCleanup=QQmlCleanup -DQDeclarativeC
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值