1

I was trying to compile the mongodbbackend module for powerdns but I'm stuck with this problem:

In file included from mongodbbackend.cc:18:
mongodbbackend.hh: At global scope:
mongodbbackend.hh:109: error: ISO C++ forbids declaration of ‘auto_ptr’ with no type
mongodbbackend.hh:109: error: expected unqualified-id before ‘<’ token
make[3]: *** [mongodbbackend.lo] Error 1
make[3]: Leaving directory `/root/pdns-3.0.1/modules/mongodbbackend'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/root/pdns-3.0.1/modules'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/pdns-3.0.1'
make: *** [all] Error 2

I tried to include files from mongodb 2.0.2 and 2.0.3. Here are the module sources: http://wiki.powerdns.com/trac/browser/trunk/pdns/modules/mongodbbackend

Any suggestions?

Bach
  • 6,145
  • 7
  • 36
  • 61
shoen
  • 11,845
  • 4
  • 22
  • 27
  • Are you sure this is where the errors start? No errors right above it, like "error: client/dbclient.h: No such file or directory" ? – Habbie Feb 23 '12 at 06:16

3 Answers3

2

The post from Ruben is my anonymous/non-account post. I didn't look at the formatting so the post is a little messed up.

The compiler error you have can be overcome by adding:

#include<memory>

And changing line 109 from:

auto_ptr<mongo::DBClientCursor> cursor;

to

std::auto_ptr<mongo::DBClientCursor> cursor;

This, however, causes other errors on my end (see http://pastebin.com/Wm60JCDu). It might work for you though :-)

It would be helpful if you provide more info about your environment (distro, what version of mangodb and the used mango driver).

cyclops
  • 64
  • 2
  • Hi, thanks for the tip, that fixed the problem :) but other issues appeared: http://pastebin.com/ThRZ4pP1 i'm using debian squeeze with mongodb 2.0.2 – shoen Feb 23 '12 at 08:45
  • The issues i have are with debian squeeze and the out of the box mongodb. – cyclops Feb 23 '12 at 09:03
  • From the error you are getting, it seems it has to do with the version of Mongo. I don't know which version of mongodb the author of the mongodbbackend is intending to use. I suggest asking him about that. (see README in the mongodbbackend folder) – cyclops Feb 23 '12 at 09:09
1

The compile error you have can be overcome by adding:

#include<memory>

and changing

auto_ptr<mongo::DBClientCursor> cursor;

to

std::auto_ptr<mongo::DBClientCursor> cursor;

around line 108/109/110 in mangobackend.hh

It might work for you, but I think it is heavily depending on the mangodb-api you're using.

It would be helpfull if you provide more info around your environment (distro, version of mango, etc)

Aliaksei Kliuchnikau
  • 13,589
  • 4
  • 59
  • 72
Ruben
  • 11
  • 1
1

Can you try this patch?

diff --git a/modules/mongodbbackend/mongodbbackend.hh b/modules/mongodbbackend/mongodbbackend.hh index 816128f..4f7cf78 100644 --- a/modules/mongodbbackend/mongodbbackend.hh +++ b/modules/mongodbbackend/mongodbbackend.hh @@ -1,13 +1,13 @@ #ifndef MONGODB_HH #define MONGODB_HH

+#include "client/dbclient.h"
 #include "pdns/dnsbackend.hh"

 #undef VERSION
 #include <string>
 using std::string;
-
-#include "client/dbclient.h"
+using std::auto_ptr;

 class MONGODBException {
 public:

It's in https://github.com/azlev/powerdns/commit/a402d8493e5610e139ea19a9ef700e26b2e6e35c

  • Hi, it worked! compiled successfully with mongodb 2.0.3 pdns started and successfully connected :) i'll make some test now, thanks for the help! – shoen Mar 04 '12 at 19:37