[SERVER-11325] mongoclient fails to compile with Visual C++ 2008 SP1 Created: 23/Oct/13  Updated: 22/Jan/20  Resolved: 07/Nov/13

Status: Closed
Project: Core Server
Component/s: Internal Client
Affects Version/s: 2.4.7
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Balint Szente Assignee: Andrew Morrow (Inactive)
Resolution: Won't Fix Votes: 0
Labels: cstdint, eaddrinuse, econnaborted, errno
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows XP SP3, Visual C++ 2008 SP1, Boost 1.46.1


Operating System: Windows
Steps To Reproduce:

Just issue the command:

scons mongoclient --release --use-system-boost --cpppath="C:\Program Files\Boost\boost_1_46_1" --libpath="C:\Program Files\Boost\boost_1_46_1\lib" --boost-compiler=vc90 --boost-version=1_46_1

Result:

scons: Reading SConscript files ...
scons version: 2.3.0
python version: 2 7 3 'final' 0
found visual studio at c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
Windows SDK Root 'C:/Program Files/Microsoft SDKs/Windows/v6.0a'
Checking whether the C++ compiler works(cached) yes
Checking for C++ header file boost/filesystem/operations.hpp... (cached) yes
Checking for C++ library boost_thread-vc90-mt-1_46_1... (cached) yes
Checking for C++ library boost_filesystem-vc90-mt-1_46_1... (cached) yes
Checking for C++ library boost_program_options-vc90-mt-1_46_1... (cached) yes
Checking for C++ library boost_system-vc90-mt-1_46_1... (cached) yes
Checking for C header file unistd.h... (cached) no
Checking whether clock_gettime is declared... (cached) no
Checking for C++ header file execinfo.h... (cached) no
Checking for C library pcap... (cached) no
Checking for C library wpcap... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
...
C:\lib\mongodb\mongo\src\mongo/platform/cstdint.h(24) : fatal error C1083: Cannot open include file: 'cstdint': No such file or directory
scons: *** [build\win32\cpppath_C__Program Files_Boost_boost_1_46_1\libpath_C__P rogram
Files_Boost_boost_1_46_1_lib\release\use-system-boost\client_build\mongo\base\parse_number.obj] Error 2
scons: building terminated because of errors.

One possible (ugly) workaround:

  1. Use https://code.google.com/p/msinttypes/
  2. Modify src\mongo\platform\cstdint.h in the following way:

    ...
    #if defined(_MSC_VER)
    #include <stdint.h>
    #define _MONGO_STDINT_NAMESPACE
    #elif defined(__GNUC__)
    ...


Next, there are 2 undefined macros in src\mongo\util\net\listen.cpp: EADDRINUSE and ECONNABORTED. Both of them were added to errno.h in Visual C++ 2010. But they must be defined for 2008.

Quick and very dirty workaround: modify src\mongo\util\net\listen.cpp in the following way:

...
#undef errno
#define errno WSAGetLastError()
#define EADDRINUSE   100
#define ECONNABORTED 106
 
#endif
 
namespace mongo {
...

By fixing these two issues, the c++ driver can be compiled successfully.

Participants:

 Description   

The mongoclient c++ library does not compile with Visual C++ 2008.



 Comments   
Comment by Andrew Morrow (Inactive) [ 07/Nov/13 ]

I'm closing this as 'wontfix' since we do not plan to support 2008.

The VC version check in the SConstruct file is a good suggestion though, and I've filed SERVER-11621 as an enhancement ticket so we keep it on the roadmap.

Comment by Balint Szente [ 07/Nov/13 ]

Hello!

Thanks for your reply. I understand. In the mean time we switched to VS2012.
Maybe you can document explicitly, that VC++ 2008 is not supported anymore, or better, a VC++ version check in SConstruct file.

Thanks,
Balint

Comment by Andrew Morrow (Inactive) [ 06/Nov/13 ]

Hi -

Building the client driver with VS2008 is not currently supported, for either the 2.4 release series or the 2.5 release series driver. It is unlikely that we will add VS2008 support to 2.5 or backport that support to 2.4. However, we believe that a driver built with a newer version of visual studio should be usable in a VS2008 project, since the issues you have identified are only visible at .cpp scope. We intend to validate this arrangement (build with VS2010+, use in VS2008) as part of the 2.5 release cycle.

Please let us know if you have any questions or if there is anything more we can help with, otherwise we will be closing this ticket as 'wont fix'.

Thanks,
Andrew

Generated at Thu Feb 08 03:25:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.