Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Error on Qt 6 Building from source for Windows Based
Forum Updated to NodeBB v4.3 + New Features

Error on Qt 6 Building from source for Windows Based

Scheduled Pinned Locked Moved Solved Qt 6
59 Posts 9 Posters 18.9k Views 3 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.
  • N Offline
    N Offline
    NiVa99
    wrote on last edited by
    #46
    This post is deleted!
    1 Reply Last reply
    0
    • N Offline
      N Offline
      NiVa99
      wrote on last edited by
      #47
      This post is deleted!
      1 Reply Last reply
      0
      • N Offline
        N Offline
        NiVa99
        wrote on last edited by
        #48
        This post is deleted!
        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by Christian Ehrlicher
          #49

          Do you want to compile with MinGW or MSVC?
          If MinGW - why do you call MSVC batch files which set MSVC specific env vars?
          If MSVC - why do you call g++?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • N Offline
            N Offline
            NiVa99
            wrote on last edited by
            #50

            First want to call msvc VS2019 building arch amd64 x64 (done) and x86.
            Second doing same build with mingw last as documented. link text

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #51

              Still does not explain why you set MSVC env vars when trying to build with MinGW.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0
              • N Offline
                N Offline
                NiVa99
                wrote on last edited by NiVa99
                #52

                Tyying this batch inspired from this post. I thank Chris Kawa.

                I thought it was to build with MSVC 2019.

                SET VS_ENVIRONMENT="c:\Program Files (x86)\Microsoft Visual Studio\2019\VC\Auxiliary\Build\vcvars64.bat"
                SET SRC_DIR="d:\Logiciels\Qt\6.2.2\Src"
                SET BUILD_DIR="d:\Logiciels\Qt\6.2.2\Build"
                SET INSTALL_DIR="d:\Logiciels\Qt\6.2.2\vs2019-x64"
                SET CONFIGURE_OPTIONS=-debug-and-release -mp -opensource -confirm-license
                
                call %VS_ENVIRONMENT%
                mkdir %BUILD_DIR%
                mkdir %INSTALL_DIR%
                cd %BUILD_DIR%
                call %SRC_DIR%\configure -prefix %INSTALL_DIR% %CONFIGURE_OPTIONS%
                cmake --build . --parallel
                cmake --install .
                cmake --install . --config Release
                cd %INSTALL_DIR%
                :: rmdir %BUILD_DIR% /Q /S
                pause
                

                I got these error, have to set WINVER and _WIN32_WINNT defines but how doing it ?

                Performing C++ SOURCE FILE Test HAVE_WIN10_WIN32_WINNT failed with the following output:
                Change Dir: D:/Logiciels/Qt/6.2.2/Build/CMakeFiles/CMakeTmp
                
                Run Build Command(s):C:/ninja-win/ninja.exe -f build-Release.ninja cmTC_9e6d0 && [1/2] Building CXX object CMakeFiles/cmTC_9e6d0.dir/Release/src.cxx.obj
                
                FAILED: CMakeFiles/cmTC_9e6d0.dir/Release/src.cxx.obj 
                
                C:\Strawberry\c\bin\c++.exe -DHAVE_WIN10_WIN32_WINNT -DCMAKE_INTDIR=\"Release\"  -O3 -DNDEBUG -std=gnu++17 -o CMakeFiles/cmTC_9e6d0.dir/Release/src.cxx.obj -c D:/Logiciels/Qt/6.2.2/Build/CMakeFiles/CMakeTmp/src.cxx
                
                D:/Logiciels/Qt/6.2.2/Build/CMakeFiles/CMakeTmp/src.cxx:6:10: error: #error "_WIN32_WINNT version **too low**"
                         #error "_WIN32_WINNT version too low"
                          ^~~~~
                D:/Logiciels/Qt/6.2.2/Build/CMakeFiles/CMakeTmp/src.cxx:9:10: error: #error "WINVER version too low"
                         #error "WINVER version too low"
                          ^~~~~
                ninja: build stopped: subcommand failed.
                
                
                

                microsoft modifying-winver-and-win32-winnt
                #define WINVER 0x0A00
                #define _WIN32_WINNT 0x0A00

                Do I have to modify CMakeLists.txt or is it possibe to pass these defines from batch ?
                Thank you

                1 Reply Last reply
                0
                • Chris KawaC Chris Kawa

                  The error tells you what's wrong. Mingw sets _WIN32_WINNT and WINVER too low. I think Windows XP is its default and Qt6 requires at least Windows 10, so add defines for the appropriate versions in the configure params. Here are the values: WINVER and _WIN32_WINNT.

                  N Offline
                  N Offline
                  NiVa99
                  wrote on last edited by
                  #53

                  @Chris-Kawa

                  So I understood but don't know where can i add those defines'param for a build MSVC, in the bat or in cmakelists.txt or ninja config ?

                  post

                  Thank you.

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    NiVa99
                    wrote on last edited by
                    #54

                    It seems that it is well defined in qtbase\mkspecs\features\qt_module.prf|349| DEFINES *= _WIN32_WINNT=0x0A00

                    Why only in this file ?Capture.PNG

                    1 Reply Last reply
                    0
                    • Chris KawaC Offline
                      Chris KawaC Offline
                      Chris Kawa
                      Lifetime Qt Champion
                      wrote on last edited by
                      #55

                      @NiVa99 said:

                      So I understood but don't know where can i add those defines'param for a build MSVC, in the bat or in cmakelists.txt or ninja config ?

                      Sorry, but I'm completely confused now which build you're talking about. You're constantly mixing msvc, mingw and now ninja and I can't understand which errors you're getting from which build.

                      Could you maybe focus on one and state clearly which is it?
                      And don't modify any Qt files.

                      1 Reply Last reply
                      0
                      • N Offline
                        N Offline
                        NiVa99
                        wrote on last edited by
                        #56

                        Building according to this note Building Qt 6 from sources
                        Requirements are CMake, Ninja, Perl, Python.

                        Build Qt from Sources I search for is doing it with MSVC 2019, VS2022 (and later Ming).

                        1 Reply Last reply
                        0
                        • kkoehneK Offline
                          kkoehneK Offline
                          kkoehne
                          Moderators
                          wrote on last edited by
                          #57

                          @NiVa99 said in Error on Qt 6 Building from source for Windows Based:

                          C:\Strawberry\c\bin\c++.exe

                          Remove C:\Strawberry\c\bin from your PATH environment variable, and try a clean build again.

                          Background: CMake prefers clang/gcc over MSVC, even on Windows. So if you have anything called clang.exe, c++.exe ... in your PATH cmake will try to use that for compilation. Anyhow, the binaries in C:\Strawberry\c\bin are only for internal use of Strawberry - at least they're not enough to compile Qt.

                          If you want to use MSVC, call vcvars64.bat like @Christian-Ehrlicher suggested. If you want to use MinGW, prefer one of the MinGW toolchains that are supported by Qt: https://wiki.qt.io/MinGW

                          Director R&D, The Qt Company

                          1 Reply Last reply
                          0
                          • N Offline
                            N Offline
                            NiVa99
                            wrote on last edited by
                            #58
                            This post is deleted!
                            1 Reply Last reply
                            0
                            • N Offline
                              N Offline
                              NiVa99
                              wrote on last edited by
                              #59

                              Thank you !

                              Following your advise, I comment llvm, clang, perl, g++ so thery are out of PATH env var ( and after some where verifications), then launch configure.bat as described by official doc step-4-build-the-qt-library from src path like that :

                              **********************************************************************
                              ** Visual Studio 2019 Developer Command Prompt v16.11.6
                              ** Copyright (c) 2021 Microsoft Corporation
                              **********************************************************************
                              [vcvarsall.bat] Environment initialized for: 'x64'
                              
                              C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional>d:
                              
                              D:\>cd Logiciels\Qt\6.2.2\qt-everywhere-src-6.2.2
                              
                              D:\Logiciels\Qt\6.2.2\qt-everywhere-src-6.2.2>where where
                              C:\Windows\System32\where.exe
                              
                              D:\Logiciels\Qt\6.2.2\qt-everywhere-src-6.2.2>where clang
                              Information : impossible de trouver des fichiers pour le(s) modèle(s) spécifié(s).
                              
                              D:\Logiciels\Qt\6.2.2\qt-everywhere-src-6.2.2>where perl
                              Information : impossible de trouver des fichiers pour le(s) modèle(s) spécifié(s).
                              
                              D:\Logiciels\Qt\6.2.2\qt-everywhere-src-6.2.2>where ninja
                              C:\ninja-win\ninja.exe
                              C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe
                              
                              D:\Logiciels\Qt\6.2.2\qt-everywhere-src-6.2.2>where g++
                              Information : impossible de trouver des fichiers pour le(s) modèle(s) spécifié(s).
                              
                              D:\Logiciels\Qt\6.2.2\qt-everywhere-src-6.2.2>where gcc
                              Information : impossible de trouver des fichiers pour le(s) modèle(s) spécifié(s).
                              
                              D:\Logiciels\Qt\6.2.2\qt-everywhere-src-6.2.2>where cmake
                              C:\CMake\bin\cmake.exe
                              C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe
                              
                              D:\Logiciels\Qt\6.2.2\qt-everywhere-src-6.2.2>configure.bat
                              + cd qtbase
                              + D:\Logiciels\Qt\6.2.2\qt-everywhere-src-6.2.2\qtbase\configure.bat -top-level
                              

                              This is the CMakeError.log

                              Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)":
                              Compilateur d'optimisation Microsoft (R) C/C++ version 19.29.30137 pour x64
                              Copyright (C) Microsoft Corporation. Tous droits réservés.
                              
                              cl : Ligne de commande warning D9002 : option '--version' inconnue ignorée
                              cl : Ligne de commande error D8003 : nom de fichier de la source absent
                              Checking whether the ASM compiler is Clang using "--version" did not match "(clang version)":
                              Compilateur d'optimisation Microsoft (R) C/C++ version 19.29.30137 pour x64
                              Copyright (C) Microsoft Corporation. Tous droits réservés.
                              
                              cl : Ligne de commande warning D9002 : option '--version' inconnue ignorée
                              cl : Ligne de commande error D8003 : nom de fichier de la source absent
                              Checking whether the ASM compiler is AppleClang using "--version" did not match "(Apple LLVM version)":
                              Compilateur d'optimisation Microsoft (R) C/C++ version 19.29.30137 pour x64
                              Copyright (C) Microsoft Corporation. Tous droits réservés.
                              
                              cl : Ligne de commande warning D9002 : option '--version' inconnue ignorée
                              cl : Ligne de commande error D8003 : nom de fichier de la source absent
                              Checking whether the ASM compiler is ARMClang using "--version" did not match "armclang":
                              Compilateur d'optimisation Microsoft (R) C/C++ version 19.29.30137 pour x64
                              Copyright (C) Microsoft Corporation. Tous droits réservés.
                              
                              cl : Ligne de commande warning D9002 : option '--version' inconnue ignorée
                              cl : Ligne de commande error D8003 : nom de fichier de la source absent
                              Checking whether the ASM compiler is HP using "-V" did not match "HP C":
                              Compilateur d'optimisation Microsoft (R) C/C++ version 19.29.30137 pour x64
                              Copyright (C) Microsoft Corporation. Tous droits réservés.
                              
                              cl : Ligne de commande error D8004 : '/V' nécessite un argument
                              Checking whether the ASM compiler is Intel using "--version" did not match "(ICC)":
                              Compilateur d'optimisation Microsoft (R) C/C++ version 19.29.30137 pour x64
                              Copyright (C) Microsoft Corporation. Tous droits réservés.
                              
                              cl : Ligne de commande warning D9002 : option '--version' inconnue ignorée
                              cl : Ligne de commande error D8003 : nom de fichier de la source absent
                              Checking whether the ASM compiler is IntelLLVM using "--version" did not match "(Intel[^
                              ]+oneAPI)":
                              Compilateur d'optimisation Microsoft (R) C/C++ version 19.29.30137 pour x64
                              Copyright (C) Microsoft Corporation. Tous droits réservés.
                              
                              cl : Ligne de commande warning D9002 : option '--version' inconnue ignorée
                              cl : Ligne de commande error D8003 : nom de fichier de la source absent
                              Checking whether the ASM compiler is SunPro using "-V" did not match "Sun C":
                              Compilateur d'optimisation Microsoft (R) C/C++ version 19.29.30137 pour x64
                              Copyright (C) Microsoft Corporation. Tous droits réservés.
                              
                              cl : Ligne de commande error D8004 : '/V' nécessite un argument
                              Checking whether the ASM compiler is XL using "-qversion" did not match "XL C":
                              Compilateur d'optimisation Microsoft (R) C/C++ version 19.29.30137 pour x64
                              Copyright (C) Microsoft Corporation. Tous droits réservés.
                              
                              cl : Ligne de commande warning D9002 : option '-qversion' inconnue ignorée
                              cl : Ligne de commande error D8003 : nom de fichier de la source absent
                              
                              

                              Amazing.

                              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