Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Building Qt 4.8.7 with Visual Studio 2017?
Forum Updated to NodeBB v4.3 + New Features

Building Qt 4.8.7 with Visual Studio 2017?

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 8 Posters 12.7k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS SGaist

    Hi,

    What exact error do you have ?

    B Offline
    B Offline
    Bart_Vandewoestyne
    wrote on last edited by
    #3

    @SGaist I get

    QMAKESPEC environment variable is set to "win32-msvc2017" which is not a supported platform
    

    That error comes from tools/configure/configureapp.cpp and is due to the fact that the configure tool does not support win32-msvc2017. I would like to modify the source code of the configure tool and rebuild it with support for win32-msvc2017, but I cannot get it to build yet...

    jsulmJ 1 Reply Last reply
    0
    • B Bart_Vandewoestyne

      @SGaist I get

      QMAKESPEC environment variable is set to "win32-msvc2017" which is not a supported platform
      

      That error comes from tools/configure/configureapp.cpp and is due to the fact that the configure tool does not support win32-msvc2017. I would like to modify the source code of the configure tool and rebuild it with support for win32-msvc2017, but I cannot get it to build yet...

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @Bart_Vandewoestyne Do you really need to build Qt 4.8.7 with VS2017?
      This Qt version is quite old and for sure was never tested with VS2017.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • B Bart_Vandewoestyne

        Has anyone ever tried compiling Qt 4.8.7 with Visual Studio 2017? Our code is still based on Qt 4.8.7, but we currently don't have time to upgrade to Qt 5.X yet. However, we would like to upgrade our compiler to VS2017...

        I tried simply copying the win32-msvc2015 mkspecs directory to a new win32-msvc2017, and tried using QMAKESPEC=win32-msvc2017, but it turns out that it is not that simple. From my investigations, I deduced that I also need to adapt and recompile the configure.exe tool so that it supports VS2017, but up until now, I haven't succeeded in that yet.

        So my two questions are:

        1. Does anyone have experience/steps/links about compiling Qt 4.8.7 with VS2017?
        2. How does one recompile the configure tool which is under the tools directory in the 4.8.7 source tree?
        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #5

        @Bart_Vandewoestyne said in Building Qt 4.8.7 with Visual Studio 2017?:

        1. How does one recompile the configure tool which is under the tools directory in the 4.8.7 source tree?

        Rather than modifying the tools, it's probably easier to fool them into thinking that you're using MSVC 2015.

        MSVC 2017 is supposedly compatible with MSVC 2015.

        Try using the win32-msvc2015 mkspec. If something fails, try modifying mkspecs/win32-msvc2015/qmake.conf by replacing QMAKE_COMPILER_DEFINES += _MSC_VER=1900 WIN32 with the appropriate version number (see https://blogs.msdn.microsoft.com/vcblog/2017/11/15/side-by-side-minor-version-msvc-toolsets-in-visual-studio-2017/ )

        Disclaimer: I've never tried this myself. This is just an educated guess.

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        B 1 Reply Last reply
        5
        • JKSHJ JKSH

          @Bart_Vandewoestyne said in Building Qt 4.8.7 with Visual Studio 2017?:

          1. How does one recompile the configure tool which is under the tools directory in the 4.8.7 source tree?

          Rather than modifying the tools, it's probably easier to fool them into thinking that you're using MSVC 2015.

          MSVC 2017 is supposedly compatible with MSVC 2015.

          Try using the win32-msvc2015 mkspec. If something fails, try modifying mkspecs/win32-msvc2015/qmake.conf by replacing QMAKE_COMPILER_DEFINES += _MSC_VER=1900 WIN32 with the appropriate version number (see https://blogs.msdn.microsoft.com/vcblog/2017/11/15/side-by-side-minor-version-msvc-toolsets-in-visual-studio-2017/ )

          Disclaimer: I've never tried this myself. This is just an educated guess.

          B Offline
          B Offline
          Bart_Vandewoestyne
          wrote on last edited by
          #6

          @JKSH said in Building Qt 4.8.7 with Visual Studio 2017?:

          @Bart_Vandewoestyne said in Building Qt 4.8.7 with Visual Studio 2017?:

          1. How does one recompile the configure tool which is under the tools directory in the 4.8.7 source tree?

          Rather than modifying the tools, it's probably easier to fool them into thinking that you're using MSVC 2015.

          I can understand that reasoning, but for now I prefer to go for the long term solution that can also benefit the community. I really want to try to modify the source so that it compiles with VS2017. Maybe also as a kind of exercise and for the challenge of it :-) And if I get it working, of course I can share the patch with the community.

          Here's my attempt so far: https://github.com/BartVandewoestyne/qt_4_8_7_with_vs2017_patch
          It is unfinished work. As you can see from the patch, I don't think there are that much changes necessary to adapt the configure tool and qmake for VS2017. However, I still haven't succeeded to re-compile the configure tool with my VS2017. I've found this link: https://wiki.qt.io/How_to_prevent_Qt_from_compiling_code_examples but i couldn't make it work.
          Any help with that would be appreciated, so that we can see what the next hurdle to overtake is :-)

          jsulmJ 1 Reply Last reply
          0
          • B Bart_Vandewoestyne

            @JKSH said in Building Qt 4.8.7 with Visual Studio 2017?:

            @Bart_Vandewoestyne said in Building Qt 4.8.7 with Visual Studio 2017?:

            1. How does one recompile the configure tool which is under the tools directory in the 4.8.7 source tree?

            Rather than modifying the tools, it's probably easier to fool them into thinking that you're using MSVC 2015.

            I can understand that reasoning, but for now I prefer to go for the long term solution that can also benefit the community. I really want to try to modify the source so that it compiles with VS2017. Maybe also as a kind of exercise and for the challenge of it :-) And if I get it working, of course I can share the patch with the community.

            Here's my attempt so far: https://github.com/BartVandewoestyne/qt_4_8_7_with_vs2017_patch
            It is unfinished work. As you can see from the patch, I don't think there are that much changes necessary to adapt the configure tool and qmake for VS2017. However, I still haven't succeeded to re-compile the configure tool with my VS2017. I've found this link: https://wiki.qt.io/How_to_prevent_Qt_from_compiling_code_examples but i couldn't make it work.
            Any help with that would be appreciated, so that we can see what the next hurdle to overtake is :-)

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #7

            @Bart_Vandewoestyne I think it would be better to ask on Qt developers mailing list.
            Qt4 isn't maintained any-more, so I don't think there will be new Qt4 release including your changes.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • P Offline
              P Offline
              perdigao1
              wrote on last edited by
              #8

              Hi Bart,

              I wonder if you have managed to compile Q 4.8.7 with VS 2017, because I am also interested to. Whenever I try, I get a lot of errors. I also try your diff, but after applying it, and run configure.exe, it stops saying 'file not found', but it does not say what file is not found. Thanks

              aha_1980A 1 Reply Last reply
              0
              • P perdigao1

                Hi Bart,

                I wonder if you have managed to compile Q 4.8.7 with VS 2017, because I am also interested to. Whenever I try, I get a lot of errors. I also try your diff, but after applying it, and run configure.exe, it stops saying 'file not found', but it does not say what file is not found. Thanks

                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by
                #9

                Hi @perdigao1,

                The mailing list request also lead to win32-msvc2015 mkspec, just as @JKSH recommended.

                So I guess that is worth a try.

                Regards

                Qt has to stay free or it will die.

                1 Reply Last reply
                4
                • D Offline
                  D Offline
                  Dariusz.Scharsig
                  wrote on last edited by Dariusz.Scharsig
                  #10

                  Hey Bart,

                  if you're still interested in a solution. I've got it to work.

                  I have a patched version of Qt, including a recompiled configure.exe that will allow you to use the win32-msvc2017 makespec.

                  https://github.com/scharsig/Qt/tree/master/qt-4.8.7-vs2017

                  You are right, there are several things to be done to make Qt 4.8.7 compilable with VS2017.
                  1.) You need to patch the code (which you have), but that was required for VS2015 aswell. No changes there.
                  2.) You need to create the new makespec. Which is fairly easy, just copy the win32-msvc2015 folder and rename it. You can change the QMAKE_COMPILER_DEFINES macro to contain the 1914 version instead of 1900, but it is not really required.
                  3.) qmake won't compile as it is, you need to change the Makefile.win32 file which is in the QTDIR/qmake folder. It's the first line with all the '||' or statements. Add the "$(QMAKESPEC)" == "win32-msvc2017" line to it. Otherwise, you'll get the error that you're using an unsupported compiler for this Makefile during the configure step.
                  4.) The configure program. You are right to want to change it. Two changes are needed:
                  a.) configureapp.cpp:1380: Add the qmakeSpec.endsWith("-msvc2017") line to it, otherwise the if statement won't use the "Makefile.win32" makefile when compiling qmake and everything else will fail.
                  b.) To make configure compilable, you will need to add this line to its configure.pro file:
                  win32-msvc2017: DEFINES += _ALLOW_KEYWORD_MACROS
                  You can add it directly into the win32-msvc* block, since you're only using it for 2017.

                  There's a bootstrapping problem of course. You need to create Makefiles for configure, but configure is the one that creates qmake.exe. My approach is to configure qt using the win32-msvc2015 makespec and let it create qmake. Then create the makefiles for configure, make sure I can compile it. It doesn't matter what you use to compile configure.exe. Now I can reconfigure the Qt build to use my win32-msvc2017 makespec and actually build the whole thing. I've tested it including the webkit, so I guess the worst is done ;).

                  It's not perfect yet. The makespec contains weird options (-FS) that give me warnings on my machine but that is easy to fix. The build step produces a couple of warnings here and there, but with Qt, I'm not sure they weren't there before.

                  Cheers

                  M 1 Reply Last reply
                  5
                  • D Dariusz.Scharsig

                    Hey Bart,

                    if you're still interested in a solution. I've got it to work.

                    I have a patched version of Qt, including a recompiled configure.exe that will allow you to use the win32-msvc2017 makespec.

                    https://github.com/scharsig/Qt/tree/master/qt-4.8.7-vs2017

                    You are right, there are several things to be done to make Qt 4.8.7 compilable with VS2017.
                    1.) You need to patch the code (which you have), but that was required for VS2015 aswell. No changes there.
                    2.) You need to create the new makespec. Which is fairly easy, just copy the win32-msvc2015 folder and rename it. You can change the QMAKE_COMPILER_DEFINES macro to contain the 1914 version instead of 1900, but it is not really required.
                    3.) qmake won't compile as it is, you need to change the Makefile.win32 file which is in the QTDIR/qmake folder. It's the first line with all the '||' or statements. Add the "$(QMAKESPEC)" == "win32-msvc2017" line to it. Otherwise, you'll get the error that you're using an unsupported compiler for this Makefile during the configure step.
                    4.) The configure program. You are right to want to change it. Two changes are needed:
                    a.) configureapp.cpp:1380: Add the qmakeSpec.endsWith("-msvc2017") line to it, otherwise the if statement won't use the "Makefile.win32" makefile when compiling qmake and everything else will fail.
                    b.) To make configure compilable, you will need to add this line to its configure.pro file:
                    win32-msvc2017: DEFINES += _ALLOW_KEYWORD_MACROS
                    You can add it directly into the win32-msvc* block, since you're only using it for 2017.

                    There's a bootstrapping problem of course. You need to create Makefiles for configure, but configure is the one that creates qmake.exe. My approach is to configure qt using the win32-msvc2015 makespec and let it create qmake. Then create the makefiles for configure, make sure I can compile it. It doesn't matter what you use to compile configure.exe. Now I can reconfigure the Qt build to use my win32-msvc2017 makespec and actually build the whole thing. I've tested it including the webkit, so I guess the worst is done ;).

                    It's not perfect yet. The makespec contains weird options (-FS) that give me warnings on my machine but that is easy to fix. The build step produces a couple of warnings here and there, but with Qt, I'm not sure they weren't there before.

                    Cheers

                    M Offline
                    M Offline
                    mic19
                    wrote on last edited by
                    #11

                    @Dariusz.Scharsig I had modified qt5.4.1 as what you said. But when compile qt with vs2017, cmd print error: File or path not found(make). So , is there any more files should I modify to let it compile successful?

                    jsulmJ 1 Reply Last reply
                    0
                    • M mic19

                      @Dariusz.Scharsig I had modified qt5.4.1 as what you said. But when compile qt with vs2017, cmd print error: File or path not found(make). So , is there any more files should I modify to let it compile successful?

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #12

                      @mic19 It should be nmake.exe not make when using VS

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      2

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved