[SERVER-57692] forceincludes.py: add better error handling for missing header Created: 14/Jun/21  Updated: 29/Oct/23  Resolved: 12/May/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Daniel Moody Assignee: Tausif Rahman (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Dev Platform 2022-05-02, Dev Platform 2022-05-16
Participants:

 Description   

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

 



 Comments   
Comment by Githook User [ 12/May/22 ]

Author:

{'name': 'Tausif Rahman', 'email': 'tausif.rahman@mongodb.com', 'username': 'trahman1318'}

Message: SERVER-57692 forceincludes.py: add better error handling for missing header
Branch: master
https://github.com/mongodb/mongo/commit/1ca9f11ad44383794b3ffe5193f088bee99a1994

Generated at Thu Feb 08 05:42:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.