[MozJS] std::to_chars compile failure on macOS < 10.15

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Critical - P2
    • 7.0.32, 9.0.0-rc0, 8.3.0-rc4, 8.0.23
    • Affects Version/s: 7.0.0
    • Component/s: None
    • None
    • Query Integration
    • ALL
    • v8.3, v8.0, v7.0
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The mozjs upgrade uses std::to_chars which Apple's libc++ marks unavailable below macOS 10.15. Backport branches (e.g. v7.0) targeting older macOS fail to compile.

      [2026/03/20 23:49:26.434] In file included from src/third_party/mozjs/platform/x86_64/macOS/build/Unified_cpp_js_src14.cpp:47:
      [2026/03/20 23:49:26.434] src/third_party/mozjs/extract/js/src/vm/JSAtomUtils.cpp:906:22: error: 'to_chars<unsigned int, 0>' is unavailable: introduced in macOS 10.15
      [2026/03/20 23:49:26.434]   auto result = std::to_chars(buf, buf + std::size(buf), index, 10);
      [2026/03/20 23:49:26.434]                      ^
      [2026/03/20 23:49:26.434] /Applications/Xcode13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/c++/v1/charconv:401:1: note: 'to_chars<unsigned int, 0>' has been explicitly marked unavailable here
      [2026/03/20 23:49:26.434] to_chars(char* __first, char* __last, _Tp __value, int __base)
      [2026/03/20 23:49:26.435] ^ 

      EVG Failing Patch
       

      Fix: MONGO_MOZJS_TO_CHARS compat macro in js/src/util/ToCharsCompat.h — portable fallback on macOS < 10.15, delegates to std::to_chars otherwise. Applied in mongodb-forks/spidermonkey.

            Assignee:
            Aditya Deshpande
            Reporter:
            Aditya Deshpande
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: