Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-29511

MongoDB failed to build due to error C2512: 'boost::unordered::unordered_set<mongo::LogicalSessionId,mongo::LogicalSessionId::Hash,std::equal_to<T>,std::allocator<T>>': no appropriate default constructor available

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • 3.5.9
    • Affects Version/s: None
    • Component/s: Build
    • None
    • Fully Compatible
    • ALL
    • Hide

      *Environment: *
      Windows Sever 2012 R2 + VS2015 Update 3 + MongoDB master branch latest revision

      Reproduce steps:
      1. git clone -c core.autocrlf=true https://github.com/mongodb/mongo D:\MongoDB\src
      2. Open a VS 2015 x64 command prompt and browse to D:\MongoDB\src
      3. pip.exe install -r .\buildscripts\requirements.txt
      4. scons all -j4

      Acutal result:
      src\mongo\db\logical_session_cache_test.cpp(247): error C2512: 'boost::unordered::unordered_set<mongo::LogicalSessionId,mongo::LogicalSessionId::Hash,std::equal_to<T>,std::allocator<T>>': no appropriate default constructor available
      with
      [
      T=mongo::LogicalSessionId
      ]
      src\mongo\db\logical_session_cache_test.cpp(247): note: Constructor for class 'boost::unordered::unordered_set<mongo::LogicalSessionId,mongo::LogicalSessionId::Hash,std::equal_to<T>,std::allocator<T>>' is declared 'explicit'
      with
      [
      T=mongo::LogicalSessionId
      ]
      scons: *** [build\opt\mongo\db\logical_session_cache_test.obj] Error 2

      Show
      *Environment: * Windows Sever 2012 R2 + VS2015 Update 3 + MongoDB master branch latest revision Reproduce steps: 1. git clone -c core.autocrlf=true https://github.com/mongodb/mongo D:\MongoDB\src 2. Open a VS 2015 x64 command prompt and browse to D:\MongoDB\src 3. pip.exe install -r .\buildscripts\requirements.txt 4. scons all -j4 Acutal result: src\mongo\db\logical_session_cache_test.cpp(247): error C2512: 'boost::unordered::unordered_set<mongo::LogicalSessionId,mongo::LogicalSessionId::Hash,std::equal_to<T>,std::allocator<T>>': no appropriate default constructor available with [ T=mongo::LogicalSessionId ] src\mongo\db\logical_session_cache_test.cpp(247): note: Constructor for class 'boost::unordered::unordered_set<mongo::LogicalSessionId,mongo::LogicalSessionId::Hash,std::equal_to<T>,std::allocator<T>>' is declared 'explicit' with [ T=mongo::LogicalSessionId ] scons: *** [build\opt\mongo\db\logical_session_cache_test.obj] Error 2

      MongoDB failed to buid due to error C2512: 'boost::unordered::unordered_set<mongo::LogicalSessionId,mongo::LogicalSessionId::Hash,std::equal_to<T>,std::allocator<T>>': no appropriate default constructor available. This issue is caused by revision 4c3337ahttps://github.com/mongodb/mongo/commit/4c3337abe512a37c8e4cb22e16eafcd04bc5bd3a Could you pleaes help to take a look at this? Thanks in advance!

      Some investigate on my side:
      The related code in logical_seesion_cache_test.cpp
      stdx::promise<int> hitRefresh;
      auto refreshFuture = hitRefresh.get_future();

      // Advance time to first refresh point, check that refresh happens, and
      // that it includes both our records
      sessions()->setRefreshHook([&hitRefresh](LogicalSessionIdSet sessions) -> LogicalSessionIdSet {
      hitRefresh.set_value(sessions.size());
      return {};
      });

      If we change the code as below. There is no error reported.
      stdx::promise<int> hitRefresh;*
      to
      stdx::promise<LogicalSessionId> hitRefresh;*

        1. mongodb_x64_build.log
          4.04 MB
          KarenHuang [X]

            Assignee:
            Unassigned Unassigned
            Reporter:
            KarenHuang2017 KarenHuang [X]
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: