[Pidgin] #4537: [libpurple]unportable use of resolver library
Pidgin
trac at pidgin.im
Wed Jan 2 08:11:46 EST 2008
#4537: [libpurple]unportable use of resolver library
----------------------------+-----------------------------------------------
Reporter: francois | Type: defect
Status: new | Priority: minor
Component: libpurple | Version: 2.3.1
Keywords: BIND, resolver | Pending: 0
----------------------------+-----------------------------------------------
== Problem ==
libpurple won't compile against a BIND 8 compatible resolver library
== How to reproduce ==
trying to add a CFLAGS=-DBIND_8_COMPAT and compilation will fail for
libpurple/network.c and libpurple/dnssrv.c
== Cause ==
those two files badly include headers for the resolver library.
As stated in the man page of resolver, headers should be included in this
order :
{{{
#!c
#include <arpa/nameser.h>
#include <resolv.h>
}}}
and not
{{{
#!c
#include <resolv.h>
#include <arpa/nameser.h>
}}}
nor
{{{
#!c
#include <resolv.h>
}}}
== Full story ==
When linking libpurple/example/nullclient against a static libresolv.a, I
got an error message claiming unresolved dependencies for _res_9_dn_expand
and _res_9_query. After unluckily looking for those symbols in my
library, I realized it wasn't compiled against BIND 9, so I needed to
define BIND_8_COMPAT.
== Workaround ==
{{{
--- libpurple/dnssrv.c
+++ libpurple/dnssrv.c
@@ -25,11 +25,13 @@
#include "util.h"
#ifndef _WIN32
-#include <resolv.h>
#include <arpa/nameser.h>
+#include <resolv.h>
+#ifndef BIND_8_COMPAT
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
+#endif
#ifndef T_SRV
#define T_SRV 33
#endif
--- libpurple/network.c
+++ libpurple/network.c
@@ -27,6 +27,7 @@
#include "internal.h"
#ifndef _WIN32
+#include <arpa/nameser.h>
#include <resolv.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
}}}
== Note ==
arpa/nameser8_compat.h is automatically included by arpa/nameser.h when
BIND_8_COMPAT is defined.
--
Ticket URL: <http://developer.pidgin.im/ticket/4537>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list