building an MSVC app with libpurple

Daniel Atallah daniel.atallah at
Thu May 24 19:19:27 EDT 2007

On 5/24/07, David Byron <dbyron at> wrote:
> I'm trying to use libpurple (built from pidgin-2.0.0.tar.bz2) in an app
> that's built with the native MSVC tools.  Apologies if this is more of a
> glib question or a mingw question but since it's definitely a
> pidgin/libpurple question I figured I'd start here.

> I followed the normal mingw instructions to build pidgin, configuring like
> this:
> ../configure --enable-static --disable-shared --disable-gtkui
> --enable-consoleui --disable-perl --disable-tcl --disable-tk --enable-debug
> --enable-fatal-asserts
> --with-static-prpls=gg,irc,jabber,msn,novell,oscar,qq,simple,yahoo,zephyr
> --disable-mcheck

The win32 build isn't built with configure, we use static makefiles;
see the instructions at

> I only saw libpurple.dll and libpurple.dll.a, but no .def file.  Given the
> --disable-shared argument to configure I'm not sure why I got a .dll at all
> but that's a bit of a different question.

I'm not sure how configure didn't fail miserably (it must have) since
there are host of reasons why it wouldn't work.  The static mingw
makefiles don't in any way use configure, so anything specified will
have no effect on the build.

> Since I (think I) need a .def file, I modified libpurple/Makefile.mingw to
> add this argument to the gcc invocation to build libpurple.dll and
> libpurple.dll.a:
>         $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS)
> -Wl,--output-def,$(TARGET).def,--out-implib,$(TARGET).dll.a -o $(TARGET).dll
> Note the extra --output-def,$(TARGET).def.
> Anyway, after rebuilding, I followed the mingw instructions and ran:
> lib /machine:i386 /def:libpurple.def
> and voila, a libpurple.lib.

Yes, this is fine, I'd have no problem updating the mingw Makefile to do that.

> I created a Visual Studio solution using nullclient.c and after adding the
> appropriate include paths and modifying like this:
> Success?  Unfortunately not.  When I run the program, I
> get an error message that says:
> "This application has failed to start because libglib-2.0-0.dll was not
> found. Re-installing the application may fix this problem."
> I would happily add something to my path to get by this, but
> gtk-dev-2.6.10-rev-a.tar.gz only has libglib-2.0.dll.a, not
> libglib-2.0-0.dll.
> This makes me think I need to build glib from source or to find the file I'm
> looking for in another distribution (e.g.
> That zip file does have libglib-2.0-0.dll and it makes the error go away.
> The warnings on make me
> think I'll need to build this myself before it's all over.  Anyone else have
> experience with this?

You've gotten quite far.  The problem here is that you only have the
glib development package; you also need the runtime, which I guess you
found on Tor's site.  These are fine (and are actually what I use in
our GTK+ runtime installer.  You don't have to rebuild them, Tor's
binary should be fine.

> After this error message, I get another one libxml2 that I solve by adding
> win32-dev\libxml2\bin to my path.  Unfortunately, there's still another
> missing dll:  zlib1.dll.  Again the gtk tarball has zlib.lib but no
> zlib1.dll.  Googling for it finds it for me, but yet another missing dll.
> This time it's glib-2.0.dll....Has anyone gone down this road?  It doesn't
> feel like a good one.  If I really need to build everything from source with
> the native tools I will but I'm hoping someone knows a shorter way.

You just need all the various dependencies that libpurple and glib
have .  I suspect you have some incompatible versions of these dlls -
it generally isn't the best idea just to grab a version from some
random place on the web.

libpurple needs libxml2, glib (and gobject, gthread, gmodule) and libintl.

For libxml2, you can use libxml2.dll from "win32-dev\libxml2\bin".

glib, gobject, gthread and gmodule are all in the bin directory of the
glib runtime you got from Tor's site

glib needs libiconv and gettext - compatible versions of these are
both available on Tor's site:

libxml2 also needs zlib (also available from Tor's site).

**An alternative is to grab the unpackaged version of our GTK+
installer from
and then grab all the needed dlls from that (it has been assembled
from the above sources).

Binaries are available for the dependencies, you don't need to compile
any of them.  Once you've satisfied the dependencies, you should be
able to use libpurple.

You're navigating relatively uncharted territory here, but it sounds
like you've already gotten most of the hard parts working.


More information about the Devel mailing list