MinGW: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
(Make it explicit that 32 bit MinGW wasn't supported in Qt 6.)
 
(16 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{Cleanup | reason=Auto-imported from ExpressionEngine.}}
{{LangSwitch}}
 
'''English''' [[MinGW_Bulgarian|Български]]
 
[[Category:Tools]]
[[Category:Tools]]
 
[[Category:MinGW]]
 
MinGW is a free and open source Windows port of the GCC compiler and related tools. Qt supports MinGW as a platform on Windows in addition to Visual Studio compiler by Microsoft. However, it can also be used as a cross-compiler e.g. on Unix (currently not officially supported).
MinGW is a free and open source Windows port of the GCC compiler and related tools. Qt supports MinGW as a platform on Windows in addition to Visual Studio compiler by Microsoft. However, it can also be used as a cross-compiler e.g. on Unix (currently not officially supported).


[[Qt Creator]] supports compiling with a MinGW toolchain out of the box.
[[Qt Creator]] supports compiling with a MinGW toolchain out of the box.


= MinGW distributions and versions =
=MinGW distributions and versions=


There are actually different MinGW toolchains and packages available:
There are actually different MinGW toolchains and packages available:
Line 20: Line 16:
There are binary installers targetting MinGW for both Qt 4 and Qt 5. Up to Qt 4.8.6, Qt 4 ones are built with a MinGW.org toolchain using gcc 4.4. Newer Qt 4.8 binary packages ship with a mingw-w64 based toolchain. For Qt 5, a newer MinGW-w64 toolchain is actually required.
There are binary installers targetting MinGW for both Qt 4 and Qt 5. Up to Qt 4.8.6, Qt 4 ones are built with a MinGW.org toolchain using gcc 4.4. Newer Qt 4.8 binary packages ship with a mingw-w64 based toolchain. For Qt 5, a newer MinGW-w64 toolchain is actually required.


= Toolchains used in Qt binary packages =
=Toolchains used in Qt binary packages=


{| class="wikitable"
{| class="wikitable"
! style="text-align:left;"|Qt Version  
! style="text-align:left;" |Qt Version
! style="text-align:left;"|MinGW toolchain
! style="text-align:left;" |MinGW toolchain
|-
|-
| Qt 4.8.5
|Qt 4.8.5
| The binary packages were compiled mingw.org gcc 4.4 toolchain that is unfortunately not officially provided anymore. See also [http://forum.qt.io/viewthread/21079 this forum thread] [qt-project.org]
|The binary packages were compiled mingw.org gcc 4.4 toolchain that is unfortunately not officially provided anymore. See also [http://forum.qt.io/viewthread/21079 this forum thread] [qt-project.org]
|-
|-
| Qt 4.8.6
|Qt 4.8.6, Qt 4.8.7
| "mingw-builds i686-4.8.2-release-posix-dwarf-rt_v3-rev3":http://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win32/Personal Builds/mingw-builds/4.8.2/threads-posix/dwarf/i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z/download
|[http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.8.2/threads-posix/dwarf/i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z/download mingw-builds i686-4.8.2-release-posix-dwarf-rt_v3-rev3]
|-  
|-  
| Qt 5.0
|Qt 5.0
| "mingw-builds x32-4.7.2-release-posix-sjlj-rev8":http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.7.2/32-bit/threads-posix/sjlj/x32-4.7.2-release-posix-sjlj-rev8.7z/download
|[http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.7.2/32-bit/threads-posix/sjlj/x32-4.7.2-release-posix-sjlj-rev8.7z/download mingw-builds x32-4.7.2-release-posix-sjlj-rev8]
|-
|Qt 5.1
|[http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.0/32-bit/threads-posix/dwarf/x32-4.8.0-release-posix-dwarf-rev2.7z/download mingw-builds x32-4.8.0-release-posix-dwarf-rev2]
|-
|Qt 5.2, Qt 5.3
|[http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.8.2/threads-posix/dwarf/i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z/download mingw-builds i686-4.8.2-release-posix-dwarf-rt_v3-rev3]
|-
|Qt 5.4
|[http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.1/threads-posix/dwarf/i686-4.9.1-release-posix-dwarf-rt_v3-rev2.7z/download mingw-builds i686-4.9.1-release-posix-dwarf-rt_v3-rev2]
|-
|Qt 5.5, Qt 5.6
|[https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.2/threads-posix/dwarf/i686-4.9.2-release-posix-dwarf-rt_v3-rev1.7z/download mingw-builds i686-4.9.2-release-posix-dwarf-rt_v3-rev1]
|-
|Qt 5.7, Qt 5.9, Qt 5.10, Qt 5.11
|[https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/5.3.0/threads-posix/dwarf/i686-5.3.0-release-posix-dwarf-rt_v4-rev0.7z/download mingw-builds i686-5.3.0-release-posix-dwarf-rt_v4-rev0]
|-
|Qt 5.12, Qt 5.13, Qt 5.14
|[https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/7.3.0/threads-posix/dwarf/i686-7.3.0-release-posix-dwarf-rt_v5-rev0.7z/download mingw-builds i686-7.3.0-release-posix-dwarf-rt_v5-rev0], [https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/7.3.0/threads-posix/seh/x86_64-7.3.0-release-posix-seh-rt_v5-rev0.7z/download mingw-builds x86_64-7.3.0-release-posix-seh-rt_v5-rev0]
|-
|-
| Qt 5.1
|Qt 5.15
| "mingw-builds x32-4.8.0-release-posix-dwarf-rev2":http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.0/32-bit/threads-posix/dwarf/x32-4.8.0-release-posix-dwarf-rev2.7z/download
|[https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z/download mingw-builds i686-8.1.0-release-posix-dwarf-rt_v6-rev0], [https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z/download mingw-builds x86_64-8.1.0-release-posix-seh-rt_v6-rev0]
|-
|-
| Qt 5.2, Qt 5.3
|Qt 6.0, Qt 6.1, Qt 6.2.0, Qt 6.2.1
| "mingw-builds i686-4.8.2-release-posix-dwarf-rt_v3-rev3":http://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win32/Personal Builds/mingw-builds/4.8.2/threads-posix/dwarf/i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z/download
|[https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z/download mingw-builds x86_64-8.1.0-release-posix-seh-rt_v6-rev0]
|-
|-
| Qt 5.4
|Qt 6.2.2, 6.2.3, 6.2.4
| "mingw-builds i686-4.9.1-release-posix-dwarf-rt_v3-rev2":http://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win32/Personal Builds/mingw-builds/4.9.1/threads-posix/dwarf/i686-4.9.1-release-posix-dwarf-rt_v3-rev2.7z/download
|[https://github.com/cristianadam/mingw-builds/releases/download/v11.2.0-rev1/x86_64-11.2.0-release-posix-seh-rt_v9-rev1.7z mingw-builds x86_64-11.2.0-release-posix-seh-rt_v9-rev1]
|
|-
|Qt 6.3.0 ->
|[https://github.com/cristianadam/mingw-builds/releases/download/v11.2.0-rev3/x86_64-11.2.0-release-posix-seh-rt_v9-rev3.7z mingw-builds x86_64-11.2.0-release-posix-seh-rt_v9-rev3]
|}
|}


= Common problems =
=Common problems=


=== Link error 'Undefined reference to _Unwind_Resume' ===
===Link error 'Undefined reference to _Unwind_Resume'===


This error occurs if object files / libraries being linked are compiled with different versions of mingw. The following steps can fix a problem:
This error occurs if object files / libraries being linked are compiled with different versions of mingw. The following steps can fix a problem:
# Execute <code>mingw32-make distclean</code> in order to remove all object files that was compiled with different mings versions.
 
# Explicitly set library path by setting <code>LIBRARY_PATH</code> environment variable, for example <code>set LIBRARY_PATH=c:010.04\mingw\lib</code>. gcc linker have a very complicated library search algorithm[1] that can result in wrong library being linked (for example, mingw can find installation of strawberry perl in PATH and use it's library).
#Execute <code>mingw32-make distclean</code> in order to remove all object files that was compiled with different mings versions.
#Explicitly set library path by setting <code>LIBRARY_PATH</code> environment variable, for example <code>set LIBRARY_PATH=c:\mingw\lib</code>. gcc linker have a very complicated library search algorithm[1] that can result in wrong library being linked (for example, mingw can find installation of strawberry perl in PATH and use it's library).

Latest revision as of 09:35, 21 July 2023

En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

MinGW is a free and open source Windows port of the GCC compiler and related tools. Qt supports MinGW as a platform on Windows in addition to Visual Studio compiler by Microsoft. However, it can also be used as a cross-compiler e.g. on Unix (currently not officially supported).

Qt Creator supports compiling with a MinGW toolchain out of the box.

MinGW distributions and versions

There are actually different MinGW toolchains and packages available:

MinGW.org is the original project. The latest version gcc 4.7.2. It only compiles for 32 bit binaries.

MinGW-w64 [mingw-w64.sourceforge.net] is a fork with the original aim to also support generation of 64 bit binaries. By now it also supports a much larger part of the Win32 API. The MinGW-w64 project does host several different binary packages, done by different people.

There are binary installers targetting MinGW for both Qt 4 and Qt 5. Up to Qt 4.8.6, Qt 4 ones are built with a MinGW.org toolchain using gcc 4.4. Newer Qt 4.8 binary packages ship with a mingw-w64 based toolchain. For Qt 5, a newer MinGW-w64 toolchain is actually required.

Toolchains used in Qt binary packages

Qt Version MinGW toolchain
Qt 4.8.5 The binary packages were compiled mingw.org gcc 4.4 toolchain that is unfortunately not officially provided anymore. See also this forum thread [qt-project.org]
Qt 4.8.6, Qt 4.8.7 mingw-builds i686-4.8.2-release-posix-dwarf-rt_v3-rev3
Qt 5.0 mingw-builds x32-4.7.2-release-posix-sjlj-rev8
Qt 5.1 mingw-builds x32-4.8.0-release-posix-dwarf-rev2
Qt 5.2, Qt 5.3 mingw-builds i686-4.8.2-release-posix-dwarf-rt_v3-rev3
Qt 5.4 mingw-builds i686-4.9.1-release-posix-dwarf-rt_v3-rev2
Qt 5.5, Qt 5.6 mingw-builds i686-4.9.2-release-posix-dwarf-rt_v3-rev1
Qt 5.7, Qt 5.9, Qt 5.10, Qt 5.11 mingw-builds i686-5.3.0-release-posix-dwarf-rt_v4-rev0
Qt 5.12, Qt 5.13, Qt 5.14 mingw-builds i686-7.3.0-release-posix-dwarf-rt_v5-rev0, mingw-builds x86_64-7.3.0-release-posix-seh-rt_v5-rev0
Qt 5.15 mingw-builds i686-8.1.0-release-posix-dwarf-rt_v6-rev0, mingw-builds x86_64-8.1.0-release-posix-seh-rt_v6-rev0
Qt 6.0, Qt 6.1, Qt 6.2.0, Qt 6.2.1 mingw-builds x86_64-8.1.0-release-posix-seh-rt_v6-rev0
Qt 6.2.2, 6.2.3, 6.2.4 mingw-builds x86_64-11.2.0-release-posix-seh-rt_v9-rev1
Qt 6.3.0 -> mingw-builds x86_64-11.2.0-release-posix-seh-rt_v9-rev3

Common problems

Link error 'Undefined reference to _Unwind_Resume'

This error occurs if object files / libraries being linked are compiled with different versions of mingw. The following steps can fix a problem:

  1. Execute
    mingw32-make distclean
    
    in order to remove all object files that was compiled with different mings versions.
  2. Explicitly set library path by setting
    LIBRARY_PATH
    
    environment variable, for example
    set LIBRARY_PATH=c:\mingw\lib
    
    . gcc linker have a very complicated library search algorithm[1] that can result in wrong library being linked (for example, mingw can find installation of strawberry perl in PATH and use it's library).