Using mongodb client in C++ project with higher pcre dependency

202 views
Skip to first unread message

Shmerl

unread,
Nov 7, 2011, 5:11:23 PM11/7/11
to mongodb-user
I noticed that mongodb C++ driver has a dependency on pcre. The full
build uses pcre 7.4 for that. Firstly, is it limited to pcre 7.4 only?

Secondly, if my project uses other versions of pcre library (for
example 7.8 or higher), what is the advisable way of using mongodb
client library in that project? And in case if I build the shared
library variant, is there way to tell the linker to statically
include pcre 7.4 in it with hiding and not exporting pcre symbols?

Thanks,

Hillel.

Mathias Stearn

unread,
Nov 7, 2011, 5:35:07 PM11/7/11
to mongod...@googlegroups.com
The client shouldn't have any PCRE dependencies. Is it not working without it for you? What errors are you seeing?

Shmerl

unread,
Nov 7, 2011, 5:49:44 PM11/7/11
to mongodb-user
I downloaded http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-v2.0-latest.tgz
and I'm doing the build as follows (_path_to_boost_ is just a
placeholder for actual path for the snapshot below):

/usr/bin/python2.7 /usr/bin/scons --extrapath=_path_to_boost_

And errors I get are like this:

scons: Reading SConscript files ...
Checking for C library boost_thread-mt... (cached) yes
Checking for C library boost_filesystem-mt... (cached) yes
Checking for C library boost_system-mt... (cached) yes
Checking for C library boost_thread-mt... (cached) yes
scons: done reading SConscript files.
scons: Building targets ...
g++ -o mongo/client/dbclient.o -c -O3 -D_SCONS -DMONGO_EXPOSE_MACROS -
I_path_to_boost_/include -Imongo mongo/client/dbclient.cpp
In file included from mongo/client/../db/cursor.h:23,
from mongo/client/../db/pdfile.h:411,
from mongo/client/dbclient.cpp:19:
mongo/client/../db/matcher.h:24:21: error: pcrecpp.h: No such file or
directory
mongo/client/../db/matcher.h:39: error: 'pcrecpp' was not declared in
this scope
mongo/client/../db/matcher.h:39: error: template argument 1 is invalid
scons: *** [mongo/client/dbclient.o] Error 1
scons: building terminated because of errors.

Mathias Stearn

unread,
Nov 7, 2011, 7:15:50 PM11/7/11
to mongod...@googlegroups.com
Could you open a bug on jira.mongodb.org and link to this case? The client should not depend on pcre. 

As a work around you can comment out or delete #include "../db/pdfile.h" from client/dbclient.cpp. It isn't necessary and is what is causing your issues.

StXh

unread,
Nov 7, 2011, 11:30:08 PM11/7/11
to mongodb-user
I found db/commands.cpp include matcher.h somewhere. And matcher.h
include pcrecpp.h

StXh

unread,
Nov 8, 2011, 12:14:07 AM11/8/11
to mongodb-user
The packages in http://downloads.mongodb.org/cxx-driver/ is not only
source code but also linux binary example clients and all compiled *.o
files. I don't know why to include these. And there is not
mongo_client_lib.cpp in the packages.

Shmerl

unread,
Nov 8, 2011, 10:53:41 AM11/8/11
to mongodb-user
I posted the bug here:
https://jira.mongodb.org/browse/CDRIVER-102

Regards,

Hillel.

Shmerl

unread,
Nov 8, 2011, 12:26:09 PM11/8/11
to mongodb-user
It doesn't seem to me that the client has no dependency on PCRE. Even
if you comment out #include "../db/pdfile.h" from dbclient.cpp there
are also other places:

For example this include sequence:
mongo/db/commands.cpp < mongo/db/replutil.h < mongo/db/repl.h < mongo/
db/oplog.h < mongo/db/clientcursor.h < mongo/db/cursor.h < mongo/db/
matcher.h < pcrecpp.h

seems to break compilation in a lot of places.

Regards,

Hillel.
Reply all
Reply to author
Forward
0 new messages