I have a problem I don't know why did it happen in the first place but most probably because I've pressed move to trash to some system frameworks by mistake.
I got an error that says:
malformed or corrupted AST file: 'could not find file '/Users/username/myProject/QuartzCore.framework/Headers/CAMediaTiming.h' referenced by AST file'
I've tried to copy QuartzCore.framework in that Directory. It give me then a punch of new errors. Then if I remove the framework from the Dir. Everything will be good for the project till I make any code change. Then I would have to make the previous scenario again. It's very annoying now and I really need to fix this. Anyone?
As requested:
What caused this error for me (after getting the new Xcode) was I would try to run a project in simulator (accidentally in simulator, I never use simulator), but I'd forget to select my device or my device would become unplugged without me noticing, and it will try to run in simulator... so I would get those classic ".o" file errors... Then I would switch back to my device and get corrupt AST files...
To CURE the problem... (Follow the steps below VERY closely!!!!!)
Clean your project
QUIT Xcode (CMD+Q)
Run this Terminal Command: rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache/*
Run this Terminal Command: rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/*
Reopen Xcode
MAKE SURE YOU HAVE YOUR DEVICE SELECTED AND NOT SIMULATOR
CLEAN project (Yes, again)
THEN build (to your device, not to simulator)...
Enjoy!
Note: After further experimentation I've found that the force-quitting of xCode is possibly not necessary.
In addition to all of the other "clean your build" answers, nothing was working for me until I emptied out the (highly undocumented!) /var/folders directory.
Apparently, this is a "miscellaneous caches" dir maintained by OS-X. I didn't even bother figuring out what were "the correct files"; I just cleaned out the entire directory.
...And now I can build again. Hooray! From terminal:
[sudo] rm -rf /var/folders/*
(Although I did it from Finder, via authentication.) (OS-X 10.9.latest)
Additional clue: I could build with XCode-6-beta, but got the goofy "corrupted AST file" error in XCode-5.
In my situation, all I needed to do was click Product > Clean, then build the project again. It succeeded. Hope this helps some others who run into the same situation.
Hi all I got the same error because I have opened two projects at a time and drag and dropped frameworks from one project to another .
After some time I realised that this is not a right way. I moved all frameworks which are dragged from another project to trash. Then clean and run in simulator everything is working fine.
Delete frameworks->again add frameworks->clean and run
I hope it will help someone
Personnaly, just one solution worked for me:
In Xcode Go to Window -> Organizer
Clic on the "delete" button near the "derived data" directory.
Then Run again your project...
I just clean my project and re-build. Everything back to normal.
In my case, the error was happening because I had a corrupted .m file - it was one that had, somehow (not quite sure how) found its way into my project (I had Eclipse open at the same time and the corrupted file had some java code in it). To fix the problem, I cleaned my project, closed Xcode, deleted the erroneous .m file & re-opened Xcode. It then gave me a clang error due to the now missing .m file. I created a new, empty .m file with the same name and the project ran fine. Bit of a hack but it worked :-)
Related
AnyOne has an idea how to solve this ?
PS : My project Settings are all verified.
Thanks.
Open finder--> press option Go - > Go to Folder
type your project path in that like :
Library/Developer/Xcode/DerivedData/yourprojectname/Build/Products/Debug-iphoneos
Now new window opens with list of Files, There you see yourApp.app file.
Now,
Open Terminal and type just cd then just drag yourApp.app (from finder window) to terminal, now you will get the path for the app, now press enter.
Now type command below:
xattr -rc .
Don't forget "."(Dot) at last.
Press enter button.
Now, Go to your Xcode project and clean and run again.
EDIT:
it is all about path miss match and cached path that you used before. so while doing above steps you are clearing build path for the project, that will make xcode project to run as new without taking cache.
making copy of the project and running same project with xcode make issue or keeping project in icloud and running from that location also makes issue.
May this help.
i just changed codeSign -> Release to iOS distribution then i put it back to iOS developer then i did a simple clean.
And that solved my problem (find it quite strange !!!).
Creating a build for my Xcode project takes too much time. It gets stuck at "Copying swiftdocs". I am making a build to run on device. I cant understand why this is happening. No relevant info available on internet. Just for the info, I am using Cocoa Pods in the project.
Is it anywhere related to pods? I am unable to run the app on device.
Xcode stuck indexing error (compiling model, copying swiftdocs, etc.)
Open your Project Folder.
Find ProjectName.xcodeproj file.
Right-Click Copy and Paste to Safe Place.
Right-Click Show Package Contents.
Find project.xcworkspace file and delete that file.
Reopen Your Project and clean and Rebuild.
If your problem is not solved then replace the file with your backup file.
Hope this will work for you. If still not restart your mac some time it works with restart.
After deleting/adding some png files to project, i have got messages when building project.
"file ProjectPath\aaa\xxx.png is missing from working copy."
All these files are in the project, and the application is running. However, these messages are annoying. Looked .plist file, but there is no mention of these files.
What should I do to remove these messages?
The warning will disappear as soon as you commit your changes (Xcode 8).
It seems that this problem may have different causes, but it's often in relation with source control software.
In my case, I solved it by going to Git, and adding the files again. I mean running the following command:
git add .
You can also disable source control by unchecking
Xcode -> Preferences -> Source Control -> Enable Source Control
if you're managing it via command line or any other app.
In XCode -> SoureControl:
Update + Refresh Status did it for me.
In my case, the file was missing from the source control.
To fix, I had to discard this file (be careful only discard the missing file not all your project):
Xcode->Source Control->commit
Right Click the missing file
Choose Discard Changes
Disable Source Control, clean build folder (Alt+Shift+Cmd+K), then Enable Source Control again.
Xcode -> Preferences -> Source Control -> Enable Source Control
In my case, Xcode had somehow found old .svn directories that referenced the missing files. I had to go up a level above my project folder to find those .svn files. Once deleted, I restarted Xcode and everything was fine.
I had a similar issue with a handful of files that had long since been deleted from my Xcode project while I was still using Xcode 7.
My solution was to:
Create files with the names Xcode was complaining about (they don't need any content)
Add the files to my Xcode project (in Xcode right click on my main project directory, click Add files to my_project_name and select the files that were just created
Select the newly added files and delete them - select move to trash.
This got rid of the warnings for me.
To add onto Alexander Vasenin's answer...
First I Committed and Pushed my changes
Xcode Main Menu > Source Control > Commit
Then I Discarded All Changes to get rid of the errors
Xcode Main Menu > Source Control > Discard All Changes
After that, the errors stating "file xxx.png is missing from working copy" disappeared.
This is occurred when you delete file on Xcode, but didnt tell svn server about it.
Go to command line tool, and delete file directly.
svn delete missingFile.m
and commit it
svn commit -m "Deleting file"
note that if you delete .svn folder, the warning is disappear but you will lost communication with svn server.
I worked it out.
just open your third-party SVN tool, find the miss files, Revert;
that's all.
I had same problem and solved it by add git .
Open Command Line Tool
cd "project folder path"
git add .
Later,restart Xcode project and open your project again.
Show on target->build phases -> copy Bundle Resources.
and
clean build folder command+shift+alt+k
I had to manually go into Terminal and remove the files with git rm ProjectPath\aaa\xxx.png and then commit. After that everything worked fine.
Got this for every project after moving on to XCode 8. This solved it:
With Option Key pressed, Product (in title menu) -> Clean Build Folder.
In my case, I had wrong data from my old projects in the simulator. Solved by reset content and settings in the simulator:
Simulator -> Reset content and settings...
For me the following worked:
Since I do not and did never use Git, I created a new project (XCode 8, I could not see the usual "use Git" or however the checkmark was labeled). Then I bluntly deleted all the files in this new project; went to the old messed up project, copied everything in the project folder, came back to the newly created project, pasted the old stuff, opened that - all the warnings about files that have not been existing for months are gone. Fingers crossed.
I had the same issue and solved it by simply dragging the specified files from finder into the project navigator (ensuring that "copy files" is selected in the dialog) and committing the files.
These warnings are not build warnings, they are about your SVN repository.
It is correct that the directories shown no longer exist, CocoaPods stores the headers in Pods/Headers/{Private,Public} now. You have to update your working copy to reflect those changes.
In my case I drag & dropped a number of files on my Xcode project window to add them. It made copies into my source directory but didn't put them where I wanted them to go (it put them at the root of my directory, I wanted them in a sub-directory). Without thinking I just grabbed them in the Finder and moved them to the directory I wanted them in. After going back into the project window it of course could not find them so I deleted them in the window and re added them. After compiling I started getting these errors.
I thought, as some mention above that it was a git issue but when I ran "git ls-tree --full-tree -r HEAD" I didn't see the files at all??
Anyway to fix it all I did was use the "Add File..." menu command to add each of the files to the default location, do a clean build, and then delete them from the project window (using move to trash) and it got rid of all the errors.
I had the warnings, and also could not commit changes under XCode (using svn). All I had to do was restart XCode and the problem went away.
This works for me:
Xcode -> ("option + click") Product -> Clean Build Folder...
Than restart xCode
In my case it was a problem with git and a case-insensitive file system.
I had inadvertently submitted the same file twice, using file paths that differed only in case:
MyProject/Resources/foo.png
MyProject/resources/foo.png
Xcode was complaining about one of the missing files.
Fixed by deleting the offending files, and re-adding.
cd MyProject
mv Resources/foo.png /tmp
git rm Resources/foo.png
git rm resources/foo.png
git commit
mv /tmp/foo.png Resources
git add Resources/foo.png
git commit
This is definitely related to source control. I renamed and moved a couple of non-committed plist files and got this error. I am using svn. I was able to fix this via Source Control - Commit by removing old referenced files.
It keeps saying:
fatal error: file '/Applications/Xcode5-DP5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/objc/NSObject.h'
has been modified since the precompiled header
'/Users/jackiexu/Library/Developer/Xcode/DerivedData/ModuleCache/2MWVPCGUMQ29P/ObjectiveC.pcm' was built
note: after modifying system headers, please delete the module cache at '/Users/jackiexu/Library/Developer/Xcode/DerivedData/ModuleCache/2MWVPCGUMQ29P'
1 error generated.
I must have deleted the derived data at least five times by now, and I'm getting nowhere. Any ideas?
Open a terminal and type in :
rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache/*
Clean your project and build again. Worked for me.
Delete the folder, clean the app, restart Xcode if necessary.
as per xcode 5.
click on Xcode preferences
Goto locations tab
click on the derived data path which navigates to the folder called DerivedData
Delete the whole folder and restart xcode.
This works fine for me.
Happy coding :)
Have you tried reinstalling xcode? And have you cleaned using cmd+shift+k ?
The same thing was occuring to me. The warning was telling me:
After modifying system headers, please delete the module cache at
'/Users/yunus.mehel/Library/Developer/Xcode/DerivedData/ModuleCache/13XL2DHZVON89'
So, I have restarted xcode, deleted derived data from Organizer, deleted derived data from the derivedData folder; none of them worked. Then I have realized, the solution was already there; go to:
"DerivedData/ModuleCache/13XL6DH2BON89"
and delete that folder, not the "DerivedData/<your_project>". Make a clean build, it will work again.
Run this script to delete all relevant files in /Library/Developer/Xcode/DerivedData and /var/folders:
# run with
# ruby reallyCleanXcode.rb
derivedDataFolder = Dir.glob(Dir.home + "/Library/Developer/Xcode/DerivedData/*")
moduleCache = Dir.glob("/var/folders/**/com.apple.DeveloperTools*")
FileUtils.rm_rf derivedDataFolder + moduleCache
This happen when compiling, when running the app or neither?
Have you tried this:
Build Settings - Build Locations - Precompiled Header Cache Path -- there's a folder... delete it.
I solved this by:
Quit restart Xcode + clean project + clean build folders + clean derived data + deleted the /var/folders/.../.../C/com.apple.DeveloperTools/5.0.2-5A3005/Xcode/SharedPrecompiledHeaders + unplugged my iPhone
Rebuild and works :)
I was having the same problem. I did SHFT+CMD+K and tried to run,again the error appeared. My error pointed to the NSJSONSerialization header file. So what I did is deleted the files in ModuleCache and the project seems working now. I had changed my code which used NSJSonSerialization thinking it to be wrong, and project started working with the code also :)
To delete the files -- Click on 'Go' in the Desktop and then 'Go to folder' then type the folder path (Eg : 'Library/.…./ModuleCache') and delete all the files.
Regards,
ASK
Please follow below steps to get rid from your problem.
"Library/Developer/Xcode/DerivedData/ModuleCache/"
Delete all Folders inside ModuleCache Folder.
Make a clean build, quit Xcode and run it again
sure ,it will work fine.
Good Luck !!!
my solution,
in terminal, run command:
rm -rf /Users/jackiexu/Library/Developer/Xcode/DerivedData/ModuleCache/2MWVPCGUMQ29P
then in xcode, clean
then restart xcode and build
In addition to all of the other "clean your build" answers, nothing was working for me until I emptied out the (highly undocumented!) /var/folders directory.
Apparently, this is a "miscellaneous caches" dir maintained by OS-X. I didn't even bother figuring out what were "the correct files"; I just cleaned out the entire directory.
...And now I can build again. Hooray! From terminal:
[sudo] rm -rf /var/folders/*
(Although I did it from Finder, via authentication.) (OS-X 10.9.latest)
Additional clue: I could build with XCode-6-beta, but got the goofy corrupt error in XCode-5.
I used Shift + CMD + K to try and clean the project, but it did not disappear.
All I had to do was go and check the names of <yourProjectName>-info.plist and <yourProjectName>-Prefix.pch.
Then Shift + CMD + K worked.
In my case the problem was Clang exiting with code 1.
I was facing the same issue. I first cleaned the project do this by hitting "shift + command + k" and just rebuilt the project and it worked for me. hit "command + B" to rebuilt your project
Having a problem when building with xcodebuild. My project/app builds fine with the Xcode - gui. It simply isn't finding/building the libcryptopp library which is part of the build process.
The error is:
clang: error: no such file or directory: '/Users/builder/repo/ioskpay/xcode-cryptopp/cryptopp/build/Release-iphoneos/libcryptopp.a'
This particular file should be derived from another project inside the main app - xcodebuild simply isn't correctly pointing at the right file folder which should be:
~/Library/Developer/Xcode/DerivedData
Any ideas?
To fix this, go to your project settings, go to Targets and select your main project target. Then go to Build phases. Under Target dependencies add the static library project.
This way, when you compile the main project, the static library subproject gets compiled before the main project and your static library will be available.
I had the same problem, but for a resource file .m
I opened target -> build phases -> Compile sources
and I found the file the compiler was tell it can't find duplicated: one with strange icon and the other with a normal icon. I simply removed the one with strange icon and it worked. ( I added the file multiple times and I had a merge conflict before that which made something wrong in the project file)
For your case I think you need to remove the lib from target dependencies list and add it again. This may work for you.
In Xcode Version 9.2 (9C40b) this happened when I drug a bunch of files into the project, some of which were duplicate. Rather than simply not adding the duplicates, it added them again and only the name, not the path.
In Target > Build Phases > Compile Sources each of the duplicates showed with no "...in" after them. Each one caused the clang error.
After removing all of the duplicates that Xcode collected, the project compiled and ran.
It makes you use the Project Navigator instead of managing your source files in the Finder. Then the Project Navigator can't replace duplicates like any decent file management system (ahem Finder). 🤨
My xCode info is:
I faced similar errors during xcode building projects (native swift, flutter, react native, native script) in which I got error messages related to clang compilar. Errors like:
clang-4.0: error: no such file or directory: '/Users/xxxxxxxx/Library/Developer/Xcode/DerivedData/xxxxxxxxxxxxxxx/Index/Data Store'
clang-4.0: error: cannot specify -o when generating multiple output files
others
Despite of errors related with DerivedData for native apps can be fixed by deleting the directory and, eventually, restart xCode and even restart the machine... in this case, you will see that after deleting the directory and start building process again, the error comes back.
Then, is the moment of checking the clang installation by running clang --version. The normal output will be something like:
as you can see the InstalledDir is incorrect for xCode. In my case, some days ago I needed to install Anaconda app (R, Python, etc) and, now, I remember that I had to install some dependencies and one of them was clang and its installation was altered.
To fix this problem (in my case that I will not need anaconda any more): (edited)
1.- Delete anaconda and all its dependencies (I recommend to use App Cleaner).
2.- Re-install xCode
After reinstalling xCode, if you type again clang --version, you'll get this:
More info at: https://github.com/flutter/flutter/issues/32457#issuecomment-496161092
Hopefully, this info helps some else.
Best
Ok so by simply adding the correct -target -configuration and -scheme parameters I got this to run correctly. However due to my running this in Jenkins for autobuild purposes it still doesn't work as I'd like - getting stuck in exactly the same place. It's odd because I have the exact same code being built in another job that isn't having this problem. There is no rhyme or reason for it at this point. I will keep shooting rubber bands at it and update when I have an answer...
Sometimes Xcode performs weird.
You have to find that static library project e.g.. "filename.a" under 'Link Binary With Libraries' in Build Phase and then remove it and add it again.
I had the same problem while I was archiving my target. I removed the library and the build succeeded.
For me it was because I had removed a package or pod. I ran pod install and it fixed it
Look for the missing file in the Xcode project i.e the files may be deleted or miss placed.
add the missing files to the xcode, then everything will work fine.
Run this command :
$ conda deactivate