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

MongoDB failed to build due to error C2059: syntax error: 'volatile' with MSVC on windows

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Build
    • 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. pip.exe install --user -r .\etc\pip\dev-requirements.txt
      4. python.exe buildscripts/scons.py all -j4

       

      Acutal result:

      cl /Fobuild\opt\mongo\util\diagnostic_info_test.obj /c src\mongo\util\diagnostic_info_test.cpp /TP /nologo /EHsc /W3 /wd4068 /wd4244 /wd4267 /wd4290 /wd4351 /wd4355 /wd4373 /wd4800 /wd5041 /wd4291 /we4013 /we4099 /we4930 /WX /errorReport:none /MD /O2 /Oy- /bigobj /utf-8 /permissive- /Zc:externC- /Zc:__cplusplus /Zc:sizedDealloc /volatile:iso /diagnostics:caret /std:c++17 /Gw /Gy /Zc:inline /DSAFEINT_USE_INTRINSICS=0 /DPCRE_STATIC /DNDEBUG /DBOOST_ALL_NO_LIB /D_UNICODE /DUNICODE /D_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING /D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING /D_CONSOLE /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0601 /DBOOST_USE_WINAPI_VERSION=0x0601 /DNTDDI_VERSION=0x06010000 /DBOOST_THREAD_VERSION=5 /DBOOST_THREAD_USES_DATETIME /DBOOST_SYSTEM_NO_DEPRECATED /DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS /DBOOST_ENABLE_ASSERT_DEBUG_HANDLER /DBOOST_LOG_NO_SHORTHAND_NAMES /DABSL_FORCE_ALIGNED_ACCESS /DUCONFIG_NO_BREAK_ITERATION=1 /DUCONFIG_NO_FORMATTING=1 /DUCONFIG_NO_TRANSLITERATION=1 /DUCONFIG_NO_REGULAR_EXPRESSIONS=1 /DU_CHARSET_IS_UTF8=1 /DU_DISABLE_RENAMING=1 /DU_STATIC_IMPLEMENTATION=1 /DU_USING_ICU_NAMESPACE=0 /Isrc\third_party\icu4c-57.1\source\common /Isrc\third_party\icu4c-57.1\source\i18n /Isrc\third_party\asio-master\asio\include /Isrc\third_party\SafeInt /Isrc\third_party\pcre-8.42 /Isrc\third_party\fmt\dist\include /Isrc\third_party\boost-1.70.0 /Isrc\third_party\abseil-cpp-master\abseil-cpp /Ibuild\opt /Isrc /Z7

       

      src\mongo\util\diagnostic_info_test.cpp(143,9): error C2059: syntax error: 'volatile'
      asm volatile(""); // NOLINT
      ^
      scons: *** [build\opt\mongo\util\diagnostic_info_test.obj] Error 2
      scons: building terminated because of errors.
      build\opt\mongo\util\diagnostic_info_test.obj failed: Error 2
      [command took 8324 seconds]

       

      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. pip.exe install --user -r .\etc\pip\dev-requirements.txt 4. python.exe buildscripts/scons.py all -j4   Acutal result: cl /Fobuild\opt\mongo\util\diagnostic_info_test.obj /c src\mongo\util\diagnostic_info_test.cpp /TP /nologo /EHsc /W3 /wd4068 /wd4244 /wd4267 /wd4290 /wd4351 /wd4355 /wd4373 /wd4800 /wd5041 /wd4291 /we4013 /we4099 /we4930 /WX /errorReport:none /MD /O2 /Oy- /bigobj /utf-8 /permissive- /Zc:externC- /Zc:__cplusplus /Zc:sizedDealloc /volatile:iso /diagnostics:caret /std:c++17 /Gw /Gy /Zc:inline /DSAFEINT_USE_INTRINSICS=0 /DPCRE_STATIC /DNDEBUG /DBOOST_ALL_NO_LIB /D_UNICODE /DUNICODE /D_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING /D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING /D_CONSOLE /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0601 /DBOOST_USE_WINAPI_VERSION=0x0601 /DNTDDI_VERSION=0x06010000 /DBOOST_THREAD_VERSION=5 /DBOOST_THREAD_USES_DATETIME /DBOOST_SYSTEM_NO_DEPRECATED /DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS /DBOOST_ENABLE_ASSERT_DEBUG_HANDLER /DBOOST_LOG_NO_SHORTHAND_NAMES /DABSL_FORCE_ALIGNED_ACCESS /DUCONFIG_NO_BREAK_ITERATION=1 /DUCONFIG_NO_FORMATTING=1 /DUCONFIG_NO_TRANSLITERATION=1 /DUCONFIG_NO_REGULAR_EXPRESSIONS=1 /DU_CHARSET_IS_UTF8=1 /DU_DISABLE_RENAMING=1 /DU_STATIC_IMPLEMENTATION=1 /DU_USING_ICU_NAMESPACE=0 /Isrc\third_party\icu4c-57.1\source\common /Isrc\third_party\icu4c-57.1\source\i18n /Isrc\third_party\asio-master\asio\include /Isrc\third_party\SafeInt /Isrc\third_party\pcre-8.42 /Isrc\third_party\fmt\dist\include /Isrc\third_party\boost-1.70.0 /Isrc\third_party\abseil-cpp-master\abseil-cpp /Ibuild\opt /Isrc /Z7   src\mongo\util\diagnostic_info_test.cpp(143,9): error C2059: syntax error: 'volatile' asm volatile(""); // NOLINT ^ scons: *** [build\opt\mongo\util\diagnostic_info_test.obj] Error 2 scons: building terminated because of errors. build\opt\mongo\util\diagnostic_info_test.obj failed: Error 2 [command took 8324 seconds]  

      MongoDB failed to build due to error C2059: syntax error: 'volatile' with MSVC on windows. It can be reproduced on master branch latest revision. Could you please help to take a look at this issue? Thanks in advance!

            Assignee:
            Unassigned Unassigned
            Reporter:
            spacelg LinGao
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: