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

forceincludes.py: add better error handling for missing header

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Dev Platform 2022-05-02, Dev Platform 2022-05-16

      If a header file is not found, force includes will fail with an ambiguous error message about (ironically) missing attribute "disambiguate".

      It should print the header files that are having problems along with the cpppath its looking through.

       

      example code:

      fis = [env.FindFile(f, path) for f in env.get('FORCEINCLUDES', [])]
      
      if not all(fis):
          missing_headers = []
          for index, fis_header in enumerate(fis):
              if not fis_header:
                  missing_headers.append(env.get('FORCEINCLUDES')[index])
      
          errstring = f"Could not find header{'s' if len(missing_headers)>1 else ''}: {missing_headers} in any path in CPPPATH:\n"
          for cpppath in env.get('CPPPATH', []):
              errstring += f"    {env.Dir(cpppath).path}\n"
      
          raise SCons.Errors.SConsEnvironmentError(errstring)
      

      which looks like this:

      build/opt/mongo/shell/fle_shell_options_gen.dyn.o failed: Could not find header: ['js-config.h'] in any path in CPPPATH:
          src/third_party/mozjs-60/include
          src/third_party/mozjs-60/mongo_sources
          src/third_party/mozjs-60/platform/aarch64/macOS/include
          src/third_party/variant-1.4.0/include
          src/third_party/SafeInt
          src/third_party/pcre-8.42
          src/third_party/fmt/dist/include
          src/third_party/boost
          src/third_party/abseil-cpp-master/abseil-cpp
          build/opt
      

       

            Assignee:
            tausif.rahman@mongodb.com Tausif Rahman (Inactive)
            Reporter:
            daniel.moody@mongodb.com Daniel Moody
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: