Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Error on Qt 6 Building from source for Windows Based



  • i followed this link' instructions to build Qt 6.0.0 from qt-everywhere-src.zip, but i get these errors:
    https://doc.qt.io/qt-6/windows-building.html

    I am using MSVC 2019.

    error:

    C:\Qt\Qt-6>configure.bat -prefix c:\Qt\Qt6

    • cd qtbase

    • C:\Qt\Qt-6\qtbase\configure.bat -top-level -prefix c:\Qt\Qt6
      'C:/Program Files/CMake/bin/cmake.exe' '-DCMAKE_INSTALL_PREFIX=c://Qt//Qt6' '-G' 'Ninja' 'C:/Qt/Qt-6'
      -- The C compiler identification is MSVC 19.28.29336.0
      -- The ASM compiler identification is MSVC
      -- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - failed
      -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe
      -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - broken
      CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message):
      The C compiler

      "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe"

      is not able to compile a simple test program.

      It fails with the following output:

      Change Dir: C:/Qt/Qt-6/CMakeFiles/CMakeTmp

      Run Build Command(s):C:/ninja-win/ninja.exe cmTC_00c4b && [1/2] Building C object CMakeFiles\cmTC_00c4b.dir\testCCompiler.c.obj
      [2/2] Linking C executable cmTC_00c4b.exe
      FAILED: cmTC_00c4b.exe
      cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_00c4b.dir --rc=rc --mt="" --manifests -- "C:\PROGRA~2\Microsoft Visual Studio\2019\COMMUN~1\VC\Tools\MSVC\1428~1.293\bin\Hostx64\x64\link.exe" /nologo CMakeFiles\cmTC_00c4b.dir\testCCompiler.c.obj /out:cmTC_00c4b.exe /implib:cmTC_00c4b.lib /pdb:cmTC_00c4b.pdb /version:0.0 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
      RC Pass 1: command "rc /fo CMakeFiles\cmTC_00c4b.dir/manifest.res CMakeFiles\cmTC_00c4b.dir/manifest.rc" failed (exit code 0) with the following output:
      Le fichier sp├®cifi├® est introuvable
      ninja: build -- Configuring incomplete, errors occurred!
      stopped: subcommand failed.

      CMake will not be able to correctly generate this project.
      Call Stack (most recent call first):
      CMakeLists.txt:11 (project)

    See also "C:/Qt/Qt-6/CMakeFiles/CMakeOutput.log".
    See also "C:/Qt/Qt-6/CMakeFiles/CMakeError.log".
    CMake Error at qtbase/cmake/QtProcessConfigureArgs.cmake:788 (message):
    CMake exited with code 1.

    C:\Qt\Qt-6>


  • Lifetime Qt Champion

    @Lemat Are you doing this from the Visual Studio command prompt? https://doc.qt.io/qt-6/windows-building.html shows how that can be done.



  • i got it, but errors again:

    c:\Qt\Qt-6>configure.bat -prefix c:\Qt\Qt6

    • cd qtbase
    • c:\Qt\Qt-6\qtbase\configure.bat -top-level -prefix c:\Qt\Qt6
      'C:/Program Files/CMake/bin/cmake.exe' '-DCMAKE_INSTALL_PREFIX=c://Qt//Qt6' '-G' 'Ninja' 'C:/Qt/Qt-6'
      Check dependencies of 'qtbase'
      Check dependencies of 'qt5compat'
      Check dependencies of 'qtsvg'
      Check dependencies of 'qtdeclarative'
      Check dependencies of 'qttools'
      Check dependencies of 'qtquickcontrols2'
      Check dependencies of 'qtdoc'
      Check dependencies of 'qtshadertools'
      Check dependencies of 'qtquick3d'
      Check dependencies of 'qtquicktimeline'
      Check dependencies of 'qttranslations'
      Check dependencies of 'qtwayland'
      Configuring 'qtbase'
      CMake Error at qtbase/cmake/QtBaseConfigureTests.cmake:40 (message):
      Failed to find compiled architecture detection executable at
      C:/Qt/Qt-6/qtbase/config.tests/arch/architecture_test.exe.
      Call Stack (most recent call first):
      qtbase/cmake/QtBaseConfigureTests.cmake:119 (qt_run_config_test_architecture)
      qtbase/cmake/QtBaseConfigureTests.cmake:132 (qt_run_qtbase_config_tests)
      qtbase/CMakeLists.txt:66 (include)

    -- Configuring incomplete, errors occurred!

    See also "C:/Qt/Qt-6/CMakeFiles/CMakeOutput.log".
    See also "C:/Qt/Qt-6/CMakeFiles/CMakeError.log".
    CMake Error at qtbase/cmake/QtProcessConfigureArgs.cmake:788 (message):
    CMake exited with code 1.

    c:\Qt\Qt-6>


  • Lifetime Qt Champion

    @Lemat You should clean the source tree (c:\Qt\Qt-6\qtbase) before executing configure again. Better to do out-of-source build:

    mkdir build
    cd build
    c:\Qt\Qt-6\qtbase\configure.bat -top-level -prefix c:\Qt\Qt6
    


  • Let me try again



  • Error again.

    c:\Qt\build>c:\Qt\Qt-6\qtbase\configure.bat -top-level -prefix c:\Qt\Qt6
    'C:/Program Files/CMake/bin/cmake.exe' '-DCMAKE_INSTALL_PREFIX=c://Qt//Qt6' '-G' 'Ninja' 'C:/Qt/Qt-6'
    Check dependencies of 'qtbase'
    Check dependencies of 'qt5compat'
    Check dependencies of 'qtsvg'
    Check dependencies of 'qtdeclarative'
    Check dependencies of 'qttools'
    Check dependencies of 'qtquickcontrols2'
    Check dependencies of 'qtdoc'
    Check dependencies of 'qtshadertools'
    Check dependencies of 'qtquick3d'
    Check dependencies of 'qtquicktimeline'
    Check dependencies of 'qttranslations'
    Check dependencies of 'qtwayland'
    Configuring 'qtbase'
    CMake Error at qtbase/cmake/QtBaseConfigureTests.cmake:40 (message):
    Failed to find compiled architecture detection executable at
    C:/Qt/qtbase/config.tests/arch/architecture_test.exe.
    Call Stack (most recent call first):
    qtbase/cmake/QtBaseConfigureTests.cmake:119 (qt_run_config_test_architecture)
    qtbase/cmake/QtBaseConfigureTests.cmake:132 (qt_run_qtbase_config_tests)
    qtbase/CMakeLists.txt:66 (include)

    -- Configuring incomplete, errors occurred!
    See also "C:/Qt/CMakeFiles/CMakeOutput.log".
    See also "C:/Qt/CMakeFiles/CMakeError.log".
    CMake Error at Qt-6/qtbase/cmake/QtProcessConfigureArgs.cmake:788 (message):
    CMake exited with code 1.

    c:\Qt\build>


  • Lifetime Qt Champion

    @Lemat You should check C:/Qt/CMakeFiles/CMakeError.log to see what exactly went wrong.



  • Let me show you CMakeError.log:

    Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" did not produce an executable in "C:/Qt/CMakeFiles/3.18.4/CompilerIdCXX".

    Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" did not produce an executable in "C:/Qt/CMakeFiles/3.18.4/CompilerIdCXX".

    Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" did not produce an executable in "C:/Qt/CMakeFiles/3.18.4/CompilerIdCXX".

    Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" did not produce an executable in "C:/Qt/CMakeFiles/3.18.4/CompilerIdCXX".

    Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" did not produce an executable in "C:/Qt/CMakeFiles/3.18.4/CompilerIdCXX".

    Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" did not produce an executable in "C:/Qt/CMakeFiles/3.18.4/CompilerIdCXX".

    Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" did not produce an executable in "C:/Qt/CMakeFiles/3.18.4/CompilerIdCXX".

    Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" did not produce an executable in "C:/Qt/CMakeFiles/3.18.4/CompilerIdCXX".

    Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" did not produce an executable in "C:/Qt/CMakeFiles/3.18.4/CompilerIdCXX".

    Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" did not produce an executable in "C:/Qt/CMakeFiles/3.18.4/CompilerIdCXX".

    Checking whether the CXX compiler is IAR using "" did not match "IAR .+ Compiler":


    ** Visual Studio 2019 Developer Command Prompt v16.8.4
    ** Copyright (c) 2020 Microsoft Corporation


    [vcvarsall.bat] Environment initialized for: 'x64'
    Checking whether the CXX compiler is IAR using "" did not match "IAR .+ Compiler":


    ** Visual Studio 2019 Developer Command Prompt v16.8.4
    ** Copyright (c) 2020 Microsoft Corporation


    [vcvarsall.bat] Environment initialized for: 'x64'
    Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)":
    Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    cl : Command line warning D9002 : ignoring unknown option '--version'
    cl : Command line error D8003 : missing source filename
    Checking whether the ASM compiler is Clang using "--version" did not match "(clang version)":
    Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    cl : Command line warning D9002 : ignoring unknown option '--version'
    cl : Command line error D8003 : missing source filename
    Checking whether the ASM compiler is AppleClang using "--version" did not match "(Apple LLVM version)":
    Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    cl : Command line warning D9002 : ignoring unknown option '--version'
    cl : Command line error D8003 : missing source filename
    Checking whether the ASM compiler is ARMClang using "--version" did not match "armclang":
    Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    cl : Command line warning D9002 : ignoring unknown option '--version'
    cl : Command line error D8003 : missing source filename
    Checking whether the ASM compiler is HP using "-V" did not match "HP C":
    Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    cl : Command line error D8004 : '/V' requires an argument
    Checking whether the ASM compiler is Intel using "--version" did not match "(ICC)":
    Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    cl : Command line warning D9002 : ignoring unknown option '--version'
    cl : Command line error D8003 : missing source filename
    Checking whether the ASM compiler is SunPro using "-V" did not match "Sun C":
    Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    cl : Command line error D8004 : '/V' requires an argument
    Checking whether the ASM compiler is XL using "-qversion" did not match "XL C":
    Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    cl : Command line warning D9002 : ignoring unknown option '-qversion'
    cl : Command line error D8003 : missing source filename
    Detecting CXX compiler ABI info failed to compile with the following output:
    Change Dir: C:/Qt/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/ninja-win/ninja.exe cmTC_ea43b && [1/2] Building CXX object CMakeFiles\cmTC_ea43b.dir\CMakeCXXCompilerABI.cpp.obj

    FAILED: CMakeFiles/cmTC_ea43b.dir/CMakeCXXCompilerABI.cpp.obj

    "C:\PROGRA~2\Microsoft Visual Studio\2019\COMMUN~1\VC\AUXILI~1\Build\vcvars64.bat" -o CMakeFiles\cmTC_ea43b.dir\CMakeCXXCompilerABI.cpp.obj -c "C:\Program Files\CMake\share\cmake-3.18\Modules\CMakeCXXCompilerABI.cpp"

    [ERROR:vcvarsall.bat] Invalid argument found : -o

    [ERROR:vcvarsall.bat] Invalid argument found : CMakeFiles\cmTC_ea43b.dir\CMakeCXXCompilerABI.cpp.obj

    [ERROR:vcvarsall.bat] Invalid argument found : -c

    La syntaxe de la commande n'est pas correcte.

    ninja: build stopped: subcommand failed.



  • My qt6vars.cmd:

    REM Set up Microsoft Visual Studio 2019, where <arch> is amd64, x86, etc.
    CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
    SET _ROOT=C:\Qt\Qt-6
    SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
    REM Uncomment the below line when using a git checkout of the source repository
    REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
    SET _ROOT=


  • Lifetime Qt Champion

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

    "C:\PROGRA~2\Microsoft Visual Studio\2019\COMMUN~1\VC\AUXILI~1\Build\vcvars64.bat" -o CMakeFiles\cmTC_ea43b.dir\CMakeCXXCompilerABI.cpp.obj -c "C:\Program Files\CMake\share\cmake-3.18\Modules\CMakeCXXCompilerABI.cpp"

    This looks strange. This should be the call to the compiler, but instead vcvars64.bat is called. Can you show your script you created as described in the link (qt6vars.cmd)?



  • @jsulm

    My qt6vars.cmd:

    REM Set up Microsoft Visual Studio 2019, where <arch> is amd64, x86, etc.
    CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
    SET _ROOT=C:\Qt\Qt-6
    SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
    REM Uncomment the below line when using a git checkout of the source repository
    REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
    SET _ROOT=



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

    C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe

    I'm not very familiar with Windows build environment, but is that OK?
    I mean, it looks like the 64 bit version of cl.exe is being used, but it's strange that the Visual Studio installation went to the x86 folder, as a 32 bit application?

    Could you please describe your environment? i.e. Windows OS version and platform, same for Visual Studio.



  • @jsulm
    owww !!, that is the CXX variable i set in system environment. i should change it to vcvarsall.bat



  • @Lemat
    right ? you agree ?



  • @Pablo-J-Rogina

    Windows 10 Professional 20H2 19042.685 X64

    Microsoft Visual Studio Community 2019
    Version 16.8.4

    i use this same MSVC version to build my Qt x64 apps.



  • @jsulm

    or what is the right compiler path ? this one ?: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64


  • Lifetime Qt Champion

    @Lemat I think that path is correct. Visual Studio itself is a x86 application, but it has compiler which generates x86_64 binaries.



  • @jsulm all right



  • should i set a real compiler path in the system environment variable CXX ?? i don't know the real compiler file name. my actual Qt 5.15.2 has detected it automatically. i am looking in her settings to find the compiler file name, but nothing.


  • Lifetime Qt Champion

    @Lemat I don't think so. It should work as described on that web page. I don't know why it doesn't work for you.



  • i really need help for that. i tried anything, but nothing. Maybe cmake version ?



  • Tools used:
    Cmake version: 3.18.4 x64
    Python: 3.7.3 x64
    ActivePerl: 5.28 x64
    Ninja: 1.10.2


  • Lifetime Qt Champion

    Hi,

    IIRC, cmake 3.19.2 or newer is recommended but I don't have the source at hand.



  • @SGaist

    Can you explain more ?


  • Lifetime Qt Champion

    You should update your cmake version.



  • @SGaist

    Okay. let me try. i am downloading cmake 3.19.3



  • i tried with cmake 3.19.3, problem still exist


  • Lifetime Qt Champion

    Did you restart from a clean state ?



  • @SGaist yes. i did it. but the problem still exist


  • Lifetime Qt Champion

    What did you do to ensure a clean state ?



  • I Installed Qt 6.0.1 with the online Installer. Too bad for me. Many features such as QWebEngine are removed



  • @Lemat That and other modules will be added in the new versions during the year, read https://www.qt.io/blog/add-on-support-in-qt-6.0-and-beyond. So you have 2 options: 1) wait or 2) manually compile the modules



  • @eyllanesc ,that is okay !. i just leaned on doc.qt.io. Waiting is the best option for me after failing on this subject title. laugh.


  • Lifetime Qt Champion

    Use 5.15 and you're fine. Don't know why everyone needs to use Qt6 when it's documented that it's not feature complete... Qt6 does not have any advantage for an average user at the current state.


  • Moderators

    This is the do_it.bat I'm using to build Qt6. Adjust the paths and configure options at the top to whatever you like. You only need to have CMake in PATH, nothing else, or you can just spell out its path right in the bat script.

    SET VS_ENVIRONMENT="C:\Program Files (x86)\Microsoft Visual Studio 2019\VC\Auxiliary\Build\vcvars64.bat"
    SET SRC_DIR="C:\Qt\6.0.1\Src"
    SET BUILD_DIR="C:\Qt\6.0.1\Build"
    SET INSTALL_DIR="C:\Qt\6.0.1\msvc2019_64"
    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 Debug
    cd %INSTALL_DIR%
    rmdir %BUILD_DIR% /Q /S
    pause
    

    This builds Qt out of source (the only sane way to do it cleanly), copies result to the install directory and removes the temporary build directory (which can get huuuge if you're building everything).

    Some notes on the discussion points above:

    • Depending on your version of VS (Pro, Cmmunity etc.) the VS install dir will look a bit different. If in doubt just find "x64 Native Tools Command Prompt for VS 2019" shortcut in your start menu and see where it points to
    • There are couple of different .bats to set VS environment. For x64 build use either vcvarsall.bat amd64 or a shortcut vcvars64.bat
    • Keep source and build directories next to each other e.g. <some path>\src and <some path>\build. Theoretically it should be possible to build out of source to anywhere, but I've had multiple problems with mismatched number of .. and the likes in the past so keep it this way just to make it easier for yourself.
    • It's a good idea to exclude whichever modules you don't need in configure options e.g. -skip qtdatavis3d. I usually use only about 3-5 modules and exclude everything else, which cuts down compilation time and output size immensely.


  • @Christian-Ehrlicher you are right !



  • @Chris-Kawa thanks. interesting to try !.



  • 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;
    }
    
    

  • Moderators

    @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.



  • 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
    

Log in to reply