<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55451>55451</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `-fmodules` causes error: header '__config_site' not found
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          davidstone
      </td>
    </tr>
</table>

<pre>
    Passing `-fmodules` and `stdlib=libc++` causes clang to complain about `__config_site` being missing. For instance, the following translation unit:

```
#include <cstdint>
```

errors with

```
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/module.modulemap:6:10: error: header '__config_site' not found
  header "__config_site"
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/ctype.h:32:10: note: submodule of top-level module 'std_config' implicitly imported here
#include <__config>
         ^
While building module 'std' imported from <source>:1:
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/module.modulemap:6:10: error: header '__config_site' not found
  header "__config_site"
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/errno.h:25:10: note: submodule of top-level module 'std_config' implicitly imported here
#include <__config>
         ^
While building module 'std' imported from <source>:1:
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/module.modulemap:6:10: error: header '__config_site' not found
  header "__config_site"
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/fenv.h:53:10: note: submodule of top-level module 'std_config' implicitly imported here
#include <__config>
         ^
While building module 'std' imported from <source>:1:
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/module.modulemap:6:10: error: header '__config_site' not found
  header "__config_site"
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/inttypes.h:238:10: note: submodule of top-level module 'std_config' implicitly imported here
#include <__config>
         ^
While building module 'std' imported from <source>:1:
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/module.modulemap:6:10: error: header '__config_site' not found
  header "__config_site"
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/stdint.h:106:10: note: submodule of top-level module 'std_config' implicitly imported here
#include <__config>
         ^
While building module 'std' imported from <source>:1:
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/module.modulemap:6:10: error: header '__config_site' not found
  header "__config_site"
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/locale.h:36:10: note: submodule of top-level module 'std_config' implicitly imported here
#include <__config>
         ^
While building module 'std' imported from <source>:1:
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/module.modulemap:6:10: error: header '__config_site' not found
  header "__config_site"
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/math.h:294:10: note: submodule of top-level module 'std_config' implicitly imported here
#include <__config>
         ^
While building module 'std' imported from <source>:1:
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/module.modulemap:6:10: error: header '__config_site' not found
  header "__config_site"
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/__availability:13:10: note: submodule of top-level module 'std_config' implicitly imported here
#include <__config>
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/__availability:287:5: error: "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
#   error "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
    ^
While building module 'std' imported from <source>:1:
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/module.modulemap:6:10: error: header '__config_site' not found
  header "__config_site"
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/__assert:14:10: note: submodule of top-level module 'std_config' implicitly imported here
#include <__config>
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/__assert:51:1: error: unknown type name '_LIBCPP_BEGIN_NAMESPACE_STD'
_LIBCPP_BEGIN_NAMESPACE_STD
^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/__assert:53:29: error: expected ';' after top level declarator
_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ASSERTION_HANDLER
                            ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/__assert:56:1: error: unknown type name '_LIBCPP_END_NAMESPACE_STD'
_LIBCPP_END_NAMESPACE_STD
^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/__assert:58:27: error: expected unqualified-id
#endif // _LIBCPP___ASSERT
                          ^
While building module 'std' imported from <source>:1:
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/module.modulemap:6:10: error: header '__config_site' not found
  header "__config_site"
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/limits:106:10: note: submodule of top-level module 'std_config' implicitly imported here
#include <__config>
         ^
While building module 'std' imported from <source>:1:
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/module.modulemap:6:10: error: header '__config_site' not found
  header "__config_site"
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/type_traits:420:10: note: submodule of top-level module 'std_config' implicitly imported here
#include <__config>
         ^
While building module 'std' imported from <source>:1:
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/module.modulemap:6:10: error: header '__config_site' not found
  header "__config_site"
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/__type_traits/integral_constant.h:12:10: note: submodule of top-level module 'std_config' implicitly imported here
#include <__config>
         ^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/__type_traits/integral_constant.h:18:1: error: unknown type name '_LIBCPP_BEGIN_NAMESPACE_STD'
_LIBCPP_BEGIN_NAMESPACE_STD
^
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/__type_traits/integral_constant.h:20:1: error: expected unqualified-id
template <class _Tp, _Tp __v>
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
<source>:1:10: fatal error: could not build module 'std'
#include <cstdint>
 ~~~~~~~~^
21 errors generated.
Compiler returned: 1
```

Reducing the problem to just

```
#include <__config>
```

outputs

```
/opt/compiler-explorer/clang-assertions-trunk-20220509/bin/../include/c++/v1/module.modulemap:6:10: error: header '__config_site' not found
  header "__config_site"
         ^
<source>:1:10: note: submodule of top-level module 'std_config' implicitly imported here
#include <__config>
         ^
1 error generated.
Compiler returned: 1
```

Note that

```
#include <__config_site>
```

compiles just fine.

See it live: https://godbolt.org/z/EP4q3MfYG
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWltv4jgU_jXhxQLlAhQeeIBCZ5E6TNV2u5qnyElOwFNjM77QZX_9Hjuh96WtdjVFq6DghNg-Pt85n48vOJPFbnRBtWZiSYJ-2C7XsrAcND4TKgr3TpuCsyxIppjmQTxxF-bm1GrQJOcUqxpJcrnecMoEoZm0xlVM01yKki1TzQy4Khm4ZtbMN9chZ1IRJrShIocgPiVmBaSUnMs7V8woKjSnhklBrGAmSMZBOA3CfdoP66v6GSdM5NwWQILkNEedmcAqs9cL-xSUkkqTO2ZWBwWfyY3B1OFjHFQb_txwqUC5dw58G80Hyump20ZZcduOwzgOe-EQS2RMYNrpYFLr56rVVozPthEmlck71W1NN4i0j98oxIR4Ld3DCmgBigTxyVO7xidESIOGs6KoVCYPZeNnZeN9ifoT9Ga_DGZudhvorBBLEt_DQ9XB3bXNKvxElsimTZvDFjip3yFI9GgNxSFmyDWWM8N37lEqAwWCVvAaGfYmuGfDS_R_rBAyySzjhWfo41br5qo2SiXXTqaWViFpUSICeWBmw5X_CCYiEdJzJe41XGm4cghmCWLrqdJLGqo0VDkEE-cEbhDSVWRJBg1fGr4cgllNIz1bor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