[SERVER-24010] error C2248: 'mongo::BSONObjBuilder::BSONObjBuilder': cannot access private member declared in class 'mongo::BSONObjBuilder' Created: 02/May/16  Updated: 09/May/16  Resolved: 09/May/16

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: 3.2.5
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: George Thompson Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Platforms 14 (05/13/16)
Participants:

 Description   

Windows 10
Visual Studio 2015 Express
scons 2.3.6 (required for VS 2015)
ActiveState ActivePython 2.7.10.12 (64 bit)
MongoDB source r3.2.5

Building from scource.

Built scons via c:\python27\python.exe setup.py install.

Developer Command Prompt and ran:

%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\vc\bin\amd64\vcvars64.bat

scons --64bit gave me this error:

SCons Error: no such option: --64bit

So, "scons all" gave me this:

scons all
scons: Reading SConscript files ...
scons version: 2.3.6
python version: 2 7 10 'final' 0
Checking whether the C++ compiler works... (cached) yes
Checking whether the C compiler works... (cached) yes
Checking if C++ compiler "$CC" is MSVC... (cached) yes
Checking if C compiler "cl" is MSVC... (cached) yes
Detected a x86_64 processor
Checking if target OS windows is supported by the toolchain (cached) yes
Checking if C compiler is Microsoft Visual Studio 2013 Update 4 or newer...(cached) yes
Checking if C++ compiler is Microsoft Visual Studio 2013 Update 4 or newer...(cached) yes
Checking if we are using libstdc++... (cached) no
Checking for C++11... (cached) yes
Checking for memset_s... (cached) no
Checking for C function strnlen()... yes
Checking Windows SDK is 8.1 or newer... (cached) yes
Checking if we are on a POSIX system... (cached) no
Checking for storage class thread_local yes
Checking for storage class __thread (cached) no
Checking for storage class __declspec(thread) yes
Checking for C++11 is_trivially_copyable support... (cached) yes
Checking for C++14 std::make_unique support... (cached) yes
Checking for C++ header file execinfo.h... (cached) no
Checking for C library pcap... no
Checking for C library wpcap... no
Checking if std::atomic<int64_t> works... yes
Checking if std::atomic<uint64_t> works... yes
Checking if std::atomic<int32_t> works... yes
Checking if std::atomic<uint32_t> works... yes
Checking if __malloc_hook is declared volatile... (cached) yes
Checking for C function fallocate()... no
Checking for C function sync_file_range()... no
Checking for C header file x86intrin.h... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
C:\Python27\python.exe src\mongo\base\generate_error_codes.py cpp src\mongo\base\error_codes.err --cpp-header=build\opt\mongo\base\error_codes.h --cpp-source=build\opt\mongo\base\error_codes.cpp
C:\Python27\python.exe src\mongo\db\auth\generate_action_types.py src\mongo\db\auth\action_types.txt build\opt\mongo\db\auth\action_type.h build\opt\mongo\db\auth\action_type.cpp
C:\Python27\python.exe src\mongo\db\fts\generate_stop_words.py src\mongo\db\fts\stop_words_danish.txt src\mongo\db\fts\stop_words_dutch.txt src\mongo\db\fts\stop_words_english.txt src\mongo\db\fts\stop_words_finnish.txt src\mongo\db\fts\stop_words_french.txt src\mongo\db\fts\stop_words_german.txt src\mongo\db\fts\stop_words_hungarian.txt src\mongo\db\fts\stop_words_italian.txt src\mongo\db\fts\stop_words_norwegian.txt src\mongo\db\fts\stop_words_portuguese.txt src\mongo\db\fts\stop_words_romanian.txt src\mongo\db\fts\stop_words_russian.txt src\mongo\db\fts\stop_words_spanish.txt src\mongo\db\fts\stop_words_swedish.txt src\mongo\db\fts\stop_words_turkish.txt build\opt\mongo\db\fts\stop_words_list.h build\opt\mongo\db\fts\stop_words_list.cpp
header: build\opt\mongo\db\fts\stop_words_list.h
source: build\opt\mongo\db\fts\stop_words_list.cpp
language_files:
src\mongo\db\fts\stop_words_danish.txt
src\mongo\db\fts\stop_words_dutch.txt
src\mongo\db\fts\stop_words_english.txt
src\mongo\db\fts\stop_words_finnish.txt
src\mongo\db\fts\stop_words_french.txt
src\mongo\db\fts\stop_words_german.txt
src\mongo\db\fts\stop_words_hungarian.txt
src\mongo\db\fts\stop_words_italian.txt
src\mongo\db\fts\stop_words_norwegian.txt
src\mongo\db\fts\stop_words_portuguese.txt
src\mongo\db\fts\stop_words_romanian.txt
src\mongo\db\fts\stop_words_russian.txt
src\mongo\db\fts\stop_words_spanish.txt
src\mongo\db\fts\stop_words_swedish.txt
src\mongo\db\fts\stop_words_turkish.txt
C:\Python27\python.exe src\mongo\db\fts\unicode\gen_casefold_map.py src\third_party\unicode-8.0.0\CaseFolding.txt build\opt\mongo\db\fts\unicode\codepoints_casefold.cpp
C:\Python27\python.exe src\mongo\db\fts\unicode\gen_delimiter_list.py src\third_party\unicode-8.0.0\PropList.txt build\opt\mongo\db\fts\unicode\codepoints_delimiter_list.cpp
C:\Python27\python.exe src\mongo\db\fts\unicode\gen_diacritic_list.py src\third_party\unicode-8.0.0\PropList.txt build\opt\mongo\db\fts\unicode\codepoints_diacritic_list.cpp
cl /Fobuild\opt\mongo\scripting\mozjs\bindata.obj /c src\mongo\scripting\mozjs\bindata.cpp /TP /nologo /EHsc /W3 /wd4355 /wd4800 /wd4267 /wd4244 /wd4290 /wd4068 /wd4351 /we4013 /we4099 /we4930 /Z7 /errorReport:none /MT /O2 /Oy- /Gw /Gy /Zc:inline /FI js-config.h /FI js/RequiredDefines.h /DJS_USE_CUSTOM_ALLOCATOR /DSTATIC_JS_API=1 /DPCRE_STATIC /DNDEBUG /DBOOST_ALL_NO_LIB /D_UNICODE /DUNICODE /D_CONSOLE /D_CRT_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0600 /DNTDDI_VERSION=0x06000000 /DBOOST_THREAD_VERSION=4 /DBOOST_THREAD_DONT_PROVIDE_VARIADIC_THREAD /DBOOST_SYSTEM_NO_DEPRECATED /DBOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS /DBOOST_THREAD_HAS_NO_EINTR_BUG /Isrc\third_party\mozjs-38\include /Isrc\third_party\mozjs-38\mongo_sources /Isrc\third_party\mozjs-38\platform\x86_64\windows\include /Isrc\third_party\asio-asio-1-11-0\asio\include /Isrc\third_party\s2 /Isrc\third_party\pcre-8.37 /Isrc\third_party\boost-1.56.0 /Ibuild\opt /Isrc /Z7
bindata.cpp
C:\mongoDB\src\third_party\boost-1.56.0\boost/type_traits/is_nothrow_move_constructible.hpp(40): error C2248: 'mongo::BSONObjBuilder::BSONObjBuilder': cannot access private member declared in class 'mongo::BSONObjBuilder'
C:\mongoDB\src\mongo/bson/bsonobjbuilder.h(61): note: see declaration of 'mongo::BSONObjBuilder::BSONObjBuilder'
C:\mongoDB\src\mongo/scripting/mozjs/objectwrapper.h(44): note: see declaration of 'mongo::BSONObjBuilder'
C:\mongoDB\src\third_party\boost-1.56.0\boost/type_traits/is_nothrow_move_constructible.hpp(45): note: see reference to class template instantiation 'boost::detail::false_or_cpp11_noexcept_move_constructible<T,void>' being compiled
with
[
T=mongo::BSONObjBuilder
]
C:\mongoDB\src\third_party\boost-1.56.0\boost/type_traits/is_nothrow_move_constructible.hpp(80): note: see reference to class template instantiation 'boost::detail::is_nothrow_move_constructible_imp<T>' being compiled
with
[
T=mongo::BSONObjBuilder
]
C:\mongoDB\src\third_party\boost-1.56.0\boost/optional/optional.hpp(854): note: see reference to class template instantiation 'boost::is_nothrow_move_constructible<T>' being compiled
with
[
T=mongo::BSONObjBuilder
]
C:\mongoDB\src\mongo/scripting/mozjs/objectwrapper.h(206): note: see reference to class template instantiation 'boost::optional<mongo::BSONObjBuilder>' being compiled
C:\mongoDB\src\third_party\boost-1.56.0\boost/type_traits/is_nothrow_move_constructible.hpp(40): error C2280: 'mongo::BSONObjBuilder::BSONObjBuilder(const mongo::BSONObjBuilder &)': attempting to reference a deleted function
C:\mongoDB\src\mongo/bson/bsonobjbuilder.h(61): note: see declaration of 'mongo::BSONObjBuilder::BSONObjBuilder'
scons: *** [build\opt\mongo\scripting\mozjs\bindata.obj] Error 2
scons: building terminated because of errors.



 Comments   
