How to upgrade your MinGW with commonly used libraries

This is a cheatsheet for installing libraries in MinGW, be sure to setup a development environment according to this tutorial first:



  • download zlib-1.2.5.tar.gz
  • tar -zxvf zlib-1.2.5.tar.gz
  • cd zlib-1.2.5
  • ./configure –prefix=/mingw
  • make
  • make install
  • gcc -shared -o /mingw/bin/zlib1.dll -Wl,–out-implib=/mingw/lib/libz.dll.a [!em]*.o


  • download freetype-2.3.12.tar.gz
  • tar -zxvf freetype-2.3.12.tar.gz
  • cd freetype-2.3.12
  • ./configure –prefix=/mingw
  • make
  • make install


  • download curl-7.20.0.tar.gz
  • tar -zxvf curl-7.20.0.tar.gz
  • cd curl-7.20.0
  • ./configure –prefix=/mingw
  • make
  • make install


  • download freeglut-2.6.0.tar.gz
  • tar -zxvf freeglut-2.6.0.tar.gz
  • cd freeglut-2.6.0
  • ./configure –prefix=/mingw
  • make
  • make install


  • download
  • unzip
  • cd glew-1.5.2
  • make
  • make install GLEW_DEST=/mingw


  • download SDL-1.2.14.tar.gz
  • tar -zxvf SDL-1.2.14.tar.gz
  • cd SDL-1.2.14
  • ./configure –prefix=/mingw
  • make
  • make install


  • download libiconv-1.13.1.tar.gz
  • tar -zxvf libiconv-1.13.1.tar.gz
  • cd libiconv-1.13.1
  • ./configure –prefix=/mingw –enable-static=yes
  • make
  • make install


  • download giflib-4.1.6.tar.gz
  • tar -zxvf giflib-4.1.6.tar.gz
  • cd giflib-4.1.6
  • ./configure –prefix=/mingw
  • make
  • make install


  • download jpegsrc.v8a.tar.gz
  • tar -zxvf jpegsrc.v8a.tar.gz
  • cd jpeg-8a
  • ./configure –prefix=/mingw
  • make
  • make install


  • download libpng-1.4.1.tar.gz
  • tar -zxvf libpng-1.4.1.tar.gz
  • cd libpng-1.4.1
  • ./configure –prefix=/mingw
  • make
  • make install


Be sure to apply the patch for building libtiff

  • download tiff-3.9.2.tar.gz
  • tar -zxvf tiff-3.9.2.tar.gz
  • cd tiff-3.9.2
  • ./configure –prefix=/mingw
  • make
  • make install

Libxml2 (Precompiled)

In the shell:

  • cd /mingw/bin
  • pexports libxml2.dll > libxml2.def
  • dlltool –dllname libxml2.dll –def libxml2.def –output-lib ../lib/libxml2.a

Instructions taken from this site and this site


  • download boost_1_42_0.tar.gz
  • tar -zxvf boost_1_42_0.tar.gz
  • copy boost dir (with header files) to /mingw/include

20 Comment


    ./con… doesn’t work on windows ri8?
    or is there a way to make it work

    06 Apr 2010 | Reply

    • You need to use msys to compile the libraries. It provides a linux like console and supports ./configure

      21 Apr 2010 | Reply

  1. Frank Henard

    Hi Laurence,

    These instructions are a great help. It has been a long time since I’ve done C++ programming, and what I have done wasn’t advanced. So on to my question…

    I’m trying to install zlib. I attempted ./configure…, and I’m getting this message:

    $ ./configure -prefix=/mingw
    Checking for gcc…
    Please use win32/Makefile.gcc instead.

    Then I tried:

    $ make
    Please use ./configure first. Thank you.

    Any ideas?

    Also, zlib-1.2.3 is not available, but 1.2.5 is. I installed 1.2.5. Is that ok?

    Finally, any tips on good books to understand C++ and all this dependency stuff?

    12 May 2010 | Reply

    • chris

      if you are running windows vista or later, try to run the console (cmd) as administrator and run the normal postinstallation script manually within this console with administrator rights… this solved the problem for me. i didnt get the error message anymore.

      if you want to get zlib-1.2.3:

      29 Oct 2010 | Reply

  2. Frank Henard

    Any ideas on the “Please use win32/Makefile.gcc instead” message?

    13 May 2010 | Reply

  3. Frank Henard

    I found this in

    cd zlib123
    cp win32/makefile.gcc makefile.gcc

    That may be what I need.

    13 May 2010 | Reply

  4. jV

    cp win32/makefile.gcc makefile.gcc doesn’t work at all and I cant find anything that works on the net.

    31 May 2010 | Reply

  5. Greg Tada

    I was able to compile zlib. Here’s what I did:

    tar –lzma -xvf
    ./msys-build-zlib zlib-1.2.5.tar.bz2
    patch <
    ./configure -prefix=/mingw
    make install
    gcc -shared -o /mingw/bin/zlib1.dll -Wl,–out-implib=/mingw/lib/libz.dll.a [!em]*.o
    make check

    13 Jul 2010 | Reply

  6. Greg Tada

    Now I can’t seem to get libtiff to build. Getting a recursive error during link stage (object name conflicts in archive).

    13 Jul 2010 | Reply

  7. Daryl Lee

    As a variant on what worked for Greg with zlib, what I did was “make -f win32/makefile.gcc”, and then just copied the *.a files into /mingw/lib and the *.exe into /mingw/bin. At that point the example.exe seemed to work.

    20 Sep 2010 | Reply

  8. Brian

    The zlib link seems to be dead. Since the rest of the libraries work great, I think it would be great if you found a live link for the newer version. The dead link can be discouraging to n00bs like me.

    29 Apr 2011 | Reply

    • @Brian: Thanks for letting me know, I’ve update and changed the URL to the SF mirror. As always you can also visit for the most up to date version of zlib.

      03 May 2011 | Reply

  9. Dmitry F. Volosnykh

    Instead of copying, you should run “make install -f win32/Makefile.gcc”. So, it conforms standard procedure of building from sources under GNU/Linux: “make && make install” chain. Good luck.

    16 Jul 2011 | Reply

    • Dmitry F. Volosnykh

      Sorry, before running “make install …”, you should define variables BINARY_PATH, INCLUDE_PATH, LIBRARY_PATH to appropriate mingw folders. Well, read the win32/Makefile.gcc itself 😉

      16 Jul 2011 | Reply

  10. a) zlib

    cd into the folder
    If you try to run ./configure from mingw you will probably get “Please use win32/Makefile.gcc instead.”
    Do “make -f win32/Makefile.gcc”
    You will need to add some lines to your path before you can install zlib. Try either of these options. Either way you will run the same make command: ‘make install -f win32/Makefile.gcc’

    option 1: prepend the path variable before you call make: >’BINARY_PATH=/mingw/bin INCLUDE_PATH=/mingw/include LIBRARY_PATH=/mingw/lib make install -f win32/Makefile.gcc’

    option 2: add the path definitions inside your win32/Makefile.gcc file:


    , then install zlib with ‘make install -f win32/Makefile.gcc’

    04 Dec 2011 | Reply

  11. Charles

    This doesn’t work at all. ./configure is not a command I can run from a cmd.exe prompt. Where do I extract these files to, and how do I install them in windows. I need every single step, you’re leaving out something major that I’m just not getting.


    25 Apr 2012 | Reply

    • You’re not suppose to use cmd.exe to compile these libraries, you need to install MinGW/MSYS and use the MinGW shell with these commands.

      25 Apr 2012 | Reply

  12. Sorry to revive this thread.
    I met with problems while compiling freetype in mingw

    I’ve gotten beyond ./configure –prefix=/mingw.
    I’m at the make step.
    seems like the make script is trying to create a folder /.lib which is illegal in windows.
    I have no idea how to get pass this problem. I was hoping there was a more elegant way of installing libraries than copying files by hand.

    10 Apr 2013 | Reply

    • Marc Williams

      Are you saying it’s trying to create a .lib directory at the root of the drive?
      (for instance C:\.lib or D:\.lib etc. That’s what I gather from the /.lib)
      The .libs directories get created just fine normally.
      The libtool script in the toplevel source dir handles creating those dirs (objdir=.libs). Note, should be .libs, not .lib.
      Maybe there’s a typo in the script or something.

      29 May 2013 | Reply

  13. Nice post man, thanks for it.


    10 May 2016 | Reply

    Leave a reply