Home > Mobile >  Qt - The compiler may not produce code compatible with the Qt version
Qt - The compiler may not produce code compatible with the Qt version

Time:11-01

I use MSYS2 on Windows 10 and have installed Qt 6.2.0 and Qt Creator 5.0.2. Then I set up Qt Kit and see this warning:

Qt Kits warning

Warning: The compiler "MinGW-w64 MINGW64 C (MSYS2)" (x86-windows-msys-pe-64bit) may not produce code compatible with the Qt version "Qt 6.2.0 (mingw64)" (x86-windows-msys-pe-64bit).

How to address this issue?

I use MINGW64 subsystem of MSYS2 that has following related packages installed:

mingw-w64-x86_64-gcc 11.2.0-1
mingw-w64-x86_64-gdb 11.1-1
mingw-w64-x86_64-qt-creator 5.0.2-2
mingw-w64-x86_64-qt6-* 6.2.0-2

I failed to figure out toolchain version that was used to build Qt6 packages in order to provide the same toolchain for building applications. The only information I got is ABI : x86-windows-msys-pe-64bit and QT_VERSION : 6.2.0.

Warning message says both compiler and Qt have similar x86-windows-msys-pe-64bit ABI, but it seems to be insufficient.

Until this point I successfully build, run and debug code, but still would like to get rid of this warning if it makes sense.

CodePudding user response:

It turns out this warning goes away when GCC compiler in Qt Creator Kit settings and GCC compiler used to build Qt installation have exactly the same versions.

Using mingw64/share/qt6/mkspecs/qconfig.pri, as suggested by ssbssa, I've got GCC version Qt installation was built with and supplied Qt Creator Kit with GCC compiler that have the same version. Now I see the warning is gone.

  • Related