Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode build fails with "fatal error: malformed or corrupted AST file" Crashlytics.h

I recently enabled modules in my Xcode project build settings ("Enable Modules (C and Objective-C)") and now I frequently get the below build error. It works the next time I build (without any changes) but it is annoying because it happens very often (several times an hour).

fatal error: malformed or corrupted AST file: 'could not find file '/Users/mpv/dev/project/Crashlytics.framework/Headers/Crashlytics.h' referenced by AST file' note: after modifying system headers, please delete the module cache at '/Users/mpv/Library/Developer/Xcode/DerivedData/ModuleCache/M5WJ0FYE7N06'

Crashlytics recommended removing Crashlytics.h from the precompiled header file (.pch) and importing directly in each source file that needs it. This greatly reduces the problem but I still occasionally get a Crashlytics.h file not found error when building.

fatal error: 'Crashlytics/Crashlytics.h' file not found
#import <Crashlytics/Crashlytics.h>
like image 960
Mike Vosseller Avatar asked Nov 16 '13 03:11

Mike Vosseller


1 Answers

First, try going to Product -> Clean menu in Xcode. Then rebuild when it finishes.

If that doesn't work, go to your [Name]-Prefix.pch file in the Supporting Files folder, and delete the #import line. Build. It will have errors, it's ok, now start typing it again and make sure to select the right choice from the drop-down suggest menu so it auto-fills the rest of the line for you. (This step worked for me).

Good luck! Love it when Xcode goes weird like this :)

like image 164
Alex the Ukrainian Avatar answered Nov 01 '22 07:11

Alex the Ukrainian