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

MongoDB fails to compile on Mac with XCode 12.0

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.8.0
    • Affects Version/s: None
    • Component/s: Build
    • None
    • Fully Compatible
    • ALL
    • Service arch 2020-10-05

      My Mac force-updated its XCode to 12.0 and with the Clang which comes with that version, MongoDB fails to compile with the following error:

      [kaloianm@Kal-MacBook-Pro:~/workspace/mongo]$ python3 buildscripts/scons.py --ssl --variables-files=etc/scons/xcode_macosx.vars --libc++ --detect-odr-violations --dbg=on --opt=off VARIANT_DIR=ninja --ninja=next generate-ninja
      ...
      [kaloianm@Kal-MacBook-Pro:~/workspace/mongo]$ ninja build/ninja/mongo/client/authenticate.o
      [1/1] Compiling build/ninja/mongo/client/authenticate.o
      FAILED: build/ninja/mongo/client/authenticate.o
      PATH='/usr/local/bin:/opt/bin:/bin:/usr/bin' PATHOSX='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin' /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ @build/ninja/mongo/client/authenticate.o.rsp
      src/mongo/client/authenticate.cpp:215:29: error: loop variable 'elem' of type 'const mongo::BSONElement' creates a copy from type 'const mongo::BSONElement' [-Werror,-Wrange-loop-analysis]
                  for (const auto elem : obj) {
                                  ^
      src/mongo/client/authenticate.cpp:215:18: note: use reference type 'const mongo::BSONElement &' to prevent copying
                  for (const auto elem : obj) {
                       ^~~~~~~~~~~~~~~~~
                                  &
      1 error generated.
      

      This is the clang versions that I have now:

      [kaloianm@Kal-MacBook-Pro:~/workspace/mongo]$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang --version
      Apple clang version 12.0.0 (clang-1200.0.32.2)
      Target: x86_64-apple-darwin19.6.0
      Thread model: posix
      InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
      [kaloianm@Kal-MacBook-Pro:~/workspace/mongo]$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ --version
      Apple clang version 12.0.0 (clang-1200.0.32.2)
      Target: x86_64-apple-darwin19.6.0
      Thread model: posix
      InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
      

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: