<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Clang error "file not found" on include files when building with modules"
   href="https://bugs.llvm.org/show_bug.cgi?id=51395">51395</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang error "file not found" on include files when building with modules
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Modules
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>akhuang@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>We saw this "file not found" error when trying to build with -fmodules. This
only happens when we use relative paths in the header search.

To repro:
$ cat t.cc
#include <cstddef>
$ ./<relative-path-to-clang>/clang -fmodules -nostdinc++ -no-canonical-prefixes
-isystem../../llvm-build/include/c++/v1 -E t.cc
# 1 "t.cc"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 385 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "t.cc" 2
<module-includes>:23:10: fatal error:
'../../llvm-build/lib/clang/14.0.0/include/stdint.h' file not found
#include "../../llvm-build/lib/clang/14.0.0/include/stdint.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
t.cc:1:10: fatal error: could not build module 'std'
#include <cstddef>
 ~~~~~~~~^


(also, to repro, I had to remove a line `header "range"` from <build
dir>/include/c++/v1/module.modulemap to get the build to work)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>