cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How do I compile and install libcurl with MinGW?

From: Guenter Knauf <eflash_at_gmx.net>
Date: Thu, 3 Apr 2008 14:16:39 +0200

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 needs
> 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 special
> 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 examples
> 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 '../../openssl-0.9.8g';
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:
http://www.gknw.net/mirror/zlib/

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.

Guenter.
Received on 2008-04-03