pah8J
pah8J

Reputation: 867

What is different between gcc.exe in msys2\usr\bin and gcc.exe in msys2\mingww64\bin?

When typing pacman -S gcc, it will install gcc in /usr/bin in msys2, but when typeing pacman -S mingw-w64-x86_64-gcc, it will install in /mingww64/bin.

What is different between them?

Upvotes: 13

Views: 3453

Answers (1)

David Grayson
David Grayson

Reputation: 87486

The GCC compiler in /usr/bin produces executables that use msys-2.0.dll as a runtime dependency. That DLL is basically a fork of Cygwin, and it provides emulation of POSIX commands not normally available on Windows. That environment is mainly for running programs from the Linux world (like bash) which need POSIX commands and cannot be easily ported to a native Windows environment.

The GCC compilers in /mingw32/bin and /mingw64/bin produce native Windows executables targeting the 32-bit or 64-bit versions of Windows respectively. The 32-bit executables can actually run on 32-bit or 64-bit Windows. These executables are easier to distribute; you generally just copy all the DLLs that they depend on from the /mingw*/bin folder to the same directory as your executable, and then you have something that will run successfully on other computers. Since the main purpose of MSYS2 is to help write native Windows software, you'll find a much wider variety of libraries in the MinGW environments than in the msys-2.0.dll environment.

Upvotes: 23

Related Questions