noizex | 26 Feb 13:15 2012
Picon

C++ drivers for Windows problem (Visual Studio C++ 2010)

Hello,

I tried everything now for few hours and I didnt have any luck
compiling mongodb libraries to use with C++ project. It seems so much
more complex than any library I used so far (and I used a few..) that
I can't really find a solution to my problem.

I tried two ways - compiling from VC2010 solution
(mongo_client_lib.cpp) and compiling with scons - both ways yielded
very different library files (VS2010 version was 21MB  and scons was
140MB - btw where does such a big difference come from?). After adding
library path and .lib file to my project I get following linking
error:

1>LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc100-
mt-1_42.lib'

This error appears with both libraries (obtained from VS2010 and
scons). Its my first library that depends so heavily on boost, till
now I avoided this juggernaut of libraries and was happy,
unfortunately MongoDB is first library I really want to use that uses
it :( Why adding library to my project adds such dependency on boost
libraries? And why does it ask for 'libboost_thread-vc100-mt-1_42.lib'
file, while Boost files I downloaded from Mongo site are 'libboost_*-
vc100-mt-gd-1_42' and 'libboost_*-vc100-mt-s-1_42'?

I really have no idea what to do, should I also link these boost files
to my project? And why scons version takes 140MB and yet it still asks
for some external libraries? I'm not experienced in C++ libraries, I'm
a simple user, I add library and headers and use it in my project, and
(Continue reading)

Tad Marshall | 26 Feb 17:00 2012

Re: C++ drivers for Windows problem (Visual Studio C++ 2010)

Sorry you're having such difficulty.  We know that there are problems
building with the C++ driver and we're trying to make it better.

If you aren't building from our very latest source code, this will be
harder.  If you haven't done this already, you should probably clone
the Git archive onto your build machine.  This is mostly because a lot
of scons work has gone on in the last few months.

I think that scons is building full debugging information directly
into the .lib file while the Visual Studio solution file is creating a
separate .pdb file, and that is why you are seeing the huge difference
in size.

The boost libraries are very sensitive to the exact compiling and
linking options you are using, and the file name of the Boost library
indicates exactly what that library was built for.  This means that a
particular prebuilt Boost library requires your compile options to be
exactly what that library was built for.  The online Boost
documentation has information on the naming convention they use, but
if you don't live and breathe Windows compiling and linking in the
Visual Studio environment you will find it rather hard to read.

In order to give myself additional flexibility in choosing my own
compile and link options (debug versus release, static versus dynamic
linking) I just built every Boost library variation from the source
code.  It sounds nasty, but it's actually fairly well documented and
automated and it doesn't take too horrible an amount of time ... under
an hour on a fast machine.  My "for building MongoDB" Boost universe
(C:\boost) including source code and all libraries used by MongoDB (32-
bit and 64-bit) is about 175 MB on disk.  But the FULL build I did
(Continue reading)

noizex | 27 Feb 17:20 2012
Picon

Re: C++ drivers for Windows problem (Visual Studio C++ 2010)

Hello,

First, thanks for very detailed reply and taking time to investigate
my problem, greatly appreciated :) After your post and additional hour
spent on trying different scenarios, I renamed libraries I had to ones
that were expected by the linked mongoclient.lib and it acutally
worked. It seems that these "-gd-" "-s-" libraries are from debug
then, and the ones that were expected are in release directory - I
just downloaded pre-made Boost from Mongo site so I didn't even know
what its all about, and I wasn't familiar with their naming convention
too.

Once I did it, my application stopped complaining about missing boost
libs, but started throwing "redefined.." errors on various libraries I
used. I googled a bit and found people having these problems, without
solution though. The fix was to use /MT (or similar, can't remember
today) switch when compiling my own application - after doing this it
started to compile just fine.

I already wrote some code for my server and Mongo behaves correctly
filled with data from C++ so it seems to be okay now :)

Thanks once again for help! I'm so relieved now. Of course, as you
said it would be really good to make this a bit more straightforward
so people don't have to go through this frustrating process, and maybe
drop in the middle without figuring it out, but at least its something
that can be solved with a bit of time invested.

K.

(Continue reading)

kolobok | 5 May 22:05 2012
Picon

Re: C++ drivers for Windows problem (Visual Studio C++ 2010)

scons: done reading SConscript files.
scons: Building targets ...
cl /Foclient\examples\authTest.obj /c client\examples\authTest.cpp /TP /nologo /D_SCONS /DMONGO_EXPOSE_MACROS /Imon
go
authTest.cpp
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: Использован обработчик исключ
ений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc
c:\mongo-cxx-driver-v2.0\mongo\client\../pch.h(80) : fatal error C1083: Не удается открыть файл include: boost/thre
ad/once.hpp: No such file or directory
scons: *** [client\examples\authTest.obj] Error 2
scons: building terminated because of errors.

--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/TbWs0DShl8gJ.
To post to this group, send email to mongodb-user-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to mongodb-user+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
Tad Marshall | 5 May 23:06 2012

Re: C++ drivers for Windows problem (Visual Studio C++ 2010)

What version of the MongoDB source code are you using?


What command are you using to build?  Can you post the entire thing ... your command line and all output?

If you are building an older version (not the latest from GitHub), do you have boost installed?

The current code (2.0 and newer) expects Visual Studio 2010.  I doubt that that is the source of your build errors, but it could cause issues later.  The warning about /EHsc could be coming from that, if the default for C++ exceptions changed.  MongoDB code requires that C++ exceptions be enabled.

On Saturday, May 5, 2012 4:05:52 PM UTC-4, kolobok wrote:
scons: done reading SConscript files.
scons: Building targets ...
cl /Foclient\examples\authTest.obj /c client\examples\authTest.cpp /TP /nologo /D_SCONS /DMONGO_EXPOSE_MACROS /Imon
go
authTest.cpp
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: Использован обработчик исключ
ений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc
c:\mongo-cxx-driver-v2.0\mongo\client\../pch.h(80) : fatal error C1083: Не удается открыть файл include: boost/thre
ad/once.hpp: No such file or directory
scons: *** [client\examples\authTest.obj] Error 2
scons: building terminated because of errors.

--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/Et92LdOEAukJ.
To post to this group, send email to mongodb-user-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to mongodb-user+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Gmane