[cfe-dev] Unhelpful "fatal error: error reading file data"

Chris Lattner clattner at apple.com
Thu Jul 16 09:15:59 PDT 2009


On Jul 15, 2009, at 11:48 PM, Robert Purves wrote:
> On replacing gcc by clang in my custom build system, puzzling failures
> occurred with an unhelpful message:
> fatal error: error reading file data
> This turned out to be clang's response to an especially 'bad'
> precompiled header left behind by my build system (gcc has a feature,
> not needed in clang, whereby pch files of different architectures can
> be placed in a directory *.h.gch).
>
> $ ls -1
> test.c
> test.h
> $ echo "" > test.h.gch
> $ clang -include test.h test.c
> fatal error: 'test.h.gch' does not appear to be a precompiled header
> file
> 1 diagnostic generated.
> $ rm test.h.gch
> $ mkdir test.h.gch
> $ clang -include test.h test.c
> fatal error: error reading file data
> 1 diagnostic generated.
>
> Clang's message for a bad *.h.gch file is excellent. Could the same
> message be emitted if it's a directory?

Sure, please file a bugzilla to track this, thanks!

-Chris



More information about the cfe-dev mailing list