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

Windows compilation fails with cl Version 19.34.31937 for x64

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.3.0-rc0
    • Affects Version/s: None
    • Component/s: Query Execution
    • None
    • Query Execution
    • Fully Compatible
    • QE 2023-05-15, QE 2023-05-29, QE 2023-06-12, QE 2023-06-26, QE 2023-07-10, QE 2023-07-24, QE 2023-08-07, QE 2023-08-21, QE 2023-09-04, QE 2023-09-18, QE 2023-10-02, QE 2023-10-16, QE 2023-10-30, QE 2023-11-13, QE 2023-11-27, QE 2023-12-11, QE 2023-12-25, QE 2024-01-08, QE 2024-01-22, QE 2024-02-05, QE 2024-02-19, QE 2024-03-04, QE 2024-03-18

      After updating to Visual Studio ver. 17.4.3 there are some compilation errors that seem related to SERVER-65148, the error shown when trying to build is the following:

      > ninja install-core
      [1/4] Compiled build\debug\third_party\mozjs\platform\x86_64\windows\build\jit\Unified_cpp_js_src_jit2.obj
      FAILED: build/debug/third_party/mozjs/platform/x86_64/windows/build/jit/Unified_cpp_js_src_jit2.obj
      cmd.exe /c del /q build\debug\third_party\mozjs\platform\x86_64\windows\build\jit\Unified_cpp_js_src_jit2.obj >nul 2>&1 & cl @build\debug\third_party\mozjs\platform\x86_64\windows\build\jit\Unified_cpp_js_src_jit2.obj.rsp
      src\third_party\mozjs\extract\js\src\jit/CacheIRCompiler.h(1135,3): fatal error C1001: Internal compiler error.
      (compiler file '_work\1\s\src\vctools\Compiler\CxxFE\sl\p1\c\main.c', line 2018)
       To work around this problem, try simplifying or changing the program near the locations listed above.
      If possible please provide a repro here: https://developercommunity.visualstudio.com
      Please choose the Technical Support command on the Visual C++
       Help menu, or open the Technical Support help file for more information
        void call() {
        ^
      src\third_party\mozjs\extract\js\src\jit/CacheIRCompiler.cpp(6394,64): note: see reference to function template instantiation '<Unknown>' being compiled
            callvm.call<FnBigIntString, BigIntStringEqual<NotEqual>>();
                                                                     ^
      ninja: build stopped: subcommand failed.
      

      The following diff solves the issue:

      diff --git a/src/third_party/mozjs/extract/js/src/jit/CacheIRCompiler.cpp b/src/third_party/mozjs/extract/js/src/jit/CacheIRCompiler.cpp
      index 971cf006f8a..92bfca7d151 100644
      --- a/src/third_party/mozjs/extract/js/src/jit/CacheIRCompiler.cpp
      +++ b/src/third_party/mozjs/extract/js/src/jit/CacheIRCompiler.cpp
      @@ -6373,66 +6373,41 @@ bool CacheIRCompiler::emitCompareBigIntStringResult(JSOp op,
         using FnStringBigInt =
             bool (*)(JSContext*, HandleString, HandleBigInt, bool*);
      
      -  switch (op) {
      -    case JSOp::Eq: {
       #ifndef _MSC_VER
             constexpr auto Equal = EqualityKind::Equal;
      +      constexpr auto NotEqual = EqualityKind::NotEqual;
      +      constexpr auto LessThan = ComparisonKind::LessThan;
      +      constexpr auto GreaterThanOrEqual = ComparisonKind::GreaterThanOrEqual;
       #else
             // The static_cast works around an internal compiler error in MSVC.
             constexpr auto Equal = static_cast<bool>(EqualityKind::Equal);
      +      constexpr auto NotEqual = static_cast<bool>(EqualityKind::NotEqual);
      +      constexpr auto LessThan = static_cast<bool>(ComparisonKind::LessThan);
      +      constexpr auto GreaterThanOrEqual =
      +          static_cast<bool>(ComparisonKind::GreaterThanOrEqual);
       #endif
      +  switch (op) {
      +    case JSOp::Eq: {
             callvm.call<FnBigIntString, BigIntStringEqual<Equal>>();
             break;
           }
           case JSOp::Ne: {
      -#ifndef _MSC_VER
      -      constexpr auto NotEqual = EqualityKind::NotEqual;
      -#else
      -      // The static_cast works around an internal compiler error in MSVC.
      -      constexpr auto NotEqual = static_cast<bool>(EqualityKind::NotEqual);
      -#endif
             callvm.call<FnBigIntString, BigIntStringEqual<NotEqual>>();
             break;
           }
           case JSOp::Lt: {
      -#ifndef _MSC_VER
      -      constexpr auto LessThan = ComparisonKind::LessThan;
      -#else
      -      // The static_cast works around an internal compiler error in MSVC.
      -      constexpr auto LessThan = static_cast<bool>(ComparisonKind::LessThan);
      -#endif
             callvm.call<FnBigIntString, BigIntStringCompare<LessThan>>();
             break;
           }
           case JSOp::Gt: {
      -#ifndef _MSC_VER
      -      constexpr auto LessThan = ComparisonKind::LessThan;
      -#else
      -      // The static_cast works around an internal compiler error in MSVC.
      -      constexpr auto LessThan = static_cast<bool>(ComparisonKind::LessThan);
      -#endif
             callvm.call<FnStringBigInt, StringBigIntCompare<LessThan>>();
             break;
           }
           case JSOp::Le: {
      -#ifndef _MSC_VER
      -      constexpr auto GreaterThanOrEqual = ComparisonKind::GreaterThanOrEqual;
      -#else
      -      // The static_cast works around an internal compiler error in MSVC.
      -      constexpr auto GreaterThanOrEqual =
      -          static_cast<bool>(ComparisonKind::GreaterThanOrEqual);
      -#endif
             callvm.call<FnStringBigInt, StringBigIntCompare<GreaterThanOrEqual>>();
             break;
           }
           case JSOp::Ge: {
      -#ifndef _MSC_VER
      -      constexpr auto GreaterThanOrEqual = ComparisonKind::GreaterThanOrEqual;
      -#else
      -      // The static_cast works around an internal compiler error in MSVC.
      -      constexpr auto GreaterThanOrEqual =
      -          static_cast<bool>(ComparisonKind::GreaterThanOrEqual);
      -#endif
             callvm.call<FnBigIntString, BigIntStringCompare<GreaterThanOrEqual>>();
             break;
           }
      

      Basically moving the ifdef's before the switch.

            Assignee:
            justin.seyster@mongodb.com Justin Seyster
            Reporter:
            marcos.grillo@mongodb.com Marcos José Grillo Ramirez
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: