Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. building Qt for Windows (revisited)
Forum Updated to NodeBB v4.3 + New Features

building Qt for Windows (revisited)

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
14 Posts 2 Posters 1.9k Views 2 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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #2

    BTT. I need to get this working again; any suggestions?

    Thanks...

    1 Reply Last reply
    0
    • mzimmersM mzimmers

      Hi all -

      Last year, I thought I had this issue resolved (see this thread for details), but evidently some changes have occurred and I need to update my procedure.

      This was the configure command I used:

      configure -static -static-runtime -developer-build -opensource -release -platform win32-g++ -opengl desktop -nomake tests -recheck-all
      

      Here's the error I'm getting now when I try to run mingw32-make:

      C:/qt5/qtbase/lib/libQt5QuickParticles.a(qquickimageparticle.o):qquickimageparticle.cpp:(.text$_ZN23SpriteMaterialRhiShader18updateSampledImageERN20QSGMaterialRhiShader11RenderStateEiPP10QSGTextureP11QSGMaterialS7_[__ZN23SpriteMaterialRhiShader18updateSampledImageERN20QSGMaterialRhiShader11RenderStateEiPP10QSGTextureP11QSGMaterialS7_]+0x0): first defined here
      C:/qt5/qtbase/lib/libQt5Quick.a(qsgdefaultspritenode.o):qsgdefaultspritenode.cpp:(.text$_ZN23SpriteMaterialRhiShader17updateUniformDataERN20QSGMaterialRhiShader11RenderStateEP11QSGMaterialS4_+0x0): multiple definition of `SpriteMaterialRhiShader::updateUniformData(QSGMaterialRhiShader::RenderState&, QSGMaterial*, QSGMaterial*)'
      C:/qt5/qtbase/lib/libQt5QuickParticles.a(qquickimageparticle.o):qquickimageparticle.cpp:(.text$_ZN23SpriteMaterialRhiShader17updateUniformDataERN20QSGMaterialRhiShader11RenderStateEP11QSGMaterialS4_[__ZN23SpriteMaterialRhiShader17updateUniformDataERN20QSGMaterialRhiShader11RenderStateEP11QSGMaterialS4_]+0x0): first defined here
      C:/qt5/qtbase/lib/libQt5Quick.a(qsgdefaultspritenode.o):qsgdefaultspritenode.cpp:(.data$_ZZNK20SpriteMaterialShader14attributeNamesEvE4attr[__ZZNK20SpriteMaterialShader14attributeNamesEvE4attr]+0x0): multiple definition of `SpriteMaterialShader::attributeNames() const::attr'
      C:/qt5/qtbase/lib/libQt5QuickParticles.a(qquickimageparticle.o):qquickimageparticle.cpp:(.rdata$_ZZNK20SpriteMaterialShader14attributeNamesEvE4attr[__ZZNK20SpriteMaterialShader14attributeNamesEvE4attr]+0x0): first defined here
      collect2.exe: error: ld returned 1 exit status
      mingw32-make[4]: *** [Makefile:76: animation.exe] Error 1
      mingw32-make[4]: Leaving directory 'C:/qt5/qtdeclarative/examples/quick/animation'
      mingw32-make[3]: *** [Makefile:106: sub-animation-make_first] Error 2
      mingw32-make[3]: Leaving directory 'C:/qt5/qtdeclarative/examples/quick'
      mingw32-make[2]: *** [Makefile:102: sub-quick-make_first] Error 2
      mingw32-make[2]: Leaving directory 'C:/qt5/qtdeclarative/examples'
      mingw32-make[1]: *** [Makefile:104: sub-examples-make_first] Error 2
      mingw32-make[1]: Leaving directory 'C:/qt5/qtdeclarative'
      mingw32-make: *** [Makefile:343: module-qtdeclarative-make_first] Error 2
      

      Any ideas where I went wrong? Thanks.

      As an aside, I believe that the wiki on this subject, which was already flawed, is now broken. The PS script it references relies on the old method of obtaining source code, which I'm fairly sure won't work any more. Once I get my build process working, I'll publish the complete steps here.

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by kshegunov
      #3

      Do you really need the examples built? If not, try adding -nomake examples.

      EDIT:
      Why are you using -developer-build? Are you going to be patching Qt? If not then remove it, and it's incompatible with -release.

      Read and abide by the Qt Code of Conduct

      mzimmersM 1 Reply Last reply
      1
      • kshegunovK kshegunov

        Do you really need the examples built? If not, try adding -nomake examples.

        EDIT:
        Why are you using -developer-build? Are you going to be patching Qt? If not then remove it, and it's incompatible with -release.

        mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #4

        @kshegunov I fixed the configure command per your suggestions. Now make fails here:

        g++ -c -include .pch/release/qt_pch.h -fno-keep-inline-dllexport -msse2 -mstackrealign -mfpmath=sse -O3 -std=c++1z -ffunction-sections -fdata-sections -fexceptions -mthreads -Wall -W -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQFLOAT16_INCLUDE_FAST -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_NO_DEBUG -DPCRE2_CODE_UNIT_WIDTH=16 -DPCRE2_STATIC -I. -Iglobal -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -I../3rdparty/sha3 -I../3rdparty -I../3rdparty/double-conversion/include -I../3rdparty/double-conversion/include/double-conversion -I../3rdparty/tinycbor/src -I../../include -I../../include/QtCore -I../../include/QtCore/5.12.6 -I../../include/QtCore/5.12.6/QtCore -Itmp -I.moc/release -I.tracegen/release -I../3rdparty/pcre2/src -I../../mkspecs/win32-g++  -o .obj/release/qsignaltransition.o statemachine/qsignaltransition.cpp
        In file included from statemachine/qabstracttransition.cpp:435:0:
        .moc/release/moc_qabstracttransition.cpp:12:10: fatal error: QtCore/QList: No such file or directory
         #include <QtCore/QList>
                  ^~~~~~~~~~~~~~
        compilation terminated.
        

        Am I missing a pathname to point to QtCore? Thanks.

        PS: I got some of my configure options from here if you're interested.

        kshegunovK 1 Reply Last reply
        0
        • mzimmersM mzimmers

          @kshegunov I fixed the configure command per your suggestions. Now make fails here:

          g++ -c -include .pch/release/qt_pch.h -fno-keep-inline-dllexport -msse2 -mstackrealign -mfpmath=sse -O3 -std=c++1z -ffunction-sections -fdata-sections -fexceptions -mthreads -Wall -W -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQFLOAT16_INCLUDE_FAST -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_NO_DEBUG -DPCRE2_CODE_UNIT_WIDTH=16 -DPCRE2_STATIC -I. -Iglobal -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -I../3rdparty/sha3 -I../3rdparty -I../3rdparty/double-conversion/include -I../3rdparty/double-conversion/include/double-conversion -I../3rdparty/tinycbor/src -I../../include -I../../include/QtCore -I../../include/QtCore/5.12.6 -I../../include/QtCore/5.12.6/QtCore -Itmp -I.moc/release -I.tracegen/release -I../3rdparty/pcre2/src -I../../mkspecs/win32-g++  -o .obj/release/qsignaltransition.o statemachine/qsignaltransition.cpp
          In file included from statemachine/qabstracttransition.cpp:435:0:
          .moc/release/moc_qabstracttransition.cpp:12:10: fatal error: QtCore/QList: No such file or directory
           #include <QtCore/QList>
                    ^~~~~~~~~~~~~~
          compilation terminated.
          

          Am I missing a pathname to point to QtCore? Thanks.

          PS: I got some of my configure options from here if you're interested.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #5

          @mzimmers said in building Qt for Windows (revisited):

          Am I missing a pathname to point to QtCore?

          Not that I know of.

          I got some of my configure options from here if you're interested.

          What are is the exact line you used? (and please include it on every iteration, to make keeping track easier)
          How did you obtain the source and which Qt version is this?

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          1
          • mzimmersM Offline
            mzimmersM Offline
            mzimmers
            wrote on last edited by
            #6

            My latest configure command is:

            configure -mp -confirm-license -static -static-runtime -opensource -release -platform win32-g++ -opengl desktop -nomake examples -nomake tests -nomake tools -recheck-all
            

            My make command is:

            mingw32-make -k -j4
            

            Which is in C:\Qt\Tools\mingw730_32\bin.

            I got the source from github, using branch 5.12.6.

            Thanks...

            kshegunovK 1 Reply Last reply
            0
            • mzimmersM mzimmers

              My latest configure command is:

              configure -mp -confirm-license -static -static-runtime -opensource -release -platform win32-g++ -opengl desktop -nomake examples -nomake tests -nomake tools -recheck-all
              

              My make command is:

              mingw32-make -k -j4
              

              Which is in C:\Qt\Tools\mingw730_32\bin.

              I got the source from github, using branch 5.12.6.

              Thanks...

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by kshegunov
              #7

              @mzimmers said in building Qt for Windows (revisited):

              My latest configure command is

              I don't know what -mp does, but everything else seems okay. I'd add -redo to make sure it recompiles qmake so there's no doubt you're working from a clean start.

              My make command is

              What does -k mean?

              I got the source from github, using branch 5.12.6.

              Okay, I usually clone from code.qt.io, but the github mirror should be working fine as well.

              Sorry couldn't be of more help, but it doesn't seem you're doing something wrong. If -redo doesn't help, perhaps (re)start from a clean tree?

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              0
              • mzimmersM Offline
                mzimmersM Offline
                mzimmers
                wrote on last edited by
                #8

                -mp is multi-processing (akin to the -j option for make).
                -k, --keep-going Keep going when some targets can't be made.

                I'll start again with the "-redo" and see what happens. Failing that, I'll kill the copy I have and get another, from code.qt.io. I'll report back with my findings.

                Thanks for looking.

                1 Reply Last reply
                0
                • mzimmersM Offline
                  mzimmersM Offline
                  mzimmers
                  wrote on last edited by mzimmers
                  #9

                  Current steps attempted:

                  1. git clone from the Qt (not github) repository (5.12 branch)
                  2. add the following (through a script):
                  SET _ROOT=C:\qt5
                  SET PATH=C:\Qt\Tools\mingw730_32\bin;%PATH%
                  SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
                  
                  1. configure as follows:
                  configure -mp -confirm-license -static -static-runtime -opensource -release -platform win32-g++ -opengl desktop -nomake examples -nomake tests -nomake tools -recheck-all -prefix /Qt5Static
                  
                  1. mingw32-make -j4

                  I get this error:

                  g++ -c -include .pch/release/qt_pch.h -fno-keep-inline-dllexport -msse2 -mstackrealign -mfpmath=sse -O3 -std=c++1z -ffunction-sections -fdata-sections -fexceptions -mthreads -Wall -W -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQFLOAT16_INCLUDE_FAST -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_NO_DEBUG -DPCRE2_CODE_UNIT_WIDTH=16 -DPCRE2_STATIC -I. -Iglobal -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -I../3rdparty/sha3 -I../3rdparty -I../3rdparty/double-conversion/include -I../3rdparty/double-conversion/include/double-conversion -I../3rdparty/tinycbor/src -I../../include -I../../include/QtCore -I../../include/QtCore/5.12.7 -I../../include/QtCore/5.12.7/QtCore -Itmp -I.moc/release -I.tracegen/release -I../3rdparty/pcre2/src -I../../mkspecs/win32-g++  -o .obj/release/qcollator.o tools/qcollator.cpp
                  In file included from tools/qcollator.cpp:41:0:
                  tools/qcollator_p.h:57:10: fatal error: QVector: No such file or directory
                   #include <QVector>
                            ^~~~~~~~~
                  compilation terminated.
                  

                  EDIT: I also tried without the -nomake tools (purely as a guess); same results.

                  kshegunovK 1 Reply Last reply
                  0
                  • mzimmersM mzimmers

                    Current steps attempted:

                    1. git clone from the Qt (not github) repository (5.12 branch)
                    2. add the following (through a script):
                    SET _ROOT=C:\qt5
                    SET PATH=C:\Qt\Tools\mingw730_32\bin;%PATH%
                    SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
                    
                    1. configure as follows:
                    configure -mp -confirm-license -static -static-runtime -opensource -release -platform win32-g++ -opengl desktop -nomake examples -nomake tests -nomake tools -recheck-all -prefix /Qt5Static
                    
                    1. mingw32-make -j4

                    I get this error:

                    g++ -c -include .pch/release/qt_pch.h -fno-keep-inline-dllexport -msse2 -mstackrealign -mfpmath=sse -O3 -std=c++1z -ffunction-sections -fdata-sections -fexceptions -mthreads -Wall -W -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQFLOAT16_INCLUDE_FAST -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_NO_DEBUG -DPCRE2_CODE_UNIT_WIDTH=16 -DPCRE2_STATIC -I. -Iglobal -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -I../3rdparty/sha3 -I../3rdparty -I../3rdparty/double-conversion/include -I../3rdparty/double-conversion/include/double-conversion -I../3rdparty/tinycbor/src -I../../include -I../../include/QtCore -I../../include/QtCore/5.12.7 -I../../include/QtCore/5.12.7/QtCore -Itmp -I.moc/release -I.tracegen/release -I../3rdparty/pcre2/src -I../../mkspecs/win32-g++  -o .obj/release/qcollator.o tools/qcollator.cpp
                    In file included from tools/qcollator.cpp:41:0:
                    tools/qcollator_p.h:57:10: fatal error: QVector: No such file or directory
                     #include <QVector>
                              ^~~~~~~~~
                    compilation terminated.
                    

                    EDIT: I also tried without the -nomake tools (purely as a guess); same results.

                    kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by kshegunov
                    #10

                    I'm out of ideas. My best guess now is to disable the pch (i.e. -no-pch), and I'd suggest removing -mp just to be sure it's not interfering.

                    PS.
                    Can you try building dynamic binaries, just to compare?

                    Read and abide by the Qt Code of Conduct

                    mzimmersM 1 Reply Last reply
                    1
                    • kshegunovK kshegunov

                      I'm out of ideas. My best guess now is to disable the pch (i.e. -no-pch), and I'd suggest removing -mp just to be sure it's not interfering.

                      PS.
                      Can you try building dynamic binaries, just to compare?

                      mzimmersM Offline
                      mzimmersM Offline
                      mzimmers
                      wrote on last edited by
                      #11

                      @kshegunov tried "-no-pch" and removing "-static -static-runtime" and got the same errors.

                      I did find windows-requirements, which is interesting, but I never had to manually add any of those things in the past. Do I really need to do that now?

                      kshegunovK 1 Reply Last reply
                      0
                      • mzimmersM mzimmers

                        @kshegunov tried "-no-pch" and removing "-static -static-runtime" and got the same errors.

                        I did find windows-requirements, which is interesting, but I never had to manually add any of those things in the past. Do I really need to do that now?

                        kshegunovK Offline
                        kshegunovK Offline
                        kshegunov
                        Moderators
                        wrote on last edited by
                        #12

                        @mzimmers said in building Qt for Windows (revisited):

                        tried "-no-pch" and removing "-static -static-runtime" and got the same errors.

                        I don't know, sorry. Nothing else comes to mind. :|

                        I did find windows-requirements, which is interesting, but I never had to manually add any of those things in the past. Do I really need to do that now?

                        I don't think so. I haven't done so the last time I build Qt on windows a couple of months or so ago.

                        Read and abide by the Qt Code of Conduct

                        mzimmersM 1 Reply Last reply
                        0
                        • kshegunovK kshegunov

                          @mzimmers said in building Qt for Windows (revisited):

                          tried "-no-pch" and removing "-static -static-runtime" and got the same errors.

                          I don't know, sorry. Nothing else comes to mind. :|

                          I did find windows-requirements, which is interesting, but I never had to manually add any of those things in the past. Do I really need to do that now?

                          I don't think so. I haven't done so the last time I build Qt on windows a couple of months or so ago.

                          mzimmersM Offline
                          mzimmersM Offline
                          mzimmers
                          wrote on last edited by
                          #13

                          I'm going to try 5.13; I can't think of anything else either.

                          1 Reply Last reply
                          1
                          • mzimmersM Offline
                            mzimmersM Offline
                            mzimmers
                            wrote on last edited by
                            #14

                            Update on this: it turns out that there were some artifacts from a prior version of Qt that caused make to look at/use incorrect locations for some files. I blew away the directory and re-cloned.

                            Here are my condensed notes on how to accomplish this (note that this is for a static build):

                            1. $ git clone https://code.qt.io/qt/qt5.git
                            2. $ cd qt5
                            3. $ git checkout v5.14.1 // or whatever
                            4. $ perl init-repository
                            
                            	or 
                            	
                               $ git submodule update --init --recursive
                            5. $ configure -confirm-license -static -static-runtime -opensource -release -platform win32-g++ -opengl desktop -nomake examples -nomake tests -nomake tools -recheck-all -prefix c:\qt5\5.14.1\static
                            6. mingw32-make -j4
                            7. mingw32-make install // if a prefix option was specified in configure
                            

                            Thanks to everyone for the help on a frustrating issue.

                            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