Issue 55451
Summary `-fmodules` causes error: header '__config_site' not found
Labels new issue
Assignees
Reporter davidstone
    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
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to