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

Heap Corruption Detected While Building Qt 6 with Visual Studio 2019



  • I am attempting to build Qt 6 with Visual Studio 2019 on Windows 10. I am encountering a heap corruption error during the build process. I tried both the 6.0.0 and 6.0 branches from code.qt.io with the same result. I am using the following command to build from a Developer Powershell for VS2019:

    PS Z:\io.qt.code\qt\qt6-build> ..\qt5\configure.bat -no-feature-graphicseffect -prefix Z:\qt; if ($?) { cmake --build . --parallel 4 }; if ($?) { cmake --install . }
    

    Qt6_Build_Error.png



  • i got error " memory not enough" , then i delete parallel 4,


  • Moderators

    Can you test other binaries that are available at this point? Do they crash, too? Does the toolchain work in general (can you compile a minimal main.cpp program and execute it)?



  • @kkoehne Thank you kindly for the reply. The binaries work to some degree:

    PS Z:\io.qt.code\qt\qt6-build> .\qtbase\bin\moc -v
    moc 6.0.0
    PS Z:\io.qt.code\qt\qt6-build> .\qtbase\bin\tracegen
    Usage: tracegen <lttng|etw> <input file> <output file>
    PS Z:\io.qt.code\qt\qt6-build> .\qtbase\bin\qmake -v
    QMake version 3.1
    Using Qt version 6.0.0 in Z:/io.qt.code/qt/qt6-build/qtbase/lib
    PS Z:\io.qt.code\qt\qt6-build>

    The toolchain works. I have used it for other builds, but for completeness, I performed the test you suggested:

    PS Z:> type main.cpp; cl main.cpp; if ($?) { .\main }
    #include <iostream>

    int main(int, char **)
    {
    std::cout << "Yeppers." << std::endl;
    return 0;
    }
    Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x86
    Copyright (C) Microsoft Corporation. All rights reserved.

    main.cpp
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\ostream(746): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    main.cpp(5): note: see reference to function template instantiation 'std::basic_ostream<char,std::char_traits<char>> &std::operator <<<std::char_traits<char>>(std::basic_ostream<char,std::char_traits<char>> &,const char *)' being compiled
    Microsoft (R) Incremental Linker Version 14.28.29336.0
    Copyright (C) Microsoft Corporation. All rights reserved.

    /out:main.exe
    main.obj
    Yeppers.
    PS Z:>


  • Lifetime Qt Champion

    What exact Visual Studio 2019 version do you use? Please update to at least 16.7



  • @Christian-Ehrlicher I believe this version of Visual Studio meets that spec:

    Microsoft Visual Studio Professional 2019
    Version 16.8.4
    VisualStudio.16.Release/16.8.4+30907.101
    Microsoft .NET Framework
    Version 4.8.04084

    Installed Version: Professional

    Visual C++ 2019 00435-60000-00000-AA557
    Microsoft Visual C++ 2019

    ASP.NET and Web Tools 2019 16.8.557.25636
    ASP.NET and Web Tools 2019

    Azure App Service Tools v3.0.0 16.8.557.25636
    Azure App Service Tools v3.0.0

    C# Tools 3.8.0-5.20604.10+9ed4b774d20940880de8df1ca8b07508aa01c8cd
    C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

    Common Azure Tools 1.10
    Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

    Cookiecutter 16.8.20241.2
    Provides tools for finding, instantiating and customizing templates in cookiecutter format.

    IntelliCode Extension 1.0
    IntelliCode Visual Studio Extension Detailed Info

    Markdown Editor 1.12.253
    A full featured Markdown editor with live preview and syntax highlighting. Supports GitHub flavored Markdown.

    Microsoft Azure Tools 2.9
    Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30924.1

    Microsoft JVM Debugger 1.0
    Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

    Microsoft MI-Based Debugger 1.0
    Provides support for connecting Visual Studio to MI compatible debuggers

    Microsoft Visual C++ Wizards 1.0
    Microsoft Visual C++ Wizards

    Microsoft Visual Studio VC Package 1.0
    Microsoft Visual Studio VC Package

    NuGet Package Manager 5.8.1
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

    ProjectServicesPackage Extension 1.0
    ProjectServicesPackage Visual Studio Extension Detailed Info

    Python 16.8.20241.2
    Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

    Python - Conda support 16.8.20241.2
    Conda support for Python projects.

    Python - Django support 16.8.20241.2
    Provides templates and integration for the Django web framework.

    Python - IronPython support 16.8.20241.2
    Provides templates and integration for IronPython-based projects.

    Python - Profiling support 16.8.20241.2
    Profiling support for Python projects.

    Test Adapter for Boost.Test 1.0
    Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.

    Test Adapter for Google Test 1.0
    Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.

    TypeScript Tools 16.0.21016.2001
    TypeScript Tools for Microsoft Visual Studio

    Visual Basic Tools 3.8.0-5.20604.10+9ed4b774d20940880de8df1ca8b07508aa01c8cd
    Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

    Visual Studio Code Debug Adapter Host Package 1.0
    Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

    Visual Studio Tools for CMake 1.0
    Visual Studio Tools for CMake


  • Lifetime Qt Champion

    16.8.4 is the most recent one, yes. But since it does not work for a simple testprogram I would suggest to test it on another pc and to make sure you don't have another compiler in your env (so e.g. a wrong iostream header is fetched or similar). Don't see what Qt can do against this though.


  • Moderators

    Are you usign 32 bit ? Then this might be https://bugreports.qt.io/browse/QTBUG-89102 .

    Use 64 bit to 32 bit cross-compiler as a workaround.



  • @Christian-Ehrlicher I’m not sure what issue you are flagging with the compiler. It seems to be working OK in general, including the test program.



  • @kkoehne It sure looks seems that you identified the proximate cause. While I’m not sure I feel good about an issue that breaks Qt based on machine width, I also didn’t expect the configure script to give me an unsupported configuration out-of-the-box by following the instructions. It actually didn’t occur to me that I might be getting 32-bit libraries by default. Neither the instructions nor the 'help' for the configure script made it clear to me how to change this, but I took a stab at it anyway, and guessed incorrectly. What should I be doing here for a 64-bit debug-enabled build?

    PS Z:\io.qt.code\qt\qt6-build> ..\qt5\configure.bat -no-feature-graphicseffect -prefix Z:\qt -debug -- -A x64; if ($?) { cmake --build . --parallel 4 }; if ($?) { cmake --install . }
    >>
    + cd qtbase
    + Z:\io.qt.code\qt\qt5\qtbase\configure.bat -top-level -no-feature-graphicseffect -prefix Z:\qt -debug -- -A x64
    '//Mac/Home/com.kitware.gitlab/cmake/out/install/x64-Debug (default)/bin/cmake.exe' '-A' 'x64' '-DCMAKE_INSTALL_PREFIX=Z://qt' '-DCMAKE_BUILD_TYPE=Debug' '-DINPUT_graphicseffect=OFF' '-G' 'Ninja' 'Z:/io.qt.code/qt/qt5'
    CMake Error at CMakeLists.txt:11 (project):
      Generator
    
        Ninja
    
      does not support platform specification, but platform
    
        x64
    
      was specified.
    
    
    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
    CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
    CMake Error: CMAKE_ASM_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!
    See also "Z:/io.qt.code/qt/qt6-build/CMakeFiles/CMakeOutput.log".
    CMake Error at Z:/io.qt.code/qt/qt5/qtbase/cmake/QtProcessConfigureArgs.cmake:788 (message):
      CMake exited with code 1.
    


  • An error occurred.But other pc Start Over!
    Windows10 VisualStudio2019 x64 Qt6.0.0

    (mega 2.62GB)
    https://mega.nz/file/tqQ0RJBT#HGZRV0B_k9Ekrf952vJ2-we6LK2nnfUCftSHmoO2syg

    command(admin)
    c:\qt6\src>cmake --install c:\qt6\src


Log in to reply