2010-07-14

Installing MinGW-w32 on a Windows system

Edit: As of 2011, the information below should only apply if for whatever reason, you cannot use <code>mingw-get</code> for your installation needs. If you are looking for a quick and easy way to install MinGW, you should use <code>mingw-get</code>, either in its GUI version or its command line version.

This is pretty much a reformatting of this post by Xiaofan for the purpose of building libusb and similar projects
  1. Install 7-zip from http://www.7-zip.org as all the MSYS/MinGW are provided in LZMA format. Make sure you go to Options -> System and set the .lzma file association.
  2. Chose a SourceForge mirror from this list and make sure you bypass SourceForge super annoying interface, by browsing project directories in an FTP like fashion. For instance, you can use http://ftp.heanet.ie/mirrors/sourceforge/m/project/mi/mingw to get access to the files fast.
  3. Create both an msys and MinGW directories, on one of your disks, preferably at the root level. For instance, if you install to C, you should create C:\MinGW and C:\msys
  4. In the following list items, I will list the current directory you should download the files from at the root level, and the files to download at the item level. With regards to the extraction, you should extract the files into the same directory as the root for the download (eg. MinGW/BaseSystem/GCC/Version4/gcc-4.5.0-1/gcc-core-4.5.0-1 -> C:\MinGW). Note that the archives are an lzma of a tar, so in 7-zip, you should double click until you see the directories like bin/, include/ etc. These are the directories that need to be copied over to the MinGW or msys dir, so make sure you extract at the right level.
  5. MinGW/BaseSystem/GCC/Version4/gcc-4.5.0-1/
    • gcc-core-4.5.0-1-mingw32-bin.tar.lzma 
    • gcc-c++-4.5.0-1-mingw32-bin.tar.lzma 
    • libgcc-4.5.0-1-mingw32-dll-1.tar.lzma
    • libstdc++-4.5.0-1-mingw32-dll-6.tar.lzma
    • libssp-4.5.0-1-mingw32-dll-0.tar.lzma
  6. MinGW/BaseSystem/GNU-Binutils/binutils-2.20.51/
    • binutils-2.20.51-1-mingw32-bin.tar.lzma
  7. MinGW/gmp/gmp-5.0.1-1/
    • libgmp-5.0.1-1-mingw32-dll-10.tar.lzma
  8. MinGW/mpc/mpc-0.8.1-1/
    • libmpc-0.8.1-1-mingw32-dll-2.tar.lzma
  9. MinGW/mpfr/mpfr-2.4.1-1/
    • libmpfr-2.4.1-1-mingw32-dll-1.tar.lzma
  10. MinGW/BaseSystem/RuntimeLibrary/MinGW-RT/mingwrt-3.18/
    • mingwrt-3.18-mingw32-dll.tar.gz
    • mingwrt-3.18-mingw32-dev.tar.gz
  11. MinGW/BaseSystem/RuntimeLibrary/Win32-API/w32api-3.14/
    • w32api-3.14-mingw32-dev.tar.gz
  12. MSYS/BaseSystem/msys-1.0.15-1/
    • msysCORE-1.0.15-1-msys-1.0.15-bin.tar.lzma
    • msysCORE-1.0.15-1-msys-1.0.15-ext.tar.lzma (this is the file containing the postinstall script we need to run) 
  13. MSYS/autoconf/autoconf-2.65-1/
    • autoconf-2.65-1-msys-1.0.13-bin.tar.lzma
  14. MSYS/autogen/autogen-5.10.1-1/
    • autogen-5.10.1-1-msys-1.0.15-bin.tar.lzma
    • libopts-5.10.1-1-msys-1.0.15-dll-25.tar.lzma
  15. MSYS/automake/automake-1.11.1-1/
    • automake-1.11.1-1-msys-1.0.13-bin.tar.lzma
  16. MSYS/bash/bash-3.1.17-3/
    • bash-3.1.17-3-msys-1.0.13-bin.tar.lzma
  17. MSYS/console/console-2.00b146-1/
    • console-2.00b146-1-msys-1.0.14-bin.tar.lzma
  18. MSYS/coreutils/coreutils-5.97-3/
    • coreutils-5.97-3-msys-1.0.13-bin.tar.lzma
    • coreutils-5.97-3-msys-1.0.13-ext.tar.lzma
  19. MSYS/crypt/crypt-1.1_1-3/
    • libcrypt-1.1_1-3-msys-1.0.13-dll-0.tar.lzma
  20. MSYS/gawk/gawk-3.1.7-2/
    • gawk-3.1.7-2-msys-1.0.13-bin.tar.lzma
  21. MSYS/gdbm/gdbm-1.8.3-3/
    • libgdbm-1.8.3-3-msys-1.0.13-dll-3.tar.lzma
  22. MSYS/gettext/gettext-0.17-2/
    • gettext-0.17-2-msys-1.0.13-bin.tar.lzma
    • libasprintf-0.17-2-msys-dll-0.tar.lzma
    • libgettextpo-0.17-2-msys-dll-0.tar.lzma
    • libintl-0.17-2-msys-dll-8.tar.lzma
  23. MSYS/grep/grep-2.5.4-2/
    • grep-2.5.4-2-msys-1.0.13-bin.tar.lzma
  24. MSYS/libiconv/libiconv-1.13.1-2/
    • libcharset-1.13.1-2-msys-1.0.13-dll-1.tar.lzma
    • libiconv-1.13.1-2-msys-1.0.13-dll-2.tar.lzma
  25. MSYS/libtool/libtool-2.2.7a-2/
    • libtool-2.2.7a-2-msys-1.0.13-bin.tar.lzma
    • libltdl-2.2.7a-2-msys-1.0.13-dll-7.tar.lzma
  26. MSYS/m4/m4-1.4.14-1/
    • m4-1.4.14-1-msys-1.0.13-bin.tar.lzma
  27. MSYS/make/make-3.81-3/
    • make-3.81-3-msys-1.0.13-bin.tar.lzma
  28. MSYS/patch/patch-2.6.1-1/
    • patch-2.6.1-1-msys-1.0.13-bin.tar.lzma
  29. MSYS/perl/perl-5.6.1_2-2/
    • perl-5.6.1_2-2-msys-1.0.13-bin.tar.lzma
  30. MSYS/sed/sed-4.2.1-2/
    • sed-4.2.1-2-msys-1.0.13-bin.tar.lzma
  31. MSYS/tar/tar-1.23-1/
    • tar-1.23-1-msys-1.0.13-bin.tar.lzma
  32. MSYS/termcap/termcap-0.20050421_1-2/
    • libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma
    • termcap-0.20050421_1-2-msys-1.0.13-bin.tar.lzma
  33. MSYS/zlib/zlib-1.2.3-2/
    • zlib-1.2.3-2-msys-1.0.13-dll.tar.lzma
  34. MSYS/cvs/cvs-1.12.13-2/
    • cvs-1.12.13-2-msys-1.0.13-bin.tar.lzma
  35. MSYS/file/file-5.04-1/
    • file-5.04-1-msys-1.0.13-bin.tar.lzma
    • libmagic-5.04-1-msys-1.0.13-dll-1.tar.lzma
  36. MSYS/gzip/gzip-1.3.12-2/
    • gzip-1.3.12-2-msys-1.0.13-bin.tar.lzma
  37. MSYS/regex/regex-1.20090805-2/
    • libregex-1.20090805-2-msys-1.0.13-dll-1.tar.lzma
  38. double click msys.bat
  39. navigate to c/msys/postinstall
  40. run ./pi.sh and follow the prompts

