07.01.2014 01:46, Viacheslav Dubrovskyi пишет:

Hi Paolo,

I took last version 0.8.1 from https://github.com/mongodb/mongo-c-driver-legacy.git, built it. And the error remains.
It seems this is a bug in mongo-c-driver. In mongo.h they have not changed
#define MONGO_MAJOR 0
#define MONGO_MINOR 7
#define MONGO_PATCH 0

So I use patch:
diff --git a/src/mongo.h b/src/mongo.h
index d596a84..70bdf49 100644
--- a/src/mongo.h
+++ b/src/mongo.h
@@ -33,8 +33,8 @@ MONGO_EXTERN_C_START
 #endif

 #define MONGO_MAJOR 0
-#define MONGO_MINOR 7
-#define MONGO_PATCH 0
+#define MONGO_MINOR 8
+#define MONGO_PATCH 1

 #define MONGO_OK 0
 #define MONGO_ERROR -1

And pmacct built successfully.

I think you need to give use MONGO_MINOR and focus on the latest version.

07.01.2014 01:27, Paolo Lucente пишет:
Hi Slava,

This is strange since you have installed version 0.7 of the MongoDB API
(which is when they increased by one the amount of parameters needed to
invoke function mongo_create_index which is, in turn, why the 'too many
arguments' error appears wrong). It would be beneficial if you could
offer remote-access to get this specific issue looked into. I propose
to continue this off-list.
Ok. But tomorrow. I go to sleep today.

In /usr/include/mongo.h https://github.com/mongodb/mongo-c-driver-legacy/blob/v0.7.1/src/mongo.h#L668 I see:

 * Create a compound index.
 *
 * @param conn a mongo object.
 * @param ns the namespace.
 * @param data the bson index data.
* @param options a bitfield for setting index options. Possibilities include
 *   MONGO_INDEX_UNIQUE, MONGO_INDEX_DROP_DUPS, MONGO_INDEX_BACKGROUND,
 *   and MONGO_INDEX_SPARSE.
 * @param out a bson document containing errors, if any.
 *
* @return MONGO_OK if index is created successfully; otherwise, MONGO_ERROR.
 */
MONGO_EXPORT int mongo_create_index( mongo *conn, const char *ns,
const bson *key, int options, bson *out );

So, should be 5 arguments.

In last https://github.com/mongodb/mongo-c-driver-legacy/blob/master/src/mongo.h#L703 there are 7 arguments MONGO_EXPORT int mongo_create_index( mongo *conn, const char *ns, const bson *key, const char *name, int options, int ttl, bson *out );

In mongodb_plugin.c :
#if MONGO_MAJOR <= 0 && MONGO_MINOR <= 7
          mongo_create_index(db_conn, table, idx_key, NULL, 0, NULL);
#else
          mongo_create_index(db_conn, table, idx_key, NULL, 0, -1, NULL);
#endif

For 0.7 you call with 6 arguments.
So, I get 'too many arguments' error.


Cheers,
Paolo

On Tue, Jan 07, 2014 at 01:06:26AM +0200, Viacheslav Dubrovskyi wrote:
07.01.2014 00:20, Paolo Lucente пишет:
Hi Slava,
Hi Paolo,

Get another error:

mongodb_plugin.c:739:4: warning: passing argument 4 of
'mongo_create_index' makes integer from pointer without a cast
[enabled by default]
In file included from mongodb_plugin.h:29:0,
                  from mongodb_plugin.c:29:
/usr/include/mongo.h:668:18: note: expected 'int' but argument is of
type 'void *'
mongodb_plugin.c:739:4: error: too many arguments to function
'mongo_create_index'
In file included from mongodb_plugin.h:29:0,
                  from mongodb_plugin.c:29:
/usr/include/mongo.h:668:18: note: declared here
mongodb_plugin.c:724:7: warning: unused variable 'ret' [-Wunused-variable] mongodb_plugin.c:720:21: warning: unused variable 'out' [-Wunused-variable]
In file included from mongodb_plugin.c:26:0:
mongodb_plugin.c: At top level:
pmacct-data.h:241:20: warning: 'cps_type' defined but not used
[-Wunused-variable]
In file included from mongodb_plugin.c:34:0:
crc32.c:49:21: warning: 'crc_32_tab' defined but not used
[-Wunused-variable]
crc32.c:84:21: warning: '__crc32' defined but not used [-Wunused-variable]
thread_pool.c: In function 'desallocate_thread_pool':
thread_pool.c:132:12: warning: 'worker' may be used uninitialized in
this function [-Wmaybe-uninitialized]
gmake[2]: *** [pmacctd] Error 1
gmake[2]: Leaving directory `/usr/src/RPM/BUILD/pmacct-0.15.0/src'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/src/RPM/BUILD/pmacct-0.15.0/src'
make: *** [all-recursive] Error 1
make: Leaving directory `/usr/src/RPM/BUILD/pmacct-0.15.0'
error: Bad exit status from /usr/src/tmp/rpm-tmp.64223 (%build)


[builder@localhost ~]$ rpm -qa | grep mongo
libmongoc-0.7.1-alt1
libmongoc-devel-0.7.1-alt1




--
WBR,
Viacheslav Dubrovskyi


Attachment: smime.p7s
Description: Криптографическая подпись S/MIME

_______________________________________________
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists

Reply via email to