找回密码
 立即注册
收起左侧

Win7+MinGW如何编译32位QT5.1.0

0
回复
9263
查看
[复制链接]
累计签到:1 天
连续签到:1 天
来源: 原创 2013-7-5 12:06:25 显示全部楼层 |阅读模式

马上注册,查看详细内容!注册请先查看:注册须知

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
//
//Win7+MinGW如何编译32位QT5.1.0
//


一.系统需求
1.MinGW(需要x32-4.8.0-release-posix-dwarf-rev2.7z/msys+7za+wget+svn+git+mercurial+cvs-rev13.7z这两个包)
http://sourceforge.net/projects/mingwbuilds/files/?source=navbar
2.Qt5.1.0源码包
http://master.qt-project.org/off ... ource-src-5.1.0.zip
3.Perl(5.12或更高版本)
http://downloads.activestate.com ... in32-x86-296746.msi
4.Python(2.7.5版本,3.0以上版本会出错)
http://www.python.org/ftp/python/2.7.5/python-2.7.5.msi
5.Ruby
http://files.rubyforge.vm.bytema ... ller-2.0.0-p195.exe
6.ICU
http://download.icu-project.org/ ... /icu4c-51_2-src.zip
7.OpenSSL
http://www.openssl.org/source/openssl-1.0.1e.tar.gz
8.ANGLE(这个我没整明白,也没编译成功,goole开源的一个opengl中间层的东西,编译时需要DXSDK,当然在配置Qt工程的时候加-opengl desktop -no-angle这两参数就不需要它了)
http://code.google.com/p/angleproject/
http://download.microsoft.com/do ... E31/DXSDK_Jun10.exe

二.建立环境
1.在任意分区建立MinGW-Build目录
2.解压x32-4.8.0-release-posix-dwarf-rev2.7z到MinGW-Build\MinGW32
3.解压msys+7za+wget+svn+git+mercurial+cvs-rev13.7z到MinGW-Build\Msys
3.修改MinGW-Builds\Msys\etc\fstab文件,添加如下三行文本:
        #Win32_Path                                                                Mount_Point
        ?:/MinGW-Build/MinGW32                                        /mingw
        c:/perl                                                                        /perl
4.安装Perl、Python、Rubya并设置系统环境变量
例如:C:\Python27;C:\Ruby200\bin;C:\Perl\site\bin;C:\Perl\bin
5.编译ICU
a.解压icu源码到?:\LibsPath\icu
b.执行?:\MinGW-Builds\msys\msys.bat
        $cd /?/LibsPath/icu/source
        $./runConfigureICU MinGW --prefix=$PWD/../InstallPath
        $make && make install && make clean
6.编译OpenSSL
a.复制源码压缩包到?:\LibsPath (这个源码包一定要用tar来解,不然有符号链接问题)
b.执行?:\MinGW-Builds\msys\msys.bat
        $tar xvzf openssl-1.0.1c.tar.gz
        $cd openssl-1.0.1c
        $ ./Configure --prefix=$PWD/InstallPath no-idea no-mdc2 no-rc5 shared mingw
        $make depend && make && make install &&make clean
7.在?\MinGW-Build\mingw32目录下创建MinGW-Build.bat文件,用于建立编译Qt时的环境变量,内容如下:
        echo off

        echo Setting up a MinGW only environment...

        echo -- Adding ?:\MinGW-Build\mingw32\bin to PATH

        echo -- Adding ?:\LibsPath\ICU\InstallPath\lib to PATH
        echo -- Adding ?:\LibsPath\ICU\InstallPath\include to INCLUDE
        echo -- Adding ?:\LibsPath\ICU\InstallPath\lib to LIB
        echo -- Adding ?:\LibsPath\openssl-1.0.1c\InstallPath\lib to PATH
        echo -- Adding ?:\LibsPath\openssl-1.0.1c\InstallPath\include to INCLUDE
        echo -- Adding ?:\LibsPath\openssl-1.0.1c\InstallPath\lib to LIB

        set PATH=%PATH%;?:\MinGW-Build\mingw32\mingw32\bin

        set PATH=%PATH%;?:\LibsPath\ICU\InstallPath\lib
        set INCLUDE=%INCLUDE%;?:\LibsPath\ICU\InstallPath\include
        set LIB=%LIB%;?:\LibsPath\ICU\InstallPath\lib

        set PATH=%PATH%;?:\LibsPath\openssl-1.0.1c\InstallPath\lib
        set INCLUDE=%INCLUDE%;?:\LibsPath\openssl-1.0.1c\InstallPath\include
        set LIB=%LIB%;?:\LibsPath\openssl-1.0.1c\InstallPath\lib

三.开始编译Qt5.1.0
1.解压源码到?:\Qt5.1.0
2.执行?\MinGW-Build\mingw32\MinGW-Build.bat cd进入?:\Qt5.1.0目录
3.configure -prefix %CD%\qtbase -debug -force-debug-info -developer-build -opensource -compile-examples -qt-sql-odbc -qt-sql-sqlite -plugin-sql-odbc -plugin-sql-sqlite -platform win32-g++ -qt-zlib -qt-libpng -qt-libjpeg -no-angle -opengl desktop -nomake tests
注:由于angle编译有各种问题所以加了-opengl desktop -no-angle 参数.静待高手来解决
4.mingw32-make -i -k 2>d:\5.1.0shared-build.err.log
5.等吧,这是个漫长的过程。
7.如有不足请跟帖指正,谢谢。

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

公告
可以关注我们的微信公众号yafeilinux_friends获取最新动态,或者加入QQ会员群进行交流:190741849、186601429(已满) 我知道了