<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 - PCH use over-aggressively validates input header mtime"
   href="https://bugs.llvm.org/show_bug.cgi?id=48505">48505</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>PCH use over-aggressively validates input header mtime
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>11.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>daniel.johnston@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Problem:

Build system has sporadic build failures with errors similar to this:

fatal error: file '/usr/include/linux/stddef.h' has been modified since the
precompiled header '<path_to_pch_file>' was built: mtime changed
note: please rebuild precompiled header '<path_to_pch_file>'

In my case, this occurs when Ubuntu decides to update a package that includes
the /usr/include/linux/stddef.h file automatically due to a security fix. 
However, since the OS package being deployed was built before the last PCH file
build, most build systems don't retrigger a PCH file build.  When using the PCH
(due to other build dependency changes), clang will fail because the mtime was
updated (even if the mtime is older than the PCH file).

I'm guessing I could use -fno-validate-pch to work around this issue, however,
I can't seem to find sufficient documentation of that option to determine if
this would work or what other (desirable) checks would be disabled.

In short:

build systems typically only check that the mtime of dependent files are not
newer than the target file

clang fails when dependent file mtime was updated since pch creation, but is
not newer than the actual pch file.</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>