[Pdns-users] compile errors with recent PDNS SVN (tag 867)

Juergen Ilse powerdns at usenet-verwaltung.de
Tue Jul 4 22:01:34 UTC 2006


Sebastian Merk <merk at smcc.net> wrote:
> I'm having trouble to compile the actual version of PDNS which I
> fetched via SVN:

I had the same problem since a lot of versions of pdns (don't know,
which was the last version without this problem). I simply copied the
missing class from the last compileable version ...
Also i have some other small patches in my version (to allow compilation
on Sun-Sparc-Solaris8 and hopefully Sun-x86-Solaris10, but i have no
Solaris10 Test-machine any more, since that machine was needed as a
customer server ... now i compile only on Sparc-Solaris8, x86-Linux
and x86_64-linux).

Most changes are small changes to include <stdint.h> if and only if
this headerfile exists on the system. For this purpose, i include
"config.h" and then test for definition of _HAVE_STDINTH (which is
defined in "config.h" when this headerfile is available on the system;
it works for me and seems to me to be more portable than the test in
the original source ...).

There is also a change to "undefine" a Macro named "DS" when it is defined
(because on Solaris10-x86 this macro *is* defined. and that leads to some
syntax-errors in "pdns/dnsrecords.cc"). I saw an unconditional "undef DS"
in rev867, but i think. it is a better idea to test if the Macro is
defined before undefining it (that was in dnsredords.cc) ...

Next i surrounded the definition of the "enum" types "ns_t_*" in file
"pdns/dns.hh" with "#ifdef NEED_NS_TYPES" and "#endif". On my machines,
there is no need to define this, the definition leads to an error-
messages during compilation ... Maybe it is only a problem, because
i included in a previous path <netinet/in.h> and <arpa/nameser.h> in
dnswriter.hh ...

In "utility.hh" i "reactivated" the previously (in rev7xx?) contained
classdefinition of "class Semaphore".

In Makefile.am, i deleted the entry "epollmplexer.cc" from the list
of sourcefiles, because it was not compileable on Solaris and it
seems to me, that this file is not really needed ...

Next i changed the call to "makecontext()" in file mtasker.cc for the
case of compilation on Solaris8: On Solaris8 the first Parameter of
"makecontext()" should be "void (*)()" instead of "void (*)(...)".
Otherwise i get a compilation error on Solaris8 with gcc3.4.

Also i included "utility.hh" in the file "distributor.hh", which
should solve your problem (in combination with the patched "utility.hh",
see above).

Last, i changed the include-directives in dnspcap.hh for Solaris:
On Solaris, it is <sys/ethernet.h> instead of <net/ethernet.h> ...

> I tried it with gcc 3.4.4 and gcc 4.0.2. Any ideas on the Semaphore
> problem in distributor.hh?

With earlier version of powerdns, there was a definition of "class Semaphore"
in utility.hh, so i copied this definition from that older version to my
current version of the source ...

I will attach the above mentioned patches to this email, maybe it
is useful for you (and maybe some others, eventually we will see
some of these patches in the next official release of powerdns).

        Juergen Ilse
-------------- next part --------------
Index: pdns/dnswriter.hh
--- pdns/dnswriter.hh	(Revision 867)
+++ pdns/dnswriter.hh	(Arbeitskopie)
@@ -1,14 +1,20 @@
+#include "config.h"
 #include <string>
 #include <vector>
 #include <map>
-#if !defined SOLARIS8 && !defined WIN32
 #include <stdint.h>
 #elif defined WIN32
 #include "utility.hh"
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
 #include "dns.hh"
 using namespace std;
Index: pdns/rec_channel.hh
--- pdns/rec_channel.hh	(Revision 867)
+++ pdns/rec_channel.hh	(Arbeitskopie)
@@ -1,11 +1,14 @@
+#include "config.h"
 #include <string>
 #include <map>
-#if !defined SOLARIS8 && !defined WIN32
 #include <stdint.h>
 #elif defined WIN32
 #include "utility.hh"
+#include <sys/types.h>
 #ifndef WIN32
Index: pdns/utility.hh
--- pdns/utility.hh	(Revision 867)
+++ pdns/utility.hh	(Arbeitskopie)
@@ -73,7 +73,53 @@
 using namespace std;
+//! A semaphore class.
+class Semaphore
+  sem_t *m_pSemaphore;
+#ifdef WIN32
+  typedef int sem_value_t;
+  //! The semaphore.
+  //! Semaphore counter.
+  long m_counter;
+  typedef int sem_value_t;
+  uint32_t       m_magic;
+  pthread_mutex_t m_lock;
+  pthread_cond_t  m_gtzero;
+  sem_value_t     m_count;
+  uint32_t       m_nwaiters;
+  //! Default constructor.
+  Semaphore( unsigned int value = 0 );
+  //! Destructor.
+  ~Semaphore( void );
+  //! Posts to a semaphore.
+  int post( void );
+  //! Waits for a semaphore.
+  int wait( void );
+  //! Tries to wait for a semaphore.
+  int tryWait( void );
+  //! Retrieves the semaphore value.
+  int getValue( Semaphore::sem_value_t *sval );
 //! This is a utility class used for platform independant abstraction.
 class Utility
