windows下用mingw编译qt4.7

1. 下载安装qt-sdk-win-opensource-2010.05.exe

2. 设置mingw的编译环境 开始->Qt SDK by Nokia v2010.05 (open source)->Qt Command Prompt

3. 安装Open SSL(http://www.slproweb.com/products/Win32OpenSSL.html)

        我下载的是第一个编译好的Win32 OpenSSL v1.0.0d Light 安装到最后没响应了,用任务管理器kill掉,似乎也安装成功了。也可 以考虑使

        用源代码编译安装。

        否则编译时会出错,当然可以configure使得不安装ssl,不过我们需要的Webkit支持gmail之类的https网站,所以还是装上吧。

4. 增加gcc和的选项

     这个一定要加上,否则会出现类似下面的错误。

    painting/qdrawhelper.cpp:1814: internal compiler error: Segmentation fault
    Please submit a full bug report,
    with preprocessed source if appropriate.
错误的原因是:

       When the functions of Qt are called from spotify, the stack frames are not aligned on 128bits. Qt is compiled with the default stack boundary (128 bits), so the compiler mades assumptions which are not correct for spotify.

       The option of GCC to change the stack boundary is -mpreferred-stack-boundary. The stack boundary can also be changed because of the option -Os.

       By recompiling Qt with -mstackrealign, spotify does not crash anymore. This is because a prologue is aligning the stack for each call. This slow down each calls so this option will not be enabled by default.

解决办法:
    打开mkspecs/win32-g++/qmake.conf

        修改成这样 QMAKE_CFLAGS        = -mstackrealign

5. 配置 configure.exe -debug-and-release -openssl -I C:/openssl/Include -L C:/openssl/Lib

        参考http://stackoverflow.com/questions/3516143/qt-ssl-support-missing

6. mingw32-make

7. 出去休息半天等它编译完成

 

参考资料:

1. http://dev.firnow.com/course/3_program/c++/cppjs/20091215/184831.html 

2.http://stackoverflow.com/questions/3516143/qt-ssl-support-missing

3.http://bugreports.qt.nokia.com/browse/QTBUG-12174

4.http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43672

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值