[SERVER-48372] Build fails on windows with latest buildtool version released on May 19th Created: 21/May/20  Updated: 29/Oct/23  Resolved: 28/May/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.4.0-rc8, 4.7.0

Type: Bug Priority: Major - P3
Reporter: Marcos José Grillo Ramirez Assignee: Andrew Morrow (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-48440 Build fails on windows with latest bu... Closed
Backwards Compatibility: Fully Compatible
Operating System: Windows
Backport Requested:
v4.4
Steps To Reproduce:

1. On Windows 10, Update Visual Studio 2019 to 16.6.0
2. Compile core

Sprint: Dev Platform 2020-06-01
Participants:

 Description   

The latest visual studio version (v16.6.0) with the windows compiler version 19.26.28805:

> cl /HELP
Microsoft (R) C/C++ Optimizing Compiler Version 19.26.28805 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

Fails to compile the master branch at least on the revision 300d06e, on the mozjs-60 third party module:

FAILED: build/debug/third_party/mozjs-60/extract/js/src/gc/StoreBuffer.obj
cl @build\debug\third_party\mozjs-60\extract\js\src\gc\StoreBuffer.obj.rsp
.\src\third_party\mozjs-60\extract\js\src\gc/StoreBuffer.h(344,24): error C7626: unnamed class used in typedef name cannot declare members other than non-static data members, member enumerations, or member classes
        typedef struct {
                       ^



 Comments   
Comment by Githook User [ 28/May/20 ]

Author:

{'name': 'Andrew Morrow', 'email': 'acm@mongodb.com', 'username': 'acmorrow'}

Message: SERVER-48372 Fix new diagnostic in mozjs with VS 2019

(cherry picked from commit fa375b0b13a392f64f44fc48df9b152f3fbcc88b)
Branch: v4.4
https://github.com/mongodb/mongo/commit/44cfcb4f341f2676984702c9cc3b000dffa0ec24

Comment by Githook User [ 28/May/20 ]

Author:

{'name': 'Andrew Morrow', 'email': 'acm@mongodb.com', 'username': 'acmorrow'}

Message: SERVER-48372 Fix new diagnostic in mozjs with VS 2019
Branch: master
https://github.com/mongodb/mongo/commit/fa375b0b13a392f64f44fc48df9b152f3fbcc88b

Comment by Andrew Morrow (Inactive) [ 27/May/20 ]

marcos.grillo - As discussed on slack. instances of this error in code we own (src/mongo/... should be fixed under a different ticket, since they can be made as direct commits to the codebase. Changes to third_party code can remain in this ticket since they arrive by various other processes.

Comment by Marcos José Grillo Ramirez [ 27/May/20 ]

Hi acm, thank you for taking a look at this. The exact diff do not apply, I had to apply the following diff:

diff --git a/src/third_party/mozjs-60/extract/js/src/gc/StoreBuffer.h b/src/third_party/mozjs-60/extract/js/src/gc/StoreBuffer.h
index 303a438cb7..7db019a264 100644
--- a/src/third_party/mozjs-60/extract/js/src/gc/StoreBuffer.h
+++ b/src/third_party/mozjs-60/extract/js/src/gc/StoreBuffer.h
@@ -341,7 +341,7 @@ class StoreBuffer
 
         explicit operator bool() const { return objectAndKind_ != 0; }
 
-        typedef struct {
+        typedef struct Hasher {
             typedef SlotsEdge Lookup;
             static HashNumber hash(const Lookup& l) {
                 return mozilla::HashGeneric(l.objectAndKind_, l.start_, l.count_);

But the compilation still fails, now with the error:

[2257/3518] Compiling build\debug\mongo\db\catalog\capped_utils.obj
FAILED: build/debug/mongo/db/catalog/capped_utils.obj
cl @build\debug\mongo\db\catalog\capped_utils.obj.rsp
.\src\mongo\db\repl_index_build_state.h(296,38): error C7626: unnamed class used in typedef name cannot declare members other than non-static data members, member enumerations, or member classes
    using IndexCatalogStats = struct {
                                     ^

Comment by Andrew Morrow (Inactive) [ 26/May/20 ]

marcos.grillo - Could you please try applying the above trivial change and see if it fixes the issue locally for you? And let me know either way.

Comment by Andrew Morrow (Inactive) [ 26/May/20 ]

We can backport https://github.com/mozilla/gecko-dev/commit/bae79bfe2a76d79173ccf63ecae50e221a21cf4b#diff-81185e9c4143f68ef0ed72a1729157b4

Comment by Andrew Morrow (Inactive) [ 26/May/20 ]

This is due to https://docs.microsoft.com/en-us/cpp/overview/cpp-conformance-improvements?view=vs-2019#unnamed-classes-in-typedef-declarations. Since this is a hard error in our build mode, we cannot address this with adding additional flags to control the set of warnings. We will either need to make our own localized fix, or, if a fix has been made upstream, cherry-pick it in to our tree.

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