Misplaced Pages

Mingw-w64

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Free, open-source, CLI tools for creating Windows-native binaries
MinGW-w64
Original author(s)OneVision Software
Developer(s)Kai Tietz, Jonathan Yong, various GNU contributors
Initial release2005; 19 years ago (2005)
Stable release11.0.1 / April 29, 2023; 19 months ago (2023-04-29)
Repositorysf.net/p/mingw-w64/mingw-w64/
Written inC, C++
Operating systemMicrosoft Windows, Linux, macOS
TypeCompiler
LicensePublic domain (headers), GNU General Public License (compiler and toolchain), Zope Public License
Websitemingw-w64.org

Mingw-w64 is a free and open-source suite of development tools that generate Portable Executable (PE) binaries for Microsoft Windows. It was forked in 2005–2010 from MinGW (Minimalist GNU for Windows).

Mingw-w64 includes a port of the GNU Compiler Collection (GCC), GNU Binutils for Windows (assembler, linker, archive manager), a set of freely distributable Windows specific header files and static import libraries for the Windows API, a Windows-native version of the GNU Project's GNU Debugger, and miscellaneous utilities.

Mingw-w64 can be run natively on Microsoft Windows, cross-hosted on Linux (or other Unix), or "cross-native" on MSYS2 or Cygwin. Mingw-w64 can generate 32-bit and 64-bit executables for x86 under the target names i686-w64-mingw32 and x86_64-w64-mingw32.

History

In 2005, Mingw-w64 was created by OneVision Software under cleanroom software engineering principles, since the original MinGW project was not prompt on updating its code base, including the inclusion of several key new APIs and also much needed 64-bit support. In 2008, OneVision then donated the code to Kai Tietz, one of its lead developers, under the condition that it remains open source. It was first submitted to the original MinGW project, but refused under suspicion of using non-public or proprietary information. For many reasons, the lead developer and co-founder of the MinGW-w64 project, Kai Tietz, decided not to attempt further cooperation with MinGW.

MinGW-w64 provides a more complete Win32 API implementation, including:

Additionally, the Mingw-w64 project maintains winpthreads, a wrapper library similar to pthreads-win32, with the main difference that it allows GCC to use it as a threads library resulting in functional C++11 thread libraries <thread>, <future>, and <mutex>.

MSYS2

MSYS2 ("minimal system 2") is a software distribution and a development platform for Microsoft Windows, based on Mingw-w64 and Cygwin, that helps to deploy code from the Unix world on Windows. It plays the same role the old MSYS did in MinGW.

MSYS2 shares this goal of bringing Unix code to Windows machines with several other projects, most notably Cygwin and Windows Subsystem for Linux (WSL). WSL lets Linux ELF binaries run on Windows through a managed Virtual Machine. Cygwin provides a full POSIX environment (as a windows DLL) in which applications, compiled as Windows EXEs, run as they would under Unix.