Comment by George Thompson [ 09/May/16 ]

Thank you for all your help Andrew.

Comment by Andrew Morrow (Inactive) [ 09/May/16 ]

therefore - I'd like to close this ticket, it doesn't really belong in the SERVER project. If you need further help, please either:

Comment by Andrew Morrow (Inactive) [ 09/May/16 ]

Great - I really do think that is the right choice, but I would also understand if you felt that you needed to stay with the older driver. To answer your questions:

  • You can absolutely use the C++11 driver (built from the master branch of the mongo-cxx-repo) to communicate with a MongoDB 3.2 server. It should actually support MongoDB back to 2.4, I believe. To do so however you will need to have both VS2013 and VS2015 installed side by side, since the MongoDB server v3.2 branch requires VS2013 and cannot build with VS2015, and the C++11 driver require VS2015 and cannot build with VS2013. I believe though that it is possible to have both installed.
  • We do not currently have dedicated instructions for Windows builds of the C++11 driver, however, the process should be nearly identical to those for the C driver. In both cases, you are using CMake to generate a VS solution and then invoking the build with msbuild.exe. If you would like to see how our automated Windows builds work on Appveyor, you can read this file: https://github.com/mongodb/mongo-cxx-driver/blob/master/appveyor.yml

Finally, one comment - we do currently consider the C++11 driver to be stable as of its 3.0.0 release. We are however aware of bugs that will require us to make some small API changes in the 3.0.x release series. For the most part, these should be extremely minor, but we are not committing to not breaking API in the 3.0.x series. We are planning a 3.1.x release series this summer that will focus on build system improvements and prepare the way for a future declaration of ABI stability. Finally, we will need to introduce support for MongoDB 3.4 later this year. We hope to do that for a C++11 driver 3.2.x release series, at which point we will declare both API and ABI stability for the driver.

