================================================================== MinGW/MSYS Installation Instructions for LLVM and Pure Compilation ================================================================== MinGW is a Windows port of the GNU compiler suite which produces native executables on the Windows platform (see http://www.mingw.org). MSYS is a small system which enables to run GNU utilities and shell scripts on Windows, namely the configure scripts and GNU make (see http://www.mingw.org/msys.shtml). Here you find instructions how to install both these packages in order to successfully compile LLVM and Pure on your Windows box. Both MinGW and MSYS can be downloaded from this page: http://sourceforge.net/project/showfiles.php?group_id=2435 1. MinGW Installation Download the latest MinGW installation program ("MinGW-5.1.4.exe" in my case) and binutils 2.18.50 ("binutils-2.18.50-20080109-2.tar.gz"). Launch the installation program, when asked check "Download and Install" and when again asked select "Current" package to be installed. On the next dialog window you can select packages to be installed. Select at least "MinGW base tools" and "g++ compiler". You can select other stuff if you plan to use it. DO NOT select "MinGW Make", it is very defficient. In the next dialog box select a suitable installation folder e.g. "d:\mingw" in my case, and proceed. In the next step install the newer version of binutils. Simply extract the tree from the gzipped tarball over the MinGW installation tree (i.e. from bin/ to bin/ etc.) and allow files to be overwritten. 2. MSYS installation From the page mentioned above download the following packages: - current release of MSYS-xxx.exe ("MSYS-1.0.10.exe" in my case) - current release of msysDTK-yyy.exe ("msysDTK-1.0.1.exe") - latest version of bison ("bison-2.3-MSYS-1.0.11-1.tar.bz2") - latest version of flex ("flex-2.5.33-MSYS-1.0.11-1.tar.bz2") - latest version of regex ("regex-0.12-MSYS-1.0.11-1.tar.bz2") Launch the MSYS installation program and install MSYS into a DIFFERENT folder than MinGW (e.g. "D:\msys\1.0" in my case). Then proceed further. Reply "y" when asked whether to continue with postinstall, "y" when asked whether MinGW is intalled and type the path to your MinGW installation when asked to do so. Use normal slashes in that path (e.g. "d:/mingw"). Should this setp fail then edit the file ".../msys/1.0/etc/fstab" so that it contains the line ".../MinGW /mingw" (e.g. "d:/MinGW /mingw" in my case). Launch the msysDTK installation program and install msysDTK into the SAME folder as MSYS (e.g. "D:\msys\1.0" in my case). In the next step install bison and flex. Simply extract the trees from the bzipped tarballs over the MSYS installation tree (i.e. from bin/ to bin/ etc.). From the regex package copy only the file "/bin/msys-regex-0.dll" to msys/1.0/bin. DO NOT copy anything else into the MSYS tree unless you know what you are doing. 3. Installation of other necessary packages Download the package "http://pure-lang.sourceforge.net/mingw/pure-mingw.zip" prepared by Albert Graef. Then create a folder ".../MinGW/local" in your MinGW tree and unpack the tree from the pure-mingw.zip into that folder. Continue creating a folder "...msys/1.0/etc/profile.d" in your MSYS tree. Using your preferred text editor create a new text file named "local.sh" and paste the following four lines (including double quotes) into it: export PATH=.:/d/MinGW/local/bin:/d/MinGW/bin:$PATH export LIBRARY_PATH="d:\mingw\local\lib;d:\mingw\lib" export C_INCLUDE_PATH="d:\mingw\local\include;d:\mingw\include" export CPLUS_INCLUDE_PATH="D:\MinGW\local\include;D:\MinGW\include\c++\3.4.5;D:\MinGW\include\c++\3.4.5\backward;D:\MinGW\include\c++\mingw32;D:\MinGW\include" Then update the paths to real location of your MinGW tree and save the file. When a new shell is started, all shell scripts from the ".../etc/profile.d" folder are executed. This way we needn't to modify the profile file itself. Your MinGW/MSYS environment should be now prepared to compile LLVM and Pure. 4. LLVM compilation Here you can follow the INSTALL file with two exceptions: - You need to apply the patch "DynamicLibrary.inc.patch" to the file ".../llvm-2.2/lib/System/Win32/DynamicLibrary.inc". Download the patchfile from http://pure-lang.sf.net/mingw/ and save it to the ".../llvm-2.2" folder. Then cd in the MSYS shell to that folder and type "patch lib/System/Win32/DynamicLibrary.inc DynamicLibrary.inc.patch". - We did not install groff and perldoc packages so that LLVM doc files cannot be generated and installed. To install LLVM use the command "make -k install" and it will continue over the complaints about missing those two packages.