MinGW: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
'''English''' [[MinGW Bulgarian|Български]]
'''English''' [[MinGW_Bulgarian|Български]]


=MinGW=
[[Category:Tools]]


MinGW is a free and open source Windows port of the <span class="caps">GCC</span> 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 =


[[Qt-Creator|Qt Creator]] supports compiling with a MinGW toolchain out of the box.
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 distributions and versions=
[[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:
There are actually different MinGW toolchains and packages available:


[http://www.mingw.org MinGW.org] ''[mingw.org]'' is the original project. The latest version gcc 4.7.2. It only compiles for 32 bit binaries.
&quot;MinGW.org&amp;quot;:http://www.mingw.org is the original project. The latest version gcc 4.7.2. It only compiles for 32 bit binaries.


[http://mingw-w64.sourceforge.net 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 <span class="caps">API</span>. The MinGW-w64 project does host several different binary packages, done by different people.
&quot;MinGW-w64&amp;quot;:http://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.
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="infotable line"
|- style="background: #009900"
! 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 [http://forum.qt.io/viewthread/21079 this forum thread] ''[qt.io]'' .
|- style="background: #ddd"
| Qt 4.8.6
|
[http://sourceforge.net/projects/mingw-w64/files/Toolchains mingw-builds i686-4.8.2-release-posix-dwarf-rt_v3-rev3] ''[sourceforge.net]'' targetting Win32/Personal Builds/mingw-builds/4.8.2/threads-posix/dwarf/i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z/download
|-
| Qt 5.0
|
[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] ''[sourceforge.net]''
|- style="background: #ddd"
| 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] ''[sourceforge.net]''
|-
| Qt 5.2, Qt 5.3
|
[http://sourceforge.net/projects/mingw-w64/files/Toolchains mingw-builds i686-4.8.2-release-posix-dwarf-rt_v3-rev3] ''[sourceforge.net]'' targetting Win32/Personal Builds/mingw-builds/4.8.2/threads-posix/dwarf/i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z/download
|- style="background: #ddd"
| Qt 5.4
|
[http://sourceforge.net/projects/mingw-w64/files/Toolchains mingw-builds i686-4.9.1-release-posix-dwarf-rt_v3-rev2] ''[sourceforge.net]'' targetting Win32/Personal Builds/mingw-builds/4.9.1/threads-posix/dwarf/i686-4.9.1-release-posix-dwarf-rt_v3-rev2.7z/download
|}
 
=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:


# Execute <code>mingw32-make distclean</code> in order to remove all object files that was compiled with different mings versions.
{background:#009900}. |''. Qt Version |''. MinGW toolchain |<br /> | - Qt 4.8.5| The binary packages were compiled mingw.org gcc 4.4 toolchain that is unfortunately not officially provided anymore. See also &quot;this forum thread&amp;quot;:http://forum.qt.io/viewthread/21079 . |<br /> {background:#ddd}. | Qt 4.8.6 | &quot;mingw-builds i686-4.8.2-release-posix-dwarf-rt_v3-rev3&amp;quot;: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 |<br /> | Qt 5.0| &quot;mingw-builds x32-4.7.2-release-posix-sjlj-rev8&amp;quot;: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 |<br /> {background:#ddd}. | Qt 5.1| &quot;mingw-builds x32-4.8.0-release-posix-dwarf-rev2&amp;quot;: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 |<br /> | Qt 5.2, Qt 5.3| &quot;mingw-builds i686-4.8.2-release-posix-dwarf-rt_v3-rev3&amp;quot;: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 |<br /> {background:#ddd}. | Qt 5.4| &quot;mingw-builds i686-4.9.1-release-posix-dwarf-rt_v3-rev2&amp;quot;: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 |


<sup>1</sup> [http://www.mingw.org/wiki/LibraryPathHOWTO Mingw wiki about library search problems] ''[mingw.org]''
= Common problems =


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


* [[:Category:Tools|Tools]]
This error occurs if object files / libraries being linked are compiled with different versions of mingw. The following steps can fix a problem:<br /># Execute &lt;code&amp;gt;mingw32-make distclean&amp;lt;/code&amp;gt; in order to remove all object files that was compiled with different mings versions.<br /># Explicitly set library path by setting &lt;code&amp;gt;LIBRARY_PATH&amp;lt;/code&amp;gt; environment variable, for example &lt;code&amp;gt;set LIBRARY_PATH=c:010.04\mingw\lib&amp;lt;/code&amp;gt;. 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).

Revision as of 14:11, 23 February 2015

English Български

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

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&quot;:http://www.mingw.org is the original project. The latest version gcc 4.7.2. It only compiles for 32 bit binaries.

"MinGW-w64&quot;:http://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

{background:#009900}. |. 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&quot;:http://forum.qt.io/viewthread/21079 . |
{background:#ddd}. | Qt 4.8.6 | "mingw-builds i686-4.8.2-release-posix-dwarf-rt_v3-rev3&quot;: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 |
| Qt 5.0| "mingw-builds x32-4.7.2-release-posix-sjlj-rev8&quot;: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 |
{background:#ddd}. | Qt 5.1| "mingw-builds x32-4.8.0-release-posix-dwarf-rev2&quot;: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 |
| Qt 5.2, Qt 5.3| "mingw-builds i686-4.8.2-release-posix-dwarf-rt_v3-rev3&quot;: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 |
{background:#ddd}. | Qt 5.4| "mingw-builds i686-4.9.1-release-posix-dwarf-rt_v3-rev2&quot;: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 |

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:
# Execute <code&gt;mingw32-make distclean&lt;/code&gt; in order to remove all object files that was compiled with different mings versions.
# Explicitly set library path by setting <code&gt;LIBRARY_PATH&lt;/code&gt; environment variable, for example <code&gt;set LIBRARY_PATH=c:010.04\mingw\lib&lt;/code&gt;. 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).