About MSYS
MSYS is a collection of GNU utilities such as bash, make, gawk and grep to allow building of applications and programs which depend on traditionally UNIX tools to be present. It is intended to supplement MinGW and the deficiencies of the cmd shell.
An example would be building a library that uses the autotools build system. Users will typically run "./configure" then "make" to build it. The configure shell script requires a shell script interpreter which is not present on Windows systems, but provided by MSYS.
A common misunderstanding is MSYS is "UNIX on Windows", MSYS by itself does not contain a compiler or a C library, therefore does not give the ability to magically port UNIX programs over to Windows nor does it provide any UNIX specific functionality like case-sensitive filenames. Users looking for such functionality should look to Cygwin or Microsoft's Interix instead.
Installing MSYS
These instructions were based on the Enlightenment Wiki. Thanks to Vincent Torri for pointing them out.
The total size of the installation of MSYS/MinGW is around 110 MB. Be sure to have enough space on your hard disk.
- If you haven't already installed MinGW on your system, install MinGW in C:\MinGW. It is better to not install it in the same directory than MSYS, though there should be no problem since MSYS 1.0.11. In the installer, choose "Download and install", then "Candidate" (it will install gcc 3.4.5).
- Install MSYS 1.0.10. I usually install it in C:\msys\1.0, but you can use any directory that you prefer.
- Next, the post install process will ask for the directory where MinGW was installed to. Enter "c:/mingw". If you make a mistake, you can change it by editing the "C:\msys\1.0\etc\fstab" file, make sure to use 'LF line endings. An example fstab may contain:
c:/mingw /mingw c:/java /java
- Install MSYS DTK 1.0 in C:\msys\1.0.
- Install MSYS Core 1.0.11. It is an archive. Untar it in C:\msys\1.0.
- Set the environment variable HOME to C:\msys\1.0\home
Now you should have a cyan "M" link on the Desktop. When you double-click on it, a terminal should be launched.
Recommended updates for MSYS
MSYS Base System contains numerous updates for MSYS. It is recommended to install the following updates:
- Bash
- Coreutils
- m4
Using MSYS with MinGW
The autotools that are installed by MSYS DTK do not work well and can't build DLLs. If you need newer versions of autoconf, automake and libtool then follow these instructions.
We will install autoconf, automake and libtool.
- Unpack autoconf, automake and libtool to a directory of your choice.
- Install them with the 3 with the following command:
./configure --prefix=/mingw && make && make install
- If make seems to be stuck in an infinite loop, csmake should probably be used instead.
As all the libraries will be installed in /mingw, PKG_CONFIG_PATH must be set. Optionally, if you want to get the cvs repository as a developer, CVS_RSH must also be set.
Open the file /etc/profile (C:\msys\1.0\etc\profile) with your favorite editor (make sure it uses LF line endings) and add:
PKG_CONFIG_PATH="/mingw/lib/pkgconfig" CVS_RSH=ssh
You might also want to set CFLAGS. Safe options for MinGW are:
CFLAGS="-pipe -O2 -mms-bitfields -march=i686"
just before
export HOME LOGNAME MSYSTEM HISTFILE
and modify that line by adding the four variables:
export HOME LOGNAME MSYSTEM HISTFILE CFLAGS PKG_CONFIG_PATH CVS_RSH
Now restart MSYS. You should now be able to use MSYS without problems.
- To install 3rd party library and applications which uses the autotools build system the following commands are often used.
./configure --prefix=/mingw make make install
- Installing to "/usr/local" should be avoided, "/mingw" should be used instead to avoid conflicts with msysdvlpr.
Building for MSYS
To build an application for MSYS (as opposed to using MSYS), users will need to install msysDVLPR. It contains the headers and libraries to for MSYS along with an old version of GCC and Binutils. Resulting programs will only run under MSYS.
Msysdvlpr should never be treated as a targeted platform. It should also be noted that msysdvlpr is unlikely to be updated in the near future.
MinGW build VS MSYS build
Some programs when used under the MSYS shell can be tricky. One such example is sed.
$ ls *.txt -1 | sed -e s/.exe/\&\!/g
Normally, sed will append "!" to the end of every .txt file, but if sed was compiled and link using MinGW, MSYS will treat it as a native application and will try to change "/" to "\" to compensate for the difference between UNIX path and WIN32, resulting in unpredictability when used under the MSYS shell.
Recent comments
1 day 22 hours ago
1 day 23 hours ago
4 days 8 hours ago
1 week 1 day ago
6 weeks 1 day ago
6 weeks 2 days ago
6 weeks 2 days ago
7 weeks 7 hours ago
7 weeks 4 days ago
9 weeks 6 days ago