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
QtWS25 Last Chance

Error on Qt 6 Building from source for Windows Based

Scheduled Pinned Locked Moved Solved Qt 6
59 Posts 9 Posters 18.8k 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.
  • N Offline
    N Offline
    NiVa99
    wrote on 21 Jan 2022, 21:32 last edited by
    #38

    Hi,

    Trying do_it.bat with VS2019 and Qt source 6.2.2 for x64 binaries (or following Qt Buidling from source) directives,
    I got these errors:

    Can you help me ?

    Thank you
    NiVa

    Either set CMAKE_PREFIX_PATH or LLVM_INSTALL_DIR to the location of your llvm installation.
    On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution.
    On macOS, you can use Homebrew's llvm package.
    You will also need to set the FEATURE_clang CMake variable to ON to re-evaluate this check.
    WARNING: Clang-based lupdate parser will not be available. LLVM and Clang C++ libraries have not been found.
    You will need to set the FEATURE_clangcpp CMake variable to ON to re-evaluate this check.
    WARNING: QtWebEngine won't be built. Tool gperf is required.
    WARNING: QtPdf won't be built. Tool gperf is required.
    
    Qt is now configured for building. Just run 'cmake --build . --parallel'
    
    Once everything is built, you must run 'ninja install'
    Qt will be installed into 'C:/Qt/6.2.2/msvc2019_64'
    
    To configure and build other Qt modules, you can use the following convenience script:
            C:/Qt/6.2.2/msvc2019_64/bin/qt-configure-module.bat
    
    If reconfiguration fails for some reason, try to remove 'CMakeCache.txt' from the build directory
    
    -- Configuring incomplete, errors occurred!
    See also "C:/Qt/6.2.2/Build/CMakeFiles/CMakeOutput.log".
    See also "C:/Qt/6.2.2/Build/CMakeFiles/CMakeError.log".
    CMake Error at C:/Qt/6.2.2/src/qtbase/cmake/QtProcessConfigureArgs.cmake:947 (message):
      CMake exited with code 1.
    
    
    ninja: error: loading 'build.ninja': Le fichier spÚcifiÚ est introuvable.
    
    CMake Error: Error processing file: C:/Qt/6.2.2/Build/cmake_install.cmake
    

    Notice that directory C:/Qt/6.2.2/Build disappear at this moment building.
    Here is and extract of CMakeError :

    Performing C++ SOURCE FILE Test HAVE_ICONV failed with the following output:
    Change Dir: C:/Qt/6.2.2/Build/CMakeFiles/CMakeTmp
    
    Run Build Command(s):C:/ninja-win/ninja.exe -f build-Release.ninja cmTC_50daa && [1/2] Building CXX object CMakeFiles/cmTC_50daa.dir/Release/src.cxx.obj
    
    [2/2] Linking CXX executable Release\cmTC_50daa.exe
    
    FAILED: Release/cmTC_50daa.exe 
    
    cmd.exe /C "cd . && C:\Strawberry\c\bin\c++.exe -DNDEBUG -O2  CMakeFiles/cmTC_50daa.dir/Release/src.cxx.obj -o Release\cmTC_50daa.exe -Wl,--out-implib,Release\libcmTC_50daa.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
    
    C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/lib/../lib/libiconv.a(localcharset.o):localcharset.c:(.text+0x63): undefined reference to `__imp_GetACP'
    
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    
    
    
    Source file was:
    #include <iconv.h>
    
    int main(int, char **)
    {
        iconv_t x = iconv_open("", "");
        iconv_close(x);
        return 0;
    }
    Performing C++ SOURCE FILE Test HAVE_ICONV_WITH_LIB failed with the following output:
    Change Dir: C:/Qt/6.2.2/Build/CMakeFiles/CMakeTmp
    
    Run Build Command(s):C:/ninja-win/ninja.exe -f build-Release.ninja cmTC_67c23 && [1/2] Building CXX object CMakeFiles/cmTC_67c23.dir/Release/src.cxx.obj
    
    [2/2] Linking CXX executable Release\cmTC_67c23.exe
    
    FAILED: Release/cmTC_67c23.exe 
    
    cmd.exe /C "cd . && C:\Strawberry\c\bin\c++.exe -DNDEBUG -O2  CMakeFiles/cmTC_67c23.dir/Release/src.cxx.obj -o Release\cmTC_67c23.exe -Wl,--out-implib,Release\libcmTC_67c23.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
    
    C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/lib/../lib/libiconv.a(localcharset.o):localcharset.c:(.text+0x63): undefined reference to `__imp_GetACP'
    
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    
    
    
    Source file was:
    #include <iconv.h>
    
    int main(int, char **)
    {
        iconv_t x = iconv_open("", "");
        iconv_close(x);
        return 0;
    }
    Performing C++ SOURCE FILE Test HAVE_uacpp failed with the following output:
    Change Dir: C:/Qt/6.2.2/Build/CMakeFiles/CMakeTmp
    
    Run Build Command(s):C:/ninja-win/ninja.exe -f build-Release.ninja cmTC_ab42c && [1/2] Building CXX object CMakeFiles/cmTC_ab42c.dir/Release/src.cxx.obj
    
    FAILED: CMakeFiles/cmTC_ab42c.dir/Release/src.cxx.obj 
    
    C:\Strawberry\c\bin\c++.exe -DHAVE_uacpp -DCMAKE_INTDIR=\"Release\"  -DNDEBUG -O2 -std=gnu++17 -o CMakeFiles/cmTC_ab42c.dir/Release/src.cxx.obj -c C:/Qt/6.2.2/Build/CMakeFiles/CMakeTmp/src.cxx
    
    C:/Qt/6.2.2/Build/CMakeFiles/CMakeTmp/src.cxx:3:10: fatal error: uaplatformlayer.h: No such file or directory
     #include <uaplatformlayer.h>
              ^~~~~~~~~~~~~~~~~~~
    compilation terminated.
    
    ninja: build stopped: subcommand failed.
    
    
    
    Source file was:
     #include <stdio.h>
    
    #include <uaplatformlayer.h>
    #include <uastring.h>
    #include <uasession.h>
    
    using namespace UaClientSdk;
    
    int main(int /*argc*/, char ** /*argv*/)
    {
    
        UaPlatformLayer::init();
        UaSession *session = new UaSession;
    
        UaPlatformLayer::cleanup();
        return 0;
    }
    
    
    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on 22 Jan 2022, 14:44 last edited by Chris Kawa
      #39

      @NiVa99 The bat is explicitly for msvc. Your errors seem to come from using clang without environment set up for it. The path has msvc2019_64 in it and your build errors are from gcc/mingw.

      You seem to have completely mixed up environment for those three different compilers. Which one do you actually want to use - msvc, clang or gcc/mingw ?

      Notice that directory C:/Qt/6.2.2/Build disappear at this moment building.

      Well yeah, because it's a temporary build directory and the bat removes it after the install: rmdir %BUILD_DIR% /Q /S. If you want it to stay just modify the bat and remove or comment out that line.

      1 Reply Last reply
      2
      • N Offline
        N Offline
        NiVa99
        wrote on 22 Jan 2022, 22:41 last edited by
        #40

        I have succeeded to build Qt6.2.2 for arch amd64 and x64 with this following bat.
        But interested in to build with mingw too

        :: x64 amd64 x86
        SET ARCH=x86
        
        
        :: SET VS_ENVIRONMENT="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
        SET VS_ENVIRONMENT="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat %ARCH%"
        CALL %VS_ENVIRONMENT%
        
        SET SRC_DIR="d:\Logiciels\Qt\6.2.2\Src"
        SET BUILD_DIR="d:\Logiciels\Qt\6.2.2\Build"
        SET INSTALL_DIR="C:\release-vs2019-%ARCH%"
        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 .
        cd %INSTALL_DIR%
        rmdir %BUILD_DIR% /Q /S
        pause
        
        1 Reply Last reply
        0
        • C Offline
          C Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on 23 Jan 2022, 01:30 last edited by
          #41

          For mingw don't call the msvc bat to setup environment. I don't know if mingw has a handy bat to set it up for you, but if not then just do it manually by adding the relevant paths to bin, include and lib directories. Something like this

          SET PATH=%PATH%;C:\mingw\bin
          SET CPLUS_INCLUDE_PATH=C:\mingw\include
          SET LIBRARY_PATH=C:\mingw\lib
          

          substituting the paths to your actual mingw installation directories.

          1 Reply Last reply
          0
          • N Offline
            N Offline
            NiVa99
            wrote on 23 Jan 2022, 08:54 last edited by
            #42

            Thank you, I have removed rmdir line and I will try mingw build.

            Just staying on msvc build, I have just one architecture x86 that does not build either than amd64 dll seeing it with Dependencies.

            d:\Logiciels\Qt\6.2.2>SET VS_ENVIRONMENT="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat x86"
            
            d:\Logiciels\Qt\6.2.2>"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat x86"
            '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat x86"' n’est pas reconnu en tant que commande interne
            ou externe, un programme exécutable ou un fichier de commandes.
            
            d:\Logiciels\Qt\6.2.2>SET SRC_DIR="d:\Logiciels\Qt\6.2.2\Src"
            
            d:\Logiciels\Qt\6.2.2>SET BUILD_DIR="d:\Logiciels\Qt\6.2.2\Build"
            
            d:\Logiciels\Qt\6.2.2>SET INSTALL_DIR="C:\release-vs2019-x86"
            
            d:\Logiciels\Qt\6.2.2>SET CONFIGURE_OPTIONS=-debug-and-release -mp -opensource -confirm-license
            
            d:\Logiciels\Qt\6.2.2>call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat x86"
            '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat x86"' n’est pas reconnu en tant que commande interne
            ou externe, un programme exécutable ou un fichier de commandes.
            
            d:\Logiciels\Qt\6.2.2>mkdir "d:\Logiciels\Qt\6.2.2\Build"
            Un sous-répertoire ou un fichier d:\Logiciels\Qt\6.2.2\Build existe déjà.
            
            d:\Logiciels\Qt\6.2.2>mkdir "C:\release-vs2019-x86"
            Un sous-répertoire ou un fichier C:\release-vs2019-x86 existe déjà.
            
            d:\Logiciels\Qt\6.2.2>cd "d:\Logiciels\Qt\6.2.2\Build"
            
            d:\Logiciels\Qt\6.2.2\Build>call "d:\Logiciels\Qt\6.2.2\Src"\configure -prefix "C:\release-vs2019-x86" -debug-and-release -mp -opensource -confirm-license
            + cd qtbase
            + d:\Logiciels\Qt\6.2.2\src\qtbase\configure.bat -top-level -prefix "C:\release-vs2019-x86" -debug-and-release -mp -opensource -confirm-license
            
            
            C 1 Reply Last reply 23 Jan 2022, 12:51
            0
            • N NiVa99
              23 Jan 2022, 08:54

              Thank you, I have removed rmdir line and I will try mingw build.

              Just staying on msvc build, I have just one architecture x86 that does not build either than amd64 dll seeing it with Dependencies.

              d:\Logiciels\Qt\6.2.2>SET VS_ENVIRONMENT="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat x86"
              
              d:\Logiciels\Qt\6.2.2>"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat x86"
              '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat x86"' n’est pas reconnu en tant que commande interne
              ou externe, un programme exécutable ou un fichier de commandes.
              
              d:\Logiciels\Qt\6.2.2>SET SRC_DIR="d:\Logiciels\Qt\6.2.2\Src"
              
              d:\Logiciels\Qt\6.2.2>SET BUILD_DIR="d:\Logiciels\Qt\6.2.2\Build"
              
              d:\Logiciels\Qt\6.2.2>SET INSTALL_DIR="C:\release-vs2019-x86"
              
              d:\Logiciels\Qt\6.2.2>SET CONFIGURE_OPTIONS=-debug-and-release -mp -opensource -confirm-license
              
              d:\Logiciels\Qt\6.2.2>call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat x86"
              '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat x86"' n’est pas reconnu en tant que commande interne
              ou externe, un programme exécutable ou un fichier de commandes.
              
              d:\Logiciels\Qt\6.2.2>mkdir "d:\Logiciels\Qt\6.2.2\Build"
              Un sous-répertoire ou un fichier d:\Logiciels\Qt\6.2.2\Build existe déjà.
              
              d:\Logiciels\Qt\6.2.2>mkdir "C:\release-vs2019-x86"
              Un sous-répertoire ou un fichier C:\release-vs2019-x86 existe déjà.
              
              d:\Logiciels\Qt\6.2.2>cd "d:\Logiciels\Qt\6.2.2\Build"
              
              d:\Logiciels\Qt\6.2.2\Build>call "d:\Logiciels\Qt\6.2.2\Src"\configure -prefix "C:\release-vs2019-x86" -debug-and-release -mp -opensource -confirm-license
              + cd qtbase
              + d:\Logiciels\Qt\6.2.2\src\qtbase\configure.bat -top-level -prefix "C:\release-vs2019-x86" -debug-and-release -mp -opensource -confirm-license
              
              
              C Offline
              C Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on 23 Jan 2022, 12:51 last edited by Chris Kawa
              #43

              '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat x86"' n’est pas reconnu en tant que commande interne
              ou externe, un programme exécutable ou un fichier de commandes.

              Don't put x86 in the quotes because it treats vcvarsall.bat x86 as a file name with space. Put the parameter outside of the quotes. It's the same for all architectures. You can also just use vcvars32.bat without any parameters, which does the same.

              1 Reply Last reply
              0
              • N Offline
                N Offline
                NiVa99
                wrote on 23 Jan 2022, 13:44 last edited by
                #44

                I am trying this version of bat.

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

                which cause errors

                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_4e432 && [1/2] Building CXX object CMakeFiles/cmTC_4e432.dir/Release/src.cxx.obj
                
                **FAILED**: CMakeFiles/cmTC_4e432.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_4e432.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.
                
                
                
                Source file was:
                        #include <windows.h>
                        #if !defined(_WIN32_WINNT) && !defined(WINVER)
                        #error "_WIN32_WINNT and WINVER are not defined"
                        #endif
                        #if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0A00)
                        #error "_WIN32_WINNT version too low"
                        #endif
                        #if defined(WINVER) && (WINVER < 0x0A00)
                        #error "WINVER version too low"
                        #endif
                        int main() { return 0; }
                    
                Performing C++ SOURCE FILE Test TEST_use_lld_linker 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_01c1b && [1/2] Building CXX object CMakeFiles/cmTC_01c1b.dir/Release/src.cxx.obj
                
                **FAILED**: CMakeFiles/cmTC_01c1b.dir/Release/src.cxx.obj 
                
                C:\Strawberry\c\bin\c++.exe -DTEST_use_lld_linker -DCMAKE_INTDIR=\"Release\"  -O3 -DNDEBUG   -fuse-ld=lld -std=gnu++17 -o CMakeFiles/cmTC_01c1b.dir/Release/src.cxx.obj -c D:/Logiciels/Qt/6.2.2/Build/CMakeFiles/CMakeTmp/src.cxx
                
                c++.exe: error: unrecognized command line option '-fuse-ld=lld'; did you mean '-fuse-ld=bfd'?
                ninja: build stopped: subcommand failed.
                
                
                
                Source file was:
                int main() { return 0; }
                Performing C++ SOURCE FILE Test TEST_enable_new_dtags 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_ea62a && [1/2] Building CXX object CMakeFiles/cmTC_ea62a.dir/Release/src.cxx.obj
                
                [2/2] Linking CXX executable Release\cmTC_ea62a.exe
                
                FAILED: Release/cmTC_ea62a.exe 
                
                cmd.exe /C "cd . && C:\Strawberry\c\bin\c++.exe -O3 -DNDEBUG -Wl,--enable-new-dtags CMakeFiles/cmTC_ea62a.dir/Release/src.cxx.obj -o Release\cmTC_ea62a.exe -Wl,--out-implib,Release\libcmTC_ea62a.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
                
                C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: unrecognized option '--enable-new-dtags'
                
                C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: use the --help option for usage information
                
                collect2.exe: error: ld returned 1 exit status
                ninja: build stopped: subcommand failed.
                
                
                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  Chris Kawa
                  Lifetime Qt Champion
                  wrote on 23 Jan 2022, 14:06 last edited by
                  #45

                  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 1 Reply Last reply 24 Jan 2022, 19:59
                  1
                  • N Offline
                    N Offline
                    NiVa99
                    wrote on 23 Jan 2022, 16:21 last edited by
                    #46
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • N Offline
                      N Offline
                      NiVa99
                      wrote on 23 Jan 2022, 17:10 last edited by
                      #47
                      This post is deleted!
                      1 Reply Last reply
                      0
                      • N Offline
                        N Offline
                        NiVa99
                        wrote on 23 Jan 2022, 18:14 last edited by
                        #48
                        This post is deleted!
                        1 Reply Last reply
                        0
                        • C Online
                          C Online
                          Christian Ehrlicher
                          Lifetime Qt Champion
                          wrote on 23 Jan 2022, 18:19 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 23 Jan 2022, 19:22 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
                            • C Online
                              C Online
                              Christian Ehrlicher
                              Lifetime Qt Champion
                              wrote on 23 Jan 2022, 19:26 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 23 Jan 2022, 19:40 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
                                • C Chris Kawa
                                  23 Jan 2022, 14:06

                                  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 24 Jan 2022, 19:59 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 24 Jan 2022, 20:14 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
                                    • C Offline
                                      C Offline
                                      Chris Kawa
                                      Lifetime Qt Champion
                                      wrote on 24 Jan 2022, 20:51 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 25 Jan 2022, 06:53 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
                                        • K Offline
                                          K Offline
                                          kkoehne
                                          Moderators
                                          wrote on 25 Jan 2022, 07:29 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

                                          47/59

                                          23 Jan 2022, 17:10

                                          • Login

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