Instead of providing a full environment like Cygwin does, MSYS2 tasks itself with being a development and deployment platform.

  • There is a main MSYS2 environment (similar to, and in fact derived from, Cygwin's emulation code) with package manager and standard Unix system tool. This way, when managing MSYS2 itself, standard Unix tools can be used unmodified by using the emulated environment. It's also possible to install build tools in the MSYS2 emulated environment in case the user wants to build software that depends on the POSIX emulation layer instead of the native API.
  • In addition, four environments are provided containing native compilers, build tools and libraries that can be directly used to build native Windows 32-bit or 64-bit programs. The final programs built with the two native environments don't use any kind of emulation and can run or be distributed like native Windows programs. The environments are MINGW64 and MINGW32 (the original MinGW-w64 environments using gcc, msvcrt, and libstdc++), UCRT64 (adaptation of MINGW64 to ucrt), and CLANG64 (adaptation of UCRT64 to clang and libc++). While Cygwin also provides MinGW-w64 compilers and libraries, the set of available libraries is smaller, and they are not as easily managed due to not being placed in separate prefixes.

The main MSYS2 environment provides a package manager (Pacman from Arch Linux), a bash shell, and other Unix programs. It uses a runtime library msys-2.0.dll (~20MB) that is derived from the Cygwin library cygwin1.dll, and is updated regularly to keep track of the Cygwin development. It is intended as a development environment, one that developers can manage (using pacman) and run their tools with. Features judged unnecessary for development are removed.

As with Cygwin, MSYS2 supports path translation for non-MSYS2 software launched from it. For example one can use the command notepad++ /c/Users/John/file.txt to launch an editor that will open the file with the Windows path C:\Users\John\file.txt.

MSYS2 and its bash environment is used by Git and GNU Octave for their official Windows distribution.

Compiler

Most languages supported by GCC are supported on the Mingw-w64 port as well. These include C, C++, Objective-C, Objective-C++, Fortran, and Ada. The GCC runtime libraries are used (libstdc++ for C++, libgfortran for Fortran, etc.). A packaging of LLVM's clang to mingw-w64 is also provided by MSYS2. It supports ARM for Windows (aarch64-w64-mingw32 and armv7-w64-mingw32).

Binaries (executables or DLLs) generated with different C++ compilers (like Mingw-w64 GCC and Visual Studio) are in general not link compatible due to the use of different ABIs and name mangling schemes caused by the differences in C++ runtimes. However, compiled C code is link compatible. Clang is an exception, as it mostly supports MSVC's C++ ABI on Windows.

The binutils documentation has up-to-date information about its handling of various windows-specific formats and special tools for doing so.

References

  1. ^ "(MinGW-w64) History". MinGW-w64 Wiki. Archived from the original on 2019-07-05. Retrieved 2016-02-18.
  2. Danny Smith (13 August 2007). "Re: Sub project for w64 header & crt". Newsgroupcomp.gnu.mingw.devel. Usenet: 000001c7dd83$9ae74310$fe6d65da@THOMAS. Archived from the original on 23 July 2020. Retrieved 23 July 2020. From a cursory spot check of a few files, the crt sources in particular appear to contain too much undocumented material that I suspect may be derived from proprietary sources. I have since avoided looking at the mingw-w64 sources to avoid any taint of copyright abuse. I could well be wrong, but I would rather be safe than jeopardise the future of the mingw32, which has tried to maintain a "clean-room" ethic during its development.
  3. Marshall, Keith (19 July 2009). "Re: Harmonizing mingwrt / w32api with mingw-w64". MinGW-dvlpr (Mailing list). Archived from the original on 28 January 2020. Retrieved 12 June 2014. However, we would require a formal audit of mingw-64 code, to ensure conformance with our requirements for truly open documentation of sources, before could be completed.
  4. Tietz, Kai (20 July 2014). "Re: Harmonizing mingwrt / w32api with mingw-w64". MinGW-dvlpr (Mailing list). Archived from the original on 28 January 2020. Retrieved 12 June 2014.
  5. "MinGW-w64". MinGW-w64.org. Archived from the original on 18 October 2019. Retrieved 30 May 2013.
  6. "MSYS2". www.msys2.org. Archived from the original on 2021-02-07. Retrieved 2022-09-30.
  7. "ZSH on Windows via MSYS2". 26 July 2018. Archived from the original on 28 January 2020. Retrieved 30 January 2020.
  8. ^ "How does MSYS2 differ from Cygwin · msys2/Msys2 Wiki". Archived from the original on 2023-02-15. Retrieved 2023-02-20.
  9. Biswas, Supriyo (2017-04-29). "How to Get an Unix/Linux Environment on Windows with MSYS2". Boolean World. Archived from the original on 2022-09-30. Retrieved 2022-09-30.
  10. "Package: mingw-w64-x86_64-clang". MSYS2 Packages. Archived from the original on 30 October 2020. Retrieved 12 February 2020.
  11. Storsjö, Martin (23 April 2020). "mstorsjo/llvm-mingw". GitHub. Archived from the original on 29 November 2020. Retrieved 27 April 2020.
  12. "Interoperability of Libraries Created by Different Compiler Brands". mingw.org. Archived from the original on 2020-11-30. Retrieved 2022-09-30.
  13. "MSVC compatibility". Clang 11 documentation. Archived from the original on 2021-01-26. Retrieved 2020-02-12.
  14. "ld: win32". sourceware.org. Archived from the original on 2020-02-14. Retrieved 2020-02-10.
  15. "GNU Binary Utilities Documentation". sourceware.org. Archived from the original on 2020-02-19. Retrieved 2020-02-10.

External links

  • MSYS2
  • WinLibs
  • MXE - Makefiles to build MinGW on Unix and many common dependencies libraries targeting Win32/64, pre-built packages available
Software in the Public Interest
People
Projects
UnixWindows interoperability
Unix-like subsystems
Development environments and shells
Ports of Unix-like utilities for Windows
Windows runtime environments for *nix
Platform virtualization software
Related
Categories: