现在的位置: 首页 > 综合 > 正文

windows下用mingw编译qt4.7

2013年12月03日 ⁄ 综合 ⁄ 共 1524字 ⁄ 字号 评论关闭

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

抱歉!评论已关闭.