I also recommend that you look at the C++11 driver roadmap to understand what issues are currently known to exist and what changes we have planned:

Comment by George Thompson [ 09/May/16 ]

Andrew Marrow –

Thanks for the overview. I want to use the newest C++11 driver and intend to rewrite all of our 2.2 code and understand the risk of doing development while you are also developing the driver.

My two questions:

Should I be using the master branch of the mongoDB code and use MS VS 2015 and not use the r3.2.5 as it only uses MS VS 2013 to compile? I.e., is the C++11 driver not for r3.2.5 but for the master branch, r3.3.5?

And are there Windows specific instructions for installing the C++11 driver? https://github.com/mongodb/mongo-cxx-driver/wiki/Quickstart-Guide-%28New-Driver%29 appears to be unix specific. The c driver instructions at https://api.mongodb.com/c/current/installing.html#building-windows includes windows-specific instructions which worked well.

Comment by Andrew Morrow (Inactive) [ 09/May/16 ]

therefore -

I think you will find the following blogs post helpful to understand what has happened with the C++ driver since you last used it:

http://blog.mongodb.org/post/78478565493/upcoming-changes-to-the-mongodb-cpp-driver
https://www.mongodb.com/blog/post/introducing-legacy-c-driver-10
https://www.mongodb.com/blog/post/introducing-new-c-driver

The short version is that the C++ driver no longer builds from the server sources as of MongoDB 2.6, and is instead hosted here:

https://github.com/mongodb/mongo-cxx-driver

There are three branches:

  • 26compat: A drop-in replacement for the C++ driver as it existed in the server sources right before it was removed, around the time MongoDB 2.6 shipped.
  • legacy: A much improved and expanded version of the C++ driver, mostly compatible with the old API, but with some necessary changes (and a huge number of bugfixes) applied, but which is unlikely to see new feature development beyond those added for MongoDB 3.2 support.
  • master: A new ground up re-write sharing no commonalities with the older drivers, implemented above the MongoDB C driver, which requires C++11 and makes extensive use of modern C++ idioms.

So, you have some choices. If you have code that worked with the MongoDB 2.2 vintage C++ driver, the 26compat driver is most likely to just work. But, it receives effectively no real maintenance or testing. Since you are likely to need to make changes to your code anyway, it might make sense to go to the legacy branch instead. The only major incompatibility is that the legacy driver does not offer a connection pool. However, both of these choices set you up for future problems, since we will at some point in the not too distant future start the process to deprecate and then EOL both the 26compat and legacy drivers. If moving to C++11 is an option for you, and you can undertake a re-write, the C++11 driver is a much improved environment. However, it is also the newest C++ driver and is under active development. Finally, you can consider using the straight C driver if all of the above choices are unpalatable.

Please let me know if there are any questions I can answer to help clarify.

Comment by George Thompson [ 08/May/16 ]

Mark – I want to use the new c++ 11 driver. According to:

https://github.com/mongodb/mongo-cxx-driver/wiki/Quickstart-Guide-%28New-Driver%29

VC2015 Update 1+ is required. Is that because 3.2.x releases don't use the new c++ driver? I.e., I should switch to master to use the new c++ driver (and therefore reinstall VS2015 and install the most recent development mongoDB)?

Are there windows specific build and installation instructions for the new c++ driver? https://github.com/mongodb/mongo-cxx-driver/wiki/Quickstart-Guide-%28New-Driver%29 appears to be unix specific. The c driver instructions at https://api.mongodb.com/c/current/installing.html#building-windows include windows-specific instructions which worked.

I have a ton of two+ year old mongoDB 2.2.0 code to rewrite for the new API. This is non-production code as we put it on the back burner after hitting a serious mongoDB bug that has been subsequently fixed.

Comment by George Thompson [ 03/May/16 ]

Thank you Mark for the quick response. I installed VS 2013 Update 5 and things are compiling.

Comment by Mark Benvenuto [ 02/May/16 ]

Building 3.2.x releases requires VS 2013 Update 4 at this time. We recently moved master to VS 2015 Update 2. We have not decided whether to support VS 2015 Update 2 on 3.2.x as there are several incompatibilities.

Generated at Thu Feb 08 04:05:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.