Index: pdns/dns.hh
--- pdns/dns.hh	(Revision 867)
+++ pdns/dns.hh	(Arbeitskopie)
@@ -114,7 +114,7 @@
 #ifdef _MSC_VER
 #pragma pack (pop)
 typedef enum  {
         ns_t_invalid = 0,       /* Cookie. */
         ns_t_a = 1,             /* Host address. */
@@ -165,7 +165,7 @@
         ns_t_maila = 254,       /* Transfer mail agent records. */
         ns_t_any = 255,         /* Wildcard match. */
 #ifdef WIN32
 #define BYTE_ORDER 1
 #define LITTLE_ENDIAN 1
Index: pdns/Makefile.am
--- pdns/Makefile.am	(Revision 867)
+++ pdns/Makefile.am	(Arbeitskopie)
@@ -106,7 +106,7 @@
 mtasker.hh syncres.hh recursor_cache.cc recursor_cache.hh dnsparser.cc \
 dnswriter.cc dnswriter.hh dnsrecords.cc dnsrecords.hh rcpgenerator.cc rcpgenerator.hh \
 base64.cc base64.hh zoneparser-tng.cc zoneparser-tng.hh rec_channel.cc rec_channel.hh \
-rec_channel_rec.cc selectmplexer.cc epollmplexer.cc
+rec_channel_rec.cc selectmplexer.cc 
 pdns_recursor_SOURCES += ext/nedmalloc/malloc.c
Index: pdns/dnsrecords.cc
--- pdns/dnsrecords.cc	(Revision 867)
+++ pdns/dnsrecords.cc	(Arbeitskopie)
@@ -243,6 +243,10 @@
 #undef DS
+#ifdef DS
+#undef DS
 boilerplate_conv(DS, 43, 
Index: pdns/mtasker.cc
--- pdns/mtasker.cc	(Revision 867)
+++ pdns/mtasker.cc	(Arbeitskopie)
@@ -248,9 +248,9 @@
   uc->uc_stack.ss_size = d_stacksize;
 #ifdef SOLARIS8
   uc->uc_stack.ss_sp = (void*)(((char*)uc->uc_stack.ss_sp)+d_stacksize);
-  makecontext (uc,(void (*)(...))threadWrapper, 5, this, start, d_maxtid, val);
+  makecontext (uc,(void (*)())threadWrapper, 5, this, start, d_maxtid, val);
-  makecontext (uc, (void (*)(void))threadWrapper, 4, this, start, d_maxtid, val);
+  makecontext (uc,(void (*)(void))threadWrapper, 4, this, start, d_maxtid, val);
   d_runQueue.push(d_maxtid++); // will run at next schedule invocation
Index: pdns/rcpgenerator.hh
--- pdns/rcpgenerator.hh	(Revision 867)
+++ pdns/rcpgenerator.hh	(Arbeitskopie)
@@ -20,11 +20,13 @@
+#include "config.h"
 #include <string>
 #include <stdexcept>
-#if !defined SOLARIS8 && !defined WIN32
-# include <stdint.h>
-#elif defined WIN32
+#include <stdint.h>
+#include <sys/types.h>
 # include "utility.hh"
Index: pdns/distributor.hh
--- pdns/distributor.hh	(Revision 867)
+++ pdns/distributor.hh	(Arbeitskopie)
@@ -21,6 +21,7 @@
+#include "config.h"
 #include <string>
 #include <deque>
 #include <queue>
@@ -38,6 +39,7 @@
 #include "ahuexception.hh"
 #include "arguments.hh"
 #include "statbag.hh"
+#include "utility.hh"
 extern StatBag S;
Index: pdns/dnspcap.hh
--- pdns/dnspcap.hh	(Revision 867)
+++ pdns/dnspcap.hh	(Arbeitskopie)
@@ -10,7 +10,11 @@
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
 #include <netinet/udp.h>
+#if defined(SOLARIS) || defined(SOLARIS10)
+#include <sys/ethernet.h>
 #include <net/ethernet.h>
 #include <vector>
 #include <boost/format.hpp>
 using namespace std;
Index: modules/geobackend/ippreftree.hh
--- modules/geobackend/ippreftree.hh	(Revision 867)
+++ modules/geobackend/ippreftree.hh	(Arbeitskopie)
@@ -5,10 +5,15 @@
  * 	$Id$
+#include "config.h"
 #include <string>
 #include <sys/types.h>
 #include <cstdlib>
 #include <stdint.h>
+#include <sys/types.h>
 using namespace std;

More information about the Pdns-users mailing list