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

Ninja compiledb incorrect for some targets

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.3.3
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Dev Platform 2020-01-27

      Description

      Repro steps:

      python3 ./buildscripts/scons.py \
        --dbg --variables-files=etc/scons/xcode_macosx.vars \
        --modules= \
        --ninja new.build.ninja
      ninja -f ./new.build.jinja compiledb
      

      Expected: No lines have file:<path_to_compiler>.

      Actual:

      Some lines look like the following:

          "file": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
      

      Mat and I looked into this. It seems related to the ordering of dependencies. E.g. in the new.build.ninja file, we see:

          build build/debug/mongo/dbtests/catalogtests.o: CMD_W_DEPS | src/mongo/dbtests/catalogtests.cpp $
              /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ $
              /Users/rtimmons/mongodb/mongo/new.build.ninja || _generated_sources
            cmd = PATH=/usr/local/bin:/opt/bin:/bin:/usr/bin $
      

      for a target that has the correct "file" attribute and

      build build/debug/mongo/dbtests/basictests.o: CMD_W_DEPS | $
          /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ $
          src/mongo/dbtests/basictests.cpp /Users/rtimmons/mongodb/mongo/new.build.ninja || $
      

      for a target that does not.

      It seems like the ordering of dependencies may vary run over run (python sets are hash-based) so sometimes the order of clang++ and {{.cpp} files changes.

      Scons gets the compiledb right fwiw:

          python3 ./buildscripts/scons.py \
            --dbg --variables-files=etc/scons/xcode_macosx.vars \
            --modules= \
            compiledb
      

        Attachments

          Activity

            People

            Assignee:
            mathew.robinson Mathew Robinson (Inactive)
            Reporter:
            ryan.timmons Ryan Timmons
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: