Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 956
pah8J Avatar asked Mar 25 '18 10:03

pah8J


1 Answers

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.

like image 189
David Grayson Avatar answered Oct 12 '22 16:10

David Grayson