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

MongoDB failed to buid due to C2039 C2275 C2059 C3536 and C2440 on MSVC

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Build
    • Labels:
      None
    • Environment:
      VS 2017 + Windows Server 2016 + MongoDB master branch latest revision
    • ALL
    • Hide

      Reproduce steps:
      1. git clone -c core.autocrlf=true https://github.com/mongodb/mongo D:\MongoDB\src
      2. Open a VS 2017 x64 command prompt and browse to D:\MongoDB\src
      3. Download the attachments and apply all patches for MongoDB.
      4. pip.exe install -r .\buildscripts\requirements.txt
      5. set CL=/wd4756 /wd4056
      6. scons all -j4 CXXFLAGS="/wd4756 /wd4056"

       

      Acutal result:
      service_context.cpp
      D:\MongoDB\src\src\mongo/util/future.h(1726): error C2039: 'make_intrusive': is not a member of 'mongo::future_details'
      D:\MongoDB\src\src\mongo/util/future.h(55): note: see declaration of 'mongo::future_details'
      D:\MongoDB\src\src\mongo/util/future.h(1722): note: while compiling class template member function 'mongo::future_details::SharedSemiFuture<T> mongo::future_details::Future<T>::share(void) noexcept &&'
      with
      [
      T=mongo::future_details::FakeVoid
      ]
      D:\MongoDB\src\src\mongo/util/future.h(1732): note: see reference to function template instantiation 'mongo::future_details::SharedSemiFuture<T> mongo::future_details::Future<T>::share(void) noexcept &&' being compiled
      with
      [
      T=mongo::future_details::FakeVoid
      ]
      D:\MongoDB\src\src\mongo/util/future.h(1423): note: see reference to class template instantiation 'mongo::future_details::Future<mongo::future_details::FakeVoid>' being compiled
      D:\MongoDB\src\src\mongo/util/future.h(1726): error C2275: 'mongo::future_details::SharedState<mongo::future_details::FakeVoid>': illegal use of this type as an expression
      D:\MongoDB\src\src\mongo/util/future.h(1726): note: see declaration of 'mongo::future_details::SharedState<mongo::future_details::FakeVoid>'
      D:\MongoDB\src\src\mongo/util/future.h(1726): error C2059: syntax error: ')'
      D:\MongoDB\src\src\mongo/util/future.h(1727): error C3536: 'shared': cannot be used before it is initialized
      D:\MongoDB\src\src\mongo/util/future.h(1728): error C2440: '<function-style-cast>': cannot convert from 'int' to 'mongo::future_details::SharedSemiFuture<T>'
      with
      [
      T=mongo::future_details::FakeVoid
      ]
      D:\MongoDB\src\src\mongo/util/future.h(1728): note: No constructor could take the source type, or constructor overload resolution was ambiguous
      scons: *** [build\opt\mongo\db\operation_context.obj] Error 2

       


      • Acutal result:
      Show
      Reproduce steps: 1. git clone -c core.autocrlf=true https://github.com/mongodb/mongo D:\MongoDB\src 2. Open a VS 2017 x64 command prompt and browse to D:\MongoDB\src 3. Download the attachments and apply all patches for MongoDB. 4. pip.exe install -r .\buildscripts\requirements.txt 5. set CL=/wd4756 /wd4056 6. scons all -j4 CXXFLAGS="/wd4756 /wd4056"   Acutal result: service_context.cpp D:\MongoDB\src\src\mongo/util/future.h(1726): error C2039: 'make_intrusive': is not a member of 'mongo::future_details' D:\MongoDB\src\src\mongo/util/future.h(55): note: see declaration of 'mongo::future_details' D:\MongoDB\src\src\mongo/util/future.h(1722): note: while compiling class template member function 'mongo::future_details::SharedSemiFuture<T> mongo::future_details::Future<T>::share(void) noexcept &&' with [ T=mongo::future_details::FakeVoid ] D:\MongoDB\src\src\mongo/util/future.h(1732): note: see reference to function template instantiation 'mongo::future_details::SharedSemiFuture<T> mongo::future_details::Future<T>::share(void) noexcept &&' being compiled with [ T=mongo::future_details::FakeVoid ] D:\MongoDB\src\src\mongo/util/future.h(1423): note: see reference to class template instantiation 'mongo::future_details::Future<mongo::future_details::FakeVoid>' being compiled D:\MongoDB\src\src\mongo/util/future.h(1726): error C2275: 'mongo::future_details::SharedState<mongo::future_details::FakeVoid>': illegal use of this type as an expression D:\MongoDB\src\src\mongo/util/future.h(1726): note: see declaration of 'mongo::future_details::SharedState<mongo::future_details::FakeVoid>' D:\MongoDB\src\src\mongo/util/future.h(1726): error C2059: syntax error: ')' D:\MongoDB\src\src\mongo/util/future.h(1727): error C3536: 'shared': cannot be used before it is initialized D:\MongoDB\src\src\mongo/util/future.h(1728): error C2440: '<function-style-cast>': cannot convert from 'int' to 'mongo::future_details::SharedSemiFuture<T>' with [ T=mongo::future_details::FakeVoid ] D:\MongoDB\src\src\mongo/util/future.h(1728): note: No constructor could take the source type, or constructor overload resolution was ambiguous scons: *** [build\opt\mongo\db\operation_context.obj] Error 2   Acutal result:
    • Dev Tools 2019-02-11, Dev Tools 2019-02-25

      MongoDB failed to buid due to C2039 C2275 C2059 C3536 and C2440 on MSVC. These errors appears to be make_intrusive not defined in the future.h file and can be first reproduced on 3e402ff version. We use latest version of MongoDB to test VS copmlier. And we know building MongoDB with VS 2017 is currently not supported, so we apply patch to support this, I attach this patch. Could you please help to take a look at this? Thanks in advance!

        1. log_scons.log
          33 kB
        2. log_x64_build_latestversion.log
          10 kB
        3. log_x64_build_withoutpatch__latestmaster.log
          697 kB
        4. log_x64_build.log
          342 kB
        5. mongodb_bug668740.patch
          0.6 kB
        6. mongodb_c2039,c3646.patch
          0.7 kB
        7. mongodb_permissive_c3861.patch
          1 kB
        8. mongodb.patch
          2 kB

            Assignee:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Reporter:
            spacelg LinGao
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: