I started receiving this error today when building with Xcode 6: error reading ‘pic’…
error: error reading 'pic' error: no analyzer checkers are associated with '-mrelocation-model' 2 errors generated. Command /Applications/Xcode6-Beta6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
I googled a lot and found helpful posts on how to fix it, but no single one of them did the trick. It seemed like I had to do several of them in combination and in the right order. I believe this was the ultimate fix…
Error Reading Pic Fix
1. From this post, add this to your Podfile
inhibit_all_warnings! post_install do |installer_representation| installer_representation.project.targets.each do |target| # Here we need to add "-Xanalyzer deadcode" to the compiler flags # IF "-Xanalyzer -analyzer-disable-checker" is present, for all pod .m files # See https://github.com/CocoaPods/CocoaPods/issues/2402 if target.name.start_with? 'Pods' files = target.source_build_phase.files().select { |file| file.display_name().end_with? ".m" } # compiler flags key in settings compiler_flags_key = "COMPILER_FLAGS" disable_checker_flag = "-Xanalyzer -analyzer-disable-checker" deadcode_flag = "-Xanalyzer deadcode" if files.length > 0 files.each do |build_file| settings = build_file.settings if !settings.nil? compiler_flags = settings[compiler_flags_key] #Add " -Xanalyzer deadcode" to the compiler flags if ((compiler_flags.include? disable_checker_flag) && (!compiler_flags.include? deadcode_flag)) compiler_flags << " " << deadcode_flag settings[compiler_flags_key] = compiler_flags end end build_file.settings = settings end end end #end target name if end end
The ‘inhibit_all_warnings!’ will add the compile flag to your pods’ files and the code after it will add the ‘deadcode’ flag to the project file. I’m confident there’s a better/faster/easier way to do this, but this is the steps I took so that’s what I want to post.
2. Run pod install
Run ‘pod install’ on your project to update the compile flags and such from above.
3. Delete Derived Data
Go to Xcode>Preferences>Locations and look for the location of your derived data. Click the arrow and it will open that folder in Finder.
Close Xcode!
Delete whatever folders that start w/ your project name (actually, I deleted them all and cleared up 35 GB!!!).
4. Build and Hope
Build your project. If you’re project is like mine, it will complain about specific files getting the “error reading ‘pic'”. For those specific files, remove the reference from your project and re-add the file. WARNING: Note where the file is in the project, your file structure and what compile flags are in the Build Phases.
Do a clean on your project, close Xcode, delete the Derived Data again (see step 3 above), open your workspace and build again. Repeat
NOTE: I also had a couple files in my project (not pods) that had similar compile flags like -w -Xanalyzer -analyzer-disable-checker. I had to go in and manually add ‘ -Xanalyzer deadcode’ for those files.