[SERVER-42572] MongoDB failed to build due to error C2059: syntax error: 'volatile' with MSVC on windows Created: 01/Aug/19  Updated: 27/Oct/23  Resolved: 01/Aug/19

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

Type: Bug Priority: Major - P3
Reporter: LinGao Assignee: Unassigned
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

VS 2017 + Windows Server 2016 + MongoDB master branch latest revision


Attachments: Text File log_x64_build.log    
Operating System: ALL
Steps To Reproduce:

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]

 

Participants:

 Description   

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!



 Comments   
Comment by Andrew Morrow (Inactive) [ 06/Aug/19 ]

spacelg - Yes, we know. We are working on a fix in SERVER-42515.

Comment by LinGao [ 05/Aug/19 ]

Hi Andrew,

Thanks for your reply! Our main job is to test the VS compiler with open source projects. And we asked the MSVC team about this issue, they said that the code uses GCC extension which is not supported by MSVC. So the error is by design. as below:

void f()

{ asm volatile(""); }

 

It still can be reproduced on master branch latest revision. Could you please provide a work around to us? Thanks a lot!

 

Thanks,

Lin

 

 

Comment by Andrew Morrow (Inactive) [ 01/Aug/19 ]

spacelg - We try hard not to break master but it is where active development happens and sometimes things get checked in that shouldn't have. They usually get reverted fairly quickly when the issue is detected by our CI system. But accidents happen and sometimes master will be broken on certain commits or for certain windows of time.

Since this doesn't represent a bug in a stable version of MongoDB, I'm going to close this ticket.

Please note that builds made from the master branch shouldn't be used for any production purpose.

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