This is a cheatsheet for installing libraries in MinGW, be sure to setup a development environment according to this tutorial first: http://www.multigesture.net/articles/how-to-install-mingw-msys-and-eclipse-on-windows/
Libraries
Zlib
- 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
Freetype
- 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
Curl
- 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
Freeglut
- 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
Glew
- download glew-1.5.2.zip
- unzip glew-1.5.2.zip
- cd glew-1.5.2
- make
- make install GLEW_DEST=/mingw
SDL
- 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
Iconv
- 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
Giflib
- 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
Jpeg
- download jpegsrc.v8a.tar.gz
- tar -zxvf jpegsrc.v8a.tar.gz
- cd jpeg-8a
- ./configure –prefix=/mingw
- make
- make install
Png
- 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
Tiff
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)
- Download pexports-0.43.zip
- Unzip pexports.exe to C:/MinGW/bin
- Download libxml2-2.7.6.win32.zip
- Unzip libxml2-2.7.6.win32.zip to C:/MinGW
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
Boost
- download boost_1_42_0.tar.gz
- tar -zxvf boost_1_42_0.tar.gz
- copy boost dir (with header files) to /mingw/include
./con… doesn’t work on windows ri8?
or is there a way to make it work
06 Apr 2010 |
You need to use msys to compile the libraries. It provides a linux like console and supports ./configure
21 Apr 2010 |
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 |
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: http://prdownloads.sourceforge.net/libpng/zlib-1.2.3.tar.gz?download
29 Oct 2010 |
Any ideas on the “Please use win32/Makefile.gcc instead” message?
13 May 2010 |
I found this in http://www.gaia-gis.it/spatialite-2.4.0/mingw_how_to.html:
cd zlib123
cp win32/makefile.gcc makefile.gcc
That may be what I need.
13 May 2010 |
cp win32/makefile.gcc makefile.gcc doesn’t work at all and I cant find anything that works on the net.
31 May 2010 |
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
make install
gcc -shared -o /mingw/bin/zlib1.dll -Wl,–out-implib=/mingw/lib/libz.dll.a [!em]*.o
make check
13 Jul 2010 |
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 |
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 |
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 |
@Brian: Thanks for letting me know, I’ve update and changed the URL to the SF mirror. As always you can also visit http://www.zlib.net/ for the most up to date version of zlib.
03 May 2011 |
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 |
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 |
a) zlib http://www.zlib.net/
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:
BINARY_PATH=/mingw/bin
INCLUDE_PATH=/mingw/include
LIBRARY_PATH=/mingw/lib
, then install zlib with ‘make install -f win32/Makefile.gcc’
04 Dec 2011 |
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.
Charles.
25 Apr 2012 |
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 |
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 |
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 |
Nice post man, thanks for it.
BRAZIL
10 May 2016 |