Re: How do I compile and install libcurl with MinGW?
Date: Thu, 3 Apr 2008 17:42:52 -0400
On Thu, Apr 3, 2008 at 8:16 AM, Guenter Knauf <eflash_at_gmx.net> wrote:
> Hi Samus,
> > I am on Windows XP Home Edition SP 2, using gcc version 3.4.5 (mingw
> > special) and mingw32-make version 3.81 for an i386 PC.
> that's same what I have here.
> > OK so I need a little explanation first about libraries. When I compiled
> > the
> > libcurl library (in the 'lib' directory) I got 4 files. libcurl.res,
> > libcurl.a, libcurl.dll and libcurldll.a. How does MinGW know that in
> > to link to these libraries? Do I have to install them somewhere? If I
> > write a program that uses libcurl functions, do I have to do something
> > so that it compiles correctly?
> libcurl.a is the static library - means when you link with that you dont
> need the DLL at runtime;
> if you link with libcurldll.a then your executable depends on the DLL, so
> this need to be
> either in the current directory, or somewhere in the search path when you
> start the executable.
> You can 'install' the headers and libs into your mingw32 distro - means
> that the headers go to
> the ./include folder (the complete include/curl folder), and the libs then
> into ./lib;
> however when you compile something own then you still need to tell the
> linker to use the static or dynamic link library with -lcurl, or -lcurldll;
> if you dont do that then the only additional thing you need is to add the
> curl includes with something like -Ic:/projects/curl-7.18.1/include ...
> > Also, I downloaded OpenSSL from the link you gave me and I put it in the
> > folder where I exctracted curl-7.18.1, then I try to compile the
> > again and it doesn't work, it gave me the same error I posted before.
> then I guess the foldername is wrong; the makefiles look for
> so either rename the folder, or use the environment vars to point to the
> right place;
> here's something what I use when I compile:
> set LIBSSH2_PATH=c:/projects/sdks/libssh2-0.18
> set OPENSSL_PATH=c:/projects/sdks/openssl_mingw32-0.9.8g
> set ZLIB_PATH=c:/projects/sdks/zlib-1.2.3
> if needed you can find the zlib for mingw32 here:
> Oh, and dont forget to recompile libcurl itself when you want SSL support;
> unfortunately there's no target with SSL and without Zlib in the main
> makefile, so you should use:
> mingw32-make mingw32-ssl-zlib
> also please read through ./docs/INSTALL which has a mingw32 section that
> explains all these things.
Hey Guenter. Thanks a lot!!!! Everything works now. I have learned so much
these last couple of days trying to compile and install these libraries, and
all the examples compiled successfully and work wonderfully. So in
conclusion, this is all I had to do:
1. Download the latest curl package, pre-compiled zlib package for MinGW and
precompiled openssl package for MinGW.
2. Extract each package in a newly created folder, for good organization and
rename them so that they match the paths the Makefile.m32 variables hold.
3. Open command prompt, cd to the root of the curl package, and type
4. Copy the newly created libcurl.a and libssl.a, libcrypto.a, libeay32.a,
libssl32.a, and libz.a to the \MinGW\lib folder.
5. Open command prompt, cd to the .\docs\examples in the curl package, and
type "mingw32 -f Makefile.m32"
6. All the executables have built successfully and run without the need of
an external dll.
Thanks a lot, you were a really big help. I have learned a lot and now I'll
start reading about the libcurl functions because I'll soon use them in my
Thanks again. - Samus
Received on 2008-04-03