This page will teach you how to build MSYS and other packages from source.
First you will need to download many packages from sourceforge.
- From the SourceForge MinGW/MSYS download page or using WINSCP (or your favourite FTP client) use one of the sourceforge mirrors to download and install the following files in the order given; note the additonal instructions for some of the steps. Note that some of these files do not appear on the MinGW/MSYS web page hence you might need to use an FTP client to get them.
- MinGW-5.1.4.exe (Windows installer).
- I used H:\MinGW as the installation folder.
- MSYS-1.0.10.exe (Windows installer).
- I used H:\MSYS\1.0 as the installation folder.
- As part of the MSYS installation you can set up MSYS's /etc/fstab to mount your MinGW installation. It's easiest to do this in the penultimate step of the installer in the command prompt it displays. The default (which I used) was to mount H:\Mingw as /mingw
- msysCORE-1.0.11-<latestdate>.tar.gz
- Extract "over" the MSYS installation.
- I had a problem with patch from 1.0.11 exclude from the extraction if possible.
- Extract "over" the MSYS installation.
- msysDTK-1.0.1.exe (Windows installer).
- Install this "over" the MSYS installation from the previous step, i.e. set the installation folder to be the same as that for MSYS. In my example, this was H:\MSYS\1.0. This exe is to be found in the MSYS Supplementary Tools page, under the heading "msysDTK-1.0.1".
- flex-2.5.33-MSYS-1.0.11-1.tar.bz2
- Extract "over" the MSYS installation.
- bison-2.3-MSYS-1.0.11-1.tar.bz2
- Extract "over" the MSYS installation.
- regex-0.12-MSYS-1.0.11-1.tar.bz2
- Extract "over" the MSYS installation.
- gettext-0.16.1-1
- I know for sure you need the devel package, -bin and -dll may also be needed
- MinGW-5.1.4.exe (Windows installer).
- As per the instructions on this old MinGWiki page I downloaded and unpacked the archive msysDVLPR-1.0.0-alpha-1.tar.gz which is available from the MSYS System Builder page linked from the MinGW SourceForge page. It should be extracted "over" the MSYS installation and it doesn't overwrite anything that is in the MSYS installation. It simply adds more files.
- The header file termios.h needs to be updated for building Bash. Change line 48 of /lib/gcc-lib/i686-pc-msys/2.95.3-1/include/sys/termios.h (in the MSYS installation) from
#define CTRL('c'h) ((ch)&0x1F)to
#define CTRL(ch) ((ch)&0x1F)
(Taken from this old MinGWiki page)
- Start the MSYS build environment - double click the MSYS icon on the desktop. This will open a shell with title MINGW. Enter the command "msysdvlpr" and hit enter. This will open a new shell window with title MSYS which has the MSYS build environment set up. You must use this new window for the remaining steps. The first shell can be closed after the new one has started.
- cd to /home/<user_name>/bash-3.1-MSYS-1.0.11-1 and make a subdirectory to build in. For some strange reason, the MSYS build environment doesn't like building in the same folder as the source code (did I read this correctly???). Let's say you created /home/<user_name>/bash-3.1-MSYS-1.0.11-1/my_build
- cd to /home/<user_name>/bash-3.1-MSYS-1.0.11-1/my_build
- Set the variable MSYS_PREFIX=/usr
- OPTIONAL: if you wish, you can alter the function "shell_version_string" in the C file /home/<user_name>/bash-3.1-MSYS-1.0.11-1/version.c to have some additional text to indicate that it really is your version of Bash running when you "echo $BASH_VERSION".
- Run ../configure --prefix=$MSYS_PREFIX (Can take a very long time if your machine is older than about 2 or 3 years).
- Run "make" to build Bash.
Note: you might need to create /home/<user_name>/ yourself as I don't recall if the MinGW or MSYS installers seem to. I think one does and the other doesn't, if I recall correctly.
See also the following for more hints and suggestions:
[FIXME: these references all point to the old, now-defunct MinGWiki; the original pages need to be migrated].
http://www.mingw.org/phpwiki-1.3.14/index.php/Build%20bash
http://www.mingw.org/phpwiki-1.3.14/index.php/FullTextSearch?s=sgtty.h%3A+No+such+file+or+directory
http://www.mingw.org/phpwiki-1.3.14/index.php/MSYSBuildEnvironment
http://www.mingw.org/phpwiki-1.3.14/index.php/Build%20MSYS
http://www.mingw.org/phpwiki-1.3.14/index.php/bug-termios_h
MinGW/MSYS Source Forge home page:
http://sourceforge.net/project/showfiles.php?group_id=2435
Notes:
- I hope this doesn't tread on anyone's toes, but even our Linux guru at work had trouble setting this up in the first instance. So apologies in advance if it does
- I was also able to build make and the coreutils (except for some man-page errors) with the same build environment.
- NOTE (14 October 2008): looks like this page needs a bit of an update as some of the locations have changed. I'll try to do it one weekend in October 2008!
- Note: 28 October 2008: OK, so it's the last week in October, and I've only now found some time to update this page! Better late than never, and it least it is this month!! ;-)
- Note: Some information on building MSYS itself from source is derived from http://comments.gmane.org/gmane.comp.gnu.mingw.msys/4532
Re: HOWTO Create an MSYS Build Environment
Hi,
The links to flex, bison and bash are broken.
Regards,
Re: HOWTO Create an MSYS Build Environment
I don't think they were intended to be links; the MediaWiki filter apparently misidentified them. I've adjusted the formatting, based on this assumption.
Re: HOWTO Create an MSYS Build Environment
Yes, they were not intended to be links and I didn't know how to fix thm. I think some kind soul has done so for me. Thanks to that person!
Re: HOWTO Create an MSYS Build Environment
I tried running flex soon after installing flex and bison. It gave me an error message saying "The application has failed to start because msys-regex-0.dll was not found. Re-installing the application may fix this problem." I guess something more needs to be specified in the steps mentioned here. Installing regex 0.12 resolves the issue. I have modified the steps to include this package.
Re: HOWTO Create an MSYS Build Environment
Quote:
It's actually dependent on the source package you are building; some will allow building in the source directory, some will not. IIRC, GCC itself will not even permit building in any subdirectory of the source tree.
However, why do you consider this strange? It is, in fact, good practice to always build in a different directory from the source; any package which does not support such building, (commonly known as `VPATH' or `out-of-source' building), is deficient, IMO.
Directing you to build in a separate directory is merely encouraging good practice.
Re: HOWTO Create an MSYS Build Environment
I thought it was strange compared to the many, many Linux packages that I have "built" following the standard "tar, configure, make" routine.
I think I was being a bit imprecise here; by "built" I meant run "configure" and "make". I don't ever recall having to create a subdirectory of the untar'd package in order to run configure from.
In particular, I have built bash on Linux and didn't need to create a subdirectory to run configure and make in. Hence, it seemed strange to find that for MSYS it was suggested to do so. Or, have I've completely mis-read something and that's not what it meant at all?