Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Building Qt 5.3.0 with Visual Studio 2015
QtWS25 Last Chance

Building Qt 5.3.0 with Visual Studio 2015

Scheduled Pinned Locked Moved Installation and Deployment
8 Posts 2 Posters 17.7k Views
  • 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.
  • M Offline
    M Offline
    MiJo
    wrote on last edited by
    #1

    I'm trying to build Qt 5.3 with Visual Studio 2015 (using the Visual Studio 2015 preview version).

    I made some minor changes to the win32-msvc2013 mkspec to use the Visual Studio 2015 compiler:

    Changed
    @
    MSVC_VER = 12.0
    QMAKE_COMPILER_DEFINES += _MSC_VER=1800 _WIN32
    @

    to
    @
    MSVC_VER = 14.0
    QMAKE_COMPILER_DEFINES += _MSC_VER=1900 _WIN32
    @

    I have created the following build script, which will end up with this config:
    @
    configure -platform win32-msvc2013 -prefix c:\Qt\5.3.0.2015\msvc2013 -opensource -confirm-license -c++11 -opengl desktop -nomake examples -nomake tests -qt-sql-sqlite -icu -I C:\Qt\icu_52_1_msvc_2013_32_devel\icu\include -L C:\Qt\icu_52_1_msvc_2013_32_devel\icu\lib -openssl -I C:\Qt\openssl-1.0.1h.VS2013\include -L C:\Qt\openssl-1.0.1h.VS2013\lib -plugin-sql-mysql -I C:\Qt\MySql5.1\include -L C:\Qt\MySql5.1\lib\opt
    @

    @rem Set Visual studion 2015 environment
    CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86

    @echo on

    rem set the intermediate build path
    set QT_VERSION=5.3.0
    set QT_TARGET=msvc2013
    set QT_SRC_PATH=c:\Qt%QT_VERSION%.2015\src
    set QT_BUILD_PATH=c:\Qt%QT_VERSION%.2015%QT_TARGET%_build
    set QT_INSTALL_PATH=c:\Qt%QT_VERSION%.2015%QT_TARGET%
    set QMAKESPEC=win32-%QT_TARGET%

    rem 3rd party paths
    set PYTHON_PATH=C:\Python34
    set MYSQLDIR=C:\Qt\MySql5.1
    set ICU_PATH=C:\Qt\icu_52_1_msvc_2013_32_devel\icu
    set OPENSSL_PATH=C:\Qt\openssl-1.0.1h.VS2013

    rem Add 3rd party libs and includes to environment
    set LIB=%ICU_PATH%\lib;%OPENSSL_PATH%\lib;%LIB%
    set INCLUDE=%ICU_PATH%\include;%OPENSSL_PATH%\include;%INCLUDE%

    rem Set Qt folders and 3rd party apps to path
    set PATH=%QT_BUILD_PATH%\qtbase\bin;%QT_SRC_PATH%\qtrepotools\bin;%QT_SRC_PATH%\gnuwin32\bin;%MYSQLDIR%;%PYTHON_PATH%;%ICU_PATH%\lib;%OPENSSL_PATH%\bin;%PATH%

    rem Due to issues with a duplicate header between MySql and Qt, rename the mySql header.
    rem Not the nicest way to do this, but is supposed to work fine. Make sure to rename it back when done.
    ren %MYSQLDIR%\include\decimal.h decimal.h__

    rem Set compiler to run on 8 cores
    set CL=/MP8

    md %QT_BUILD_PATH%
    cd %QT_BUILD_PATH%
    rem Configure the Qt build
    rem default configuration parameters
    rem -platform specifies the build platform
    rem -prefix sets the final installation path
    rem -opensource identifies the build as opensource license
    rem -confirm-license automatically accept the opensource license
    rem -c++11 set to c++11 standard
    set DEFAULT=-platform %QMAKESPEC% -prefix %QT_INSTALL_PATH% -opensource -confirm-license -c++11
    rem Build OpenGL instead of ANGLE
    set OPENGL=-opengl desktop
    rem Examples take some time to build, may be skipped
    set SKIP_EXAMPLES=-nomake examples
    rem Tests take some time to build, may be skipped
    set SKIP_TESTS=-nomake tests
    rem SQLite is needed to build QtWebkit
    set SQLITE=-qt-sql-sqlite
    rem ICU is needed to build QtWebkit
    set ICU=-icu -I %ICU_PATH%\include -L %ICU_PATH%\lib
    rem Build OpenSSL
    set OPEN_SSL=-openssl -I %OPENSSL_PATH%\include -L %OPENSSL_PATH%\lib
    rem build MySql plugin
    set MYSQL_PLUGIN=-plugin-sql-mysql -I %MYSQLDIR%\include -L %MYSQLDIR%\lib\opt
    rem Combine all of the above in the Qt configure command
    call %QT_SRC_PATH%\configure

    "Compiler output":https://www.dropbox.com/s/sp5t2mlor3fzmpp/buildlog.txt?dl=0

    So, as you can see, I'm getting internal compiler errors almost imediately in the build process.
    I know that I'm building agains msvc2013 external libraries, but I'm not even getting to the point that they are actually used.

    Anyone have any thoughts what might be causing the compiler errors?

    I also know that I'm changing the build spec quick and dirty, by adepting the mkspec for msvc2013, but I don't know how to add a new mkspec to all of the code.

    The same seems to happen when building 5.4.0 RC

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Adding a new mkspec is pretty simple, just copy the win32-msvc2013 and rename it to win32-msvc2015, then modify and use that one.

      Second thing to do is not try to link against 2013 built libraries. If 2015 follows the same pattern as the older one, mixing libraries from different VS version is not possible.

      Last thing, before adding icu, OpenSSL and MySQL you rather try to build Qt with the default parameters.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MiJo
        wrote on last edited by
        #3

        Thanks for the reply SGaist.

        I tried the following:

        Clone the code from git://gitorious.org/qt/qt5.git, branch 5.3.2

        I copied the qtbase\mkspecs\win32-msvc2013 mkspec, named it win32-msvc2015.

        Changed
        @
        MSVC_VER = 12.0
        QMAKE_COMPILER_DEFINES += _MSC_VER=1800 _WIN32
        @

        to
        @
        MSVC_VER = 14.0
        QMAKE_COMPILER_DEFINES += _MSC_VER=1900 _WIN32
        @

        This does not configure imediately, so I searched for references to msvc2013 and made changes to add msvc2015, I created these patches:

        https://www.dropbox.com/s/rcdg8kfdhqhm1k0/qtbase-0001-Added-msvc2015-mkspec.patch?dl=0

        https://www.dropbox.com/s/ycle96g0r1u0o5d/qttools-0001-Added-msvc2015-mkspec.patch?dl=0

        https://www.dropbox.com/s/rzy0rtom02xt2up/qtwebkit-0001-Added-msvc2015-mkspec.patch?dl=0

        Then opened a command prompt (as administrator) and tried to confige Qt:

        @
        rem Set Visual studion 2015 environment
        CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86

        rem set the intermediate build path
        set QT_VERSION=5.3.2
        set QT_TARGET=msvc2015
        set QT_SRC_PATH=c:\Qt%QT_VERSION%\src
        set QT_BUILD_PATH=c:\Qt%QT_VERSION%%QT_TARGET%_build
        set QT_INSTALL_PATH=c:\Qt%QT_VERSION%%QT_TARGET%
        set QMAKESPEC=win32-%QT_TARGET%

        rem Set Qt folders and 3rd party apps to path
        set PATH=%QT_BUILD_PATH%\qtbase\bin;%QT_SRC_PATH%\qtrepotools\bin;%QT_SRC_PATH%\gnuwin32\bin;%PATH%

        md %QT_BUILD_PATH%
        cd %QT_BUILD_PATH%

        call %QT_SRC_PATH%\configure -platform %QMAKESPEC% -prefix %QT_INSTALL_PATH% -opensource
        @

        When trying this, I'm still getting compiler errors, see the output:
        @
        https://www.dropbox.com/s/wm8sujc0s0x05rx/build.log.txt?dl=0
        @

        The compiler fails at
        @
        c:\qt\5.3.2\src\qtbase\src\corelib\tools\qvector.h(504) : fatal error C1001: An internal error has occurred in the compiler.

        cl : Command line error D8040 : error creating or communicating with child process
        @

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Looks like you might have found a compiler bug

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • M Offline
            M Offline
            MiJo
            wrote on last edited by
            #5

            Or maybe I'm doing something wrong, seem to get the same result even if I rename the msvc-2015 mkspec folder. I think there is a wrong reference somewhere.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              MiJo
              wrote on last edited by
              #6

              Ok, found something strange. I set my target mkspec to msvc2018, and I'm not getting any errors on this? Compiling of configure.exe just seems to be the same as before, with same errors on the VS compiler.

              @
              rem Set Visual studion 2015 environment
              rem CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86

              rem set the intermediate build path
              set QT_VERSION=5.3.2
              set QT_TARGET=msvc2018
              set QT_SRC_PATH=c:\Qt%QT_VERSION%\src
              set QT_BUILD_PATH=c:\Qt%QT_VERSION%%QT_TARGET%_build
              set QT_INSTALL_PATH=c:\Qt%QT_VERSION%%QT_TARGET%
              set QMAKESPEC=win32-%QT_TARGET%

              rem Set Qt folders and 3rd party apps to path
              rem set PATH=%QT_BUILD_PATH%\qtbase\bin;%QT_SRC_PATH%\qtrepotools\bin;%QT_SRC_PATH%\gnuwin32\bin;%PATH%
              rem goto end

              md %QT_BUILD_PATH%
              cd %QT_BUILD_PATH%

              call %QT_SRC_PATH%\configure -platform %QMAKESPEC% -prefix %QT_INSTALL_PATH% -opensource

              :end
              @

              Build log:
              https://www.dropbox.com/s/m0gg57wlsc7z42x/build3.log.txt?dl=0

              I think this is suggesting that I am missing a reference to the correct mkspec somewhere and it is referting to a default value, probably the win32-msvc2005 mkspec.

              I will dig some more to see if I can find out what I am missing for a new configuration.

              I will also try again to to edit the msvc2013 mkspec to use msvc2015, to see if this gives different compilation results.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Some mkspecs share a common set of configuration you can follow them from one file to the other(s)

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  MiJo
                  wrote on last edited by
                  #8

                  Got the makespecs right I guess, tried some other things to get configure building. Added -GL compiler option to enabled link time code generation, compilation seems to be fine then, only this time the linker crashes, and yes of course during the link time code generation.

                  So I did some further investigation regarding the compiler errors. It seems that everytime Microsoft puts out a preview version of a new Visual Studio version, compiler errors seem to pop up everywhere. Since it is crashing during compilation of QVector, and I'm reading a lot about VC compiler not handling templating very well, it must be that the template code is not being handled correctly by the compiler.

                  I will see if I can figure out if I can force the compiler to build with a newer c++ standard.

                  1 Reply Last reply
                  0

                  • Login

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