libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] Compiling libmicrohttpd-0.4.4 on Windows


From: Michael Lenaghan
Subject: [libmicrohttpd] Compiling libmicrohttpd-0.4.4 on Windows
Date: Wed, 6 Jan 2010 22:37:32 -0500

Nils was right; compiling libmicrohttpd on Windows under MinGW is
pretty easy. My main problem was that I'm an MSYS user rather than a
MinGW user. For the sake of other MinGW neophytes here are some tips.

First, it's a bit of an open question as to where to put your own
include and lib files under MinGW. Of course, there's a connection
between where you place such files and whether or not additional
configuration is needed. There are discussions about options and
trade-offs here:

http://www.mingw.org/wiki/IncludePathHOWTO
http://www.mingw.org/wiki/LibraryPathHOWTO

In my case I chose to put them in dirs that MinGW searches by default:
/mingw/include and /mingw/lib.

Second, on Windows gcc can link directly against dlls; unlike MSVC it
doesn't (always) need import libraries.

Third, while gcc can link directly against dlls, it has to know which
dll it's looking for. The convention on Unix is to use a "-l<lib>"
option. Some shortcut (symbolic link) magic then kicks in to redirect
<lib> to the correct <lib>-<version> library. That doesn't happen on
Windows. So, for example, libmicrohttpd uses "-lplibc"--but the actual
dll name is "libplibc-1.dll", and gcc can't find the one from the
other on its own.

In my case--and no doubt this is a little odd--I placed unversioned
dlls in my lib dir. But: each dll knows its original name, and that's
what the linker records. So you still need to distribute the
*versioned* dlls, not the *unversioned* ones. (If this approach
doesn't appeal to you you can travel the more traditional route:
create a .def using pexports and then create a .dll.a from the .def
and .dll files.)

The following steps assume you've placed needed dlls from prior
libmicrohttpd binary packages in /mingw/bin.

Using MSYS...

$ cp /mingw/bin/libgcrypt-11.dll /mingw/lib/libgcrypt.dll
$ cp /mingw/bin/libgpg-error-0.dll /mingw/lib/libgpg-error.dll
$ cp /mingw/bin/libiconv-2.dll /mingw/lib/libiconv.dll
$ cp /mingw/bin/libintl-8.dll /mingw/lib/libintl.dll
$ cp /mingw/bin/pthreadGC2.dll /mingw/lib/libpthread.dll

(Note that pthread gets a "lib" prefix.)

$ cd PlibC-0.1.5

$ CFLAGS="-O2 -march=i686" ./configure --prefix=/mingw

$ make
$ make install

$ cd ..

$ cd libmicrohttpd-0.4.4

$ CFLAGS="-O2 -march=i686" ./configure --prefix=/mingw --disable-https
--enable-messages

(Obviously, adjust configure flags as required!)

$ make
$ make install

$ cd ..

The libplibc and libmicrohttpd dlls will now be in /mingw/bin.

(Thanks to Nils for confirming that it should be easy to get this going...)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]