Compiling PowerDNS 2.9.22 with GCC 4.4
If you get errors like this when compiling PowerDNS 2.9.22 on a recent server:
if g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I../.. -pthread -D_GNU_SOURCE -Wall -O2 -MT rcpgenerator.o -MD -MP -MF ".deps/rcpgenerator.Tpo" -c -o rcpgenerator.o `test -f '../../rcpgenerator.cc' || echo './'`../../rcpgenerator.cc; \
then mv -f ".deps/rcpgenerator.Tpo" ".deps/rcpgenerator.Po"; else rm -f ".deps/rcpgenerator.Tpo"; exit 1; fi
../../rcpgenerator.cc: In member function ‘void RecordTextReader::xfrTime(uint32_t&)’:
../../rcpgenerator.cc:75: error: ‘sscanf’ was not declared in this scope
../../rcpgenerator.cc: In member function ‘void RecordTextWriter::xfrTime(const uint32_t&)’:
../../rcpgenerator.cc:363: error: ‘snprintf’ was not declared in this scope
../../rcpgenerator.cc: In member function ‘void RecordTextWriter::xfrHexBlob(const std::string&)’:
../../rcpgenerator.cc:415: error: ‘snprintf’ was not declared in this scope
make[4]: *** [rcpgenerator.o] Error 1
Then you are most likely using a recent GCC to compile.
For instance:
# gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.1-4ubuntu8' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu8)
This most likely is the case if you for instance run Ubuntu 9.10 but possibly not limited to Ubuntu. You’ll probably run in to this error if on any recent distribution (like CentOS) that runs GCC 4.4
To fix this problem change the content of pdns/misc.hh
From:
#ifndef MISC_HH
#define MISC_HH
#include <stdint.h>
#include <cstring>
To:
#ifndef MISC_HH
#define MISC_HH
#include <stdint.h>
#include <cstring>
#include <cstdio>
And try to compile again.. It definetly worked for me…
U kunt reacties op dit bericht volgen via de RSS 2.0 feed. U kunt een bericht achterlaten, of een trackback geven op uw eigen site.


