Compiling qt5 in msys and mingw



  • Hi there,
    I am trying to install qt, which is needed by other program being compiled in mingw32. The mingw use gcc4.7.x, I soon find that the qt4.8 is not compatible with gcc4.7, but I need 4.7 for other programs. After google the similar issue, I found that someone recommend qt5. So I am trying to compile qt5 in mingw but soon later I found lots of issues.

    1. I am trying to compile the source code in msys by running

    configure -developer-build -opensource -nomake examples -nomake tests

    but it reports that

    The build script does not currently recognize all platforms supported by Qt.
    Rerun this script with a -platform option listed to set the system/compiler combination you use.

    But if I run 'configure -platform', it shows the same error. So, I am wondering if there is any way to compile it in msys?

    1. Well, I search the similar issue online, and find that someone compile the src with mingw in window's command line (I just wonder what's the different to compile in windows' command and calling the mingw gcc and comping it within msys?) Anyway, I try the following

    set QTDIR=C:\qt5\qtbase
    set PATH=C:\qt5\qtbase\bin
    set PATH=%PATH%;D:\dev\strawberry\perl\bin
    set PATH=%PATH%;C:\Python27
    set PATH=%PATH%;D:\dev\MinGW\bin
    set PATH=%PATH%;%SystemRoot%\System32
    set QMAKESPEC=win32-g++
    ./configure -developer-build -opensource -nomake examples -nomake tests

    but when I run it, a while later, it said

    "The procedure entry point __gxx_personality_v0 could not be located in the dynamic link library libstdc++-6.dll"

    It is pretty weird, I have all stdc, glib and gcc installed in mingw and I also found libstdc++-6.dll in the lib directory in mingw, but why it cannot find it? Anyway, I copy the libstdc++-6.dll to qtbase/bin and run above script again, it runs until it reported that The DirectX SDK could not be detected and ANGLE backend will be disabled. Well, I search the related information, I wonder do I really have to install DirectX SDK? What's that ANGLE backend for? Actually, I am trying to install qt for compiling a library called poppler, I don't know what function of qt needed but if there is any way to disable directX. Also, from some online post, someone also mentioned that I need openssl, webkit, glim and other libraries installed before the compilation of the src, but I don't have any of them. If I want to install them, shall I install the binaries or the source? It seems so many dependencies for compiling the qt5 :(


  • Moderators

    On Windows, even if you're in MSYS, you must still use *configure.bat'*, not theconfigure' script. I've successfully compiled Qt 5 on cmd.exe + MinGW before, so MSYS is not strictly necessary.

    I heard that there are problems building Qt WebKit using MinGW, so you should disable Qt WebKit if you don't need it.

    The only dependencies you need are listed at http://qt-project.org/wiki/Building-Qt-5-from-Git



  • Thanks. I am using cmd + mingw now. I don't know how to disable WebKit but while I run the configure, it report there is no DirectX SDK, I skip it and it keep running. Then I run the mingw32-make to make, it takes long time to run ... but finally it ends up with reporting missing python27.dll. I have python27 installed in c:/python27 but seems the configure detect that

    ....\include/QtGui/../../src/gui/opengl/qopengl.h:55:25: fatal error: GLES2/gl.h: No such file or directory
    compilation terminated.

    How to correct that? Thanks.


  • Moderators

    [quote author="mctree" date="1356754178"]I don't know how to disable WebKit but while I run the configure, it report there is no DirectX SDK[/quote]

    Do...
    @
    configure.bat -developer-build -opensource -nomake examples -nomake tests -opengl desktop --no-webkit
    @
    ...to use your graphics card's OpenGL instead of DirectX, and to disable WebKit.

    [quote]Then I run the mingw32-make to make, it takes long time to run ... but finally it ends up with reporting missing python27.dll. I have python27 installed in c:/python27 but seems the configure detect that

    *checking for python... (cached) /bin/python2.5

    ...

    Why it detect python2.5 instead? How to correct that? Thanks.
    [/quote]
    Because you have multiple versions of Python in your machine, and the configuration tool found Python 2.5 first. Move your environment variables around, and make sure Python 2.7 is listed first. Same with Perl.



  • [quote author="mctree" date="1356754178"]
    configure.bat -developer-build -opensource -nomake examples -nomake tests -opengl desktop --no-webkit
    [/quote]

    --no-webkit gives an error for me. But -nomake webkit seems to work



  • I have tried following the instructions on this thread and looked at many others but getting very frustrated!

    I have mingw installed in c:/mingw under WinXP and the dependent packages installed (Perl, Pyhton, Ruby). Paths set. I have the qt source in c:/mingw/local/qt. In this directory I have tried running:

    configure.bat -prefix c:\mingw\local\qt -developer-build -opensource -opengl desktop -platform win32-g++ -nomake examples -nomake tests
    -nomake webkit

    but I get:

    • C:/mingw/local/qt-src/qtbase/configure -prefix c:\mingw\local\qt -developer-build -opensource -opengl desktop -platform win32-g++ -nomake examples -nomake tests -nomake webkit
      'C:\mingw\local\qt-src\qtbase\configure.exe' is not recognized as an internal or external command, operable program or batch file.
      *** qtbase/configure exited with non-zero status.

    Notice the "\" before "configure.exe". What on earth am I doing wrong here? Is there some (undocumented) environment variable I have to set?


  • Moderators

    I haven't seen the double-slash issue before.

    Are you using Windows command prompt or MSYS?

    Try removing "-prefix c:\mingw\local\qt" (it's unneeded, since you're building into the same directory as the source code)

    This is probably unrelated, but also try deleting/renaming the qtwebkit folder before configuring, and removing the "-nomake webkit" option (I have a feeling this option is invalid). If the configure script can't find the qtwebkit folder, it will omit the compilation of Qt WebKit without errors.



  • [quote author="JKSH" date="1366121960"]I haven't seen the double-slash issue before. Are you using Windows command prompt or MSYS?[/quote]

    cmd. Sorry - accidentally edited that detail out of the final post. Also logged in as administrator so there should be no access issues.

    The double slash is perplexing me! What is trying to launch configure.exe?

    [quote author="JKSH" date="1366121960"]Try removing "-prefix c:\mingw\local\qt" (it's unneeded, since you're building into the same directory as the source code)[/quote]

    Tried that already - same result

    [quote author="JKSH" date="1366121960"]This is probably unrelated, but also try deleting/renaming the qtwebkit folder before configuring, and removing the "-nomake webkit" option (I have a feeling this option is invalid). If the configure script can't find the qtwebkit folder, it will omit the compilation of Qt WebKit without errors.[/quote]

    I tried this because the suggested "--no-webkit" option elsewhere in this thread gives an error. But the least of my problems right now.


  • Moderators

    What's your version of MinGW? What's your Qt version, and how did you obtain it?

    I have GCC 4.7.2 (from MinGW-builds), and Qt 5 source code from git (stable branch) that's a few days old. This command configured Qt without issues for me:

    @
    configure.bat -developer-build -opensource -confirm-license -nomake demos -nomake examples -nomake tests -opengl desktop
    @



  • [quote author="JKSH" date="1366125128"]What's your version of MinGW? What's your Qt version, and how did you obtain it?[/quote]

    MinGW 4.7.2 from mingw.org. (Not the sjlj unwinding version). Qt5.0.2 from qt-projects. But things don't look to be getting as far as the compiler - it looks like there is some issue with the Qt build script/interaction with my environment.

    [quote]configure.bat -developer-build -opensource -confirm-license -nomake demos -nomake examples -nomake tests -opengl desktop[/quote]

    I have tried exactly this and I get exactly the same result! I have searched for a file called configure.exe under the qt directory and it's not there, notwithstanding the double slash issue. So I am wondering if there is some condition that is going awry under my environment and trying to invoke a file that is absent. Do you have any QT environment variable set?


  • Moderators

    Very strange. I can't think of what the issue could be, sorry. Did you start with a clean source tree each time you tried?

    I have no Qt-related environment variables set -- I've never set any, regardless of whether I compiled using MinGW or MSVC 2012. Here's my configure output: http://pastebin.com/6MN6aF6F At which step does yours fail?



  • [quote author="JKSH" date="1366130103"]Very strange. I can't think of what the issue could be, sorry. Did you start with a clean source tree each time you tried?[/quote]

    I think so. I have certainly tried downloading a clean version. No difference.

    [quote] I have no Qt-related environment variables set -- I've never set any, regardless of whether I compiled using MinGW or MSVC 2012.[/quote]

    OK.

    [quote] Here's my configure output: http://pastebin.com/6MN6aF6F At which step does yours fail?[/quote]

    Line 3! Whereas your version outputs "Please wait while bootstrapping configure ...", mine gives "‘C:\mingw\local\qt-src\qtbase\configure.exe’ is not recognized as an internal or external command, operable program or batch file."

    I now understand a bit more about what is supposed to be happening - configure.exe is built in the bootstrapping process and finally linked in your line 76. I don't seem to be entering the bootstrapping process, rather trying to execute configure.exe from the off.

    I suspect the fundamental issue is where this double slash is coming from. Maybe I will try on another machine in case there is something messed up with my version of Windows...



  • I had the double slash issue. I can't remember exactly how I fixed it though. I think the trick was to use the recommended build tools (the sljljljlj thingy one). I also had problems as my LIB and INCLUDE variables needed to be cleared before I built anything as mingw picked up a gtk+ library. I think the \ issue arises because PATH doesn't point towards the mingw configure. I'm sorry I can't remember the exact fix. If you want more info let me know.



  • About the "\configure.exe not recognized" error: it is qtbase\configure.bat that is trying to call it. qtbase\configure.bat can build configure.exe before calling it. To trigger the build create an empty file qtbase.gitignore
    This tricks configure.bat and it builds configure.exe
    Hope this helps. I was getting the same problem with Qt-5.0.2


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.