1 comment:

  1. Do you want to install the msys version of autotools (autoconf, automake, etc.) and of files like iconv, libtool and gettext or the mingw version? Was under the impression the msys versions were strictly for use in the msys environment, so if you wanted to build something for mingw as a target, use the mingw versions. If targeting msys, use msys versions. I did an install very similar to the one you have above based on a bash script I have that uses wget to fetch the files. When I tried to build an application with the results, I found it was linking in msys-iconv-2.dll and msys-1.0.dll. Don't think most developers would want to distribute the msys dlls with a Windows native application. If you have any tips for getting the GNU auto-tools and gettext and other GNU internationalization libraries and programs set up so you can more easily built applications, I'd really like to read about them. Seems like every time I reinstall mingw, I need to struggle with getting the right libraries in the proper locations or most programs using ./configure simply just won't work.

    By the way, a few other libraries an average user trying to compile Open Source programs might want to install are libpthread-2.8.0-3-mingw32-dll-2.tar.lzma, pthreads-w32-2.8.0-3-mingw32-dev.tar.lzma, libgomp-4.5.0-1-mingw32-dll-1.tar.lzma, libssp-4.5.0-1-mingw32-dll-0.tar.lzma, mpc-0.8.1-1-mingw32-dev.tar.lzma, mpfr-2.4.1-1-mingw32-dev.tar.lzma, gmp-5.0.1-1-mingw32-dev.tar.lzma (according to the HOWTO Install the MINGW Compiler Suite at the MinGW wiki). I also like to install dlfcn-win32-shared.tar.bz2 from the dlfcn-win32 project. One of the reasons I switched to using scripts to download all of this is there are now just too many files to easily find the right ones and get them to the proper locations. I'd try out mingw-get to automate the process, but I can't get it to work in my particular situation.

    ReplyDelete