Project ... cannot be opened because it is missing its project.pbxproj file - xcode

I recently downloaded LLVM-3.9 and built XCode project files for it with:
mkdir llvm-3.9.0.XCode # The .XCode in the name was probably a bad idea
cd llvm-3.9.0.XCode
cmake -G Xcode ../llvm-3.9.0.src/
The cmake then generated a valid looking XCode project files.
Then when I tried opening the project directory with XCode, I kept getting error:
Project .../llvm-3.9.0.XCode cannot be opened because it is missing its project.pbxproj file.
Apparently this error message is often the result of corrupt project files, but this is not the problem in my case. It seems this error can be shown due to different reasons. Here are some similar, but not identical questions that did not help me:
One about merge problems.
A question about where the file shoud be.
One about dropbox problems?
One where the problem seems to be corrupt project files
One where the problem was permissions

The solution I used was this:
cd llvm-3.9.0.XCode
cd LLVM.xcodeproj
open .
In other words, I navigated to the newly generated LLVM.xcodeproj with the shell
and used the system open command on that folder.

Related

<unknown>:0: error: unexpected input file:

I downloaded files from a separate Stack OverFlow post, and dragged the folder into my project (as a group.) The dependancies get resolved and it shows no error for code that relies on the files, but when I try to compile I get this error:
<unknown>:0: error: unexpected input file: /.../xyz.Swift
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
It might be nothing, but the files themselves in the project navigator show up as blank icons (while my project's other file have the swift red spalsh icon) despite checking in as swift files in the attribute inspector.
I've fumbled a few times with adding and deleting multiple sets of files, I checked the local dir and nothing seem out of order... is there something else that might be messing this up?
Thanks for suggestions!
Solved - The issue was with the filename extension:
xyz .Swift will not properly link. It will be processed by xcode and solve code issues expecting it, but the linker will hiccup.
renamed files to xyz .swift -> problem solved.
In my case it was after removing a compiler flag in a way it didn't like. Try to figure out what you changed in your compiler settings before it started acting weird. Sometimes because Xcode caches compiled code the problem doesn't immediately start after doing the change!
I haven't seen that precise error before, but don't add files through Finder. Start over, and this time use 'New' -> 'File...' from the Xcode 'File' menu. It has to update its internal manifests to track all project files; you don't want to subvert this process.
After that you may still need to do a 'Clean' before re-building, and perhaps remove all of the DerivedData as well while Xcode is not running:
How can I safely delete in my ~/Library/Developer/Xcode/DerivedData directory?

How to resolve Xcode codesign error about multiple binaries sharing the same path?

When I try to export a signed copy of my application from the Archives screen, I get the following error.
I used find . -type l ls to find symlinks in my project directory: there are none. I went to the Xcode/Archives folder for this archive and searched for symlinks there, and there are some but none of them are in the DevMateKit.framework mentioned in the error message. I've also tried adding a build step to manually delete the second binary, but it doesn't help.
The code signing is being done automatically by Xcode, and the files are being copied through a standard Copy Files task. There is also one manual piece of code signing, done through a Run Script task, which manually codesigns a different framework to the one in the error message (although I can't see how that would be relevant). My Xcode version is 6.3.1.
Any suggestions?
If you are using DevMateKit v1.1.1 or less, check your 'Link Binary With Libraries' build phase and phase where you are copying frameworks and remove DevMateIssuesReporter.framework from the list if it's present there. If it won't help, just contact DevMate support with this problem or create a new issue with GitHub (https://github.com/DevMate/DevMateKit)
OK, so I believe the reason this happens is as follows. The DevMateKit.framework is pre-codesigned by the developer. But I suspect that their source has symlinks in it, and they have signed it all in such a way that this error occurs, but when packaging the framework for download have removed the symlinks so it appears there is nothing that code be done.
I experimented with signing the code myself, which I think would work, but after some experimentation decided to simply delete the binaries that are directly inside any CrashReporter.framework directory, and leave the ones inside any CrashReporter.framework/Versions/.../ directory. This removes the duplicated binaries and appears to work perfectly.
But I'm not an expert on this process, so it's entirely possible that I was just doing something wrong.

sigh... Accidentally hit "add files to project" on entire project folder & started a loop of repeatedly duplicating the project within itself

Wow... tail between legs...
So I clicked "add files to project" in Xcode. My entire project folder came up selected by default, as it usually does. I changed my mind and went to click "cancel", but accidentally clicked "add"... so it basically created this loop of continually adding my project folder inside my project folder... inside my project folder etc.. until it finally errored & stopped. (brought my project folder from about 25Mb to almost 3 gigs!!!
I went into my actual project folder (in finder, not in xcode) and deleted the duplicate folder that contained all the other duplicates. But now when I try to build, I get all kinds of errors. This may be the most embarrassing thing I've ever done. I have a repo backup from 5 days ago, but I'd rather not lose 5 days worth of work. Can someone please help me :( 1 billion internet points to whoever can help me so i can keep working tonight!
here are the errors:
Lipo Error:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo:
can't open input file:
/Users/Daniel/Library/Developer/Xcode/DerivedData/appname-rtgmnzqeqhksvjbmtqtvnaudfgr/Build/Intermediates/appname.build/Debug-iphoneos/appname.build/Objects-normal/armv7/appname
(No such file or directory)
Apple Mach-O Linker Error: ld: 5 duplicate symbols for architecture
armv7 clang: error: linker command failed with exit code 1 (use -v to
see invocation)
Dsymutil Error: GenerateDSYMFile
/Users/Daniel/Library/Developer/Xcode/DerivedData/appname-gahmnzqeqhksvjbmtqtvnauibzrx/Build/Products/Debug-iphoneos/appname.app.dSYM
/Users/Daniel/Library/Developer/Xcode/DerivedData/appname-gahmnzqeqhksvjbmtqtvnauibzrx/Build/Products/Debug-iphoneos/appname.app/appname
cd /Users/Daniel/appDirectory
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil
/Users/Daniel/Library/Developer/Xcode/DerivedData/appname-gahmnzqeqhksvjbmtqtvnauibzrx/Build/Products/Debug-iphoneos/appname.app/appname
-o /Users/Daniel/Library/Developer/Xcode/DerivedData/appname-gahmnzqeqhksvjbmtqtvnauibzrx/Build/Products/Debug-iphoneos/appname.app.dSYM
error: unable to open executable
'/Users/Daniel/Library/Developer/Xcode/DerivedData/appname-gahmnzqeqhksvjbmtqtvnauibzrx/Build/Products/Debug-iphoneos/appname.app/appname'
I Don't know whether i will be able to make you understand or not but i have tried this weired thing just for you and I have got the same error.
Then i found solution for myself, may be it will also help you.
Go to Build Phase -> compile source and then select all the files you see with postioning folder inside a folder like I have shown in screen shot below. you can see the main.m file inside slider/slider/slider..... where slider is my main project folder.
just check for it and press the minus button on the bottom . this will delete all the duplicate files from the finder. same for the images can be done like i have shown in the screen shot.
Then go to your project's finder and just delete the first folder which contain all the folders and project will run smoothly.
I have done this hope this will help you also. (please have a backup of your project before doing it ) :)

Fixing file 'project.pch' has been modified since the precompiled header was built error in Xcode

I was recently working on my application messing around in the info.plist section, and since that my application will not run on my test device:
file 'project.pch' has been modified since the precompiled header was built
Something to note is that the app runs fine in the simulator.
Edit: Now I am getting this error instead of the other one:
No such file or directory (/Users/Me/Library/Developer/Xcode/DerivedData/MyProject-abcdefghijklmnopqrstuvwxyz/Build/Products/Debug-iphoneos/MyApp./MyApp)
How to regenerate the info.plist file?
You could try a deep clean (not the same as Product > Clean) - Option+Command+Shift+K
Note: this means the clean the build folder (by pressing Option + Product -> clean folder)
Close your project or workspace.
In Finder: ⇧shift+⌘cmd+G
Paste: ~/Library/Developer/Xcode/DerivedData/
Delete the ModuleCache folder and empty trash.
Open up your project.
Clean: ⇧shift+⌘cmd+K
Build: ⌘cmd+B
In my case the error message had a small hint:
note: after modifying system headers, please delete the module cache
at
'~/Library/Developer/Xcode/DerivedData/ModuleCache/5CYAJ91AZCB7'
I tried and it worked.
Simply touching the project's pch file solved this issue it for me :
touch Test.pch
Product -> Clean
Product + Option -> Clean Build Folder
Close Project or Workspace
Clean 'ModuleCache' path in Finder.
Worked for me in Xcode6 GM and iOS 8.0.
When the .h file of a Library Provided with Xcode is changed (even a space), this error could occur.
The following maybe tried in order to fix this issue
In, Project -> Build Settings, change Precompile Prefix Header to NO
OR
Run rm -rf ~/Library/Developer/Xcode/DerivedData and Clean Build
I constantly had this since upgrading from Xcode 4.6 to Xcode 5 with iOS projects when using command line build (xcodebuild).
What worked for me is to use this as command line build command:
xcodebuild -project path/to/my.xcodeproj -configuration Debug clean build
Before this, I've tried:
Clean the project in Xcode GUI.
Delete the offending pch file.
Delete the offending pch file's parent folder.
Delete the DerivedData project folder.
None of the above worked for me under Xcode 5.0.2, Mavericks, iOS7.
Note that the problem didn't happen to me when using Xcode GUI.
I just go to directory "/$HOME/Library/Developer/Xcode/DerivedData/", delete everything there
Just Click Product from the menu and select Clean
Product>Clean
Worked fine for me.
I got the same problem. My error said like I need to delete the cache in the below locaition,
Users/myusername/Library/Developer/Xcode/DerivedData/ModuleCache/3FGETKFCU0N0W
3FGETKFCU0N0W was a folder, when I deleted it and then clean build the project. Then the error disappears.
rm -rf ~/Library/Developer/Xcode/DerivedData/
If you use AppCode you can try remove content form:
/Users/[Username]/Library/Caches/appCode30/DerivedData/
Worked for me :)
Also, just open terminal, and delete the .pcm file that has been generated (Xcode 6 onwards)
rm <path-to-pcm-file>
If you get this when switching between git branches, try adding this post-checkout hook which will clean your project every time you change branch.
!/bin/sh
xcodebuild clean -configuration Debug
Save as .git/hooks/post-checkout relative to your project root and don't forget chmod +x .git/hooks/post-checkout
For me, this problem is only occurring in Xcode 6 beta version, So I switch back to Xcode 5, and now problem is solved.
I tried all the steps suggested by all users here, but no one worked for me.
So, if you have both versions of Xcode and have issue only in Xcode 6 beta, then switch to Xcode 5 and clean the project, problem will be solved.
I tried these one by one but failed to build and run my project. So I changed Precompile Prefix Header to NO as mentioned by #Abhilash Gopal, then I reset the simulator,deleted the derived data, removed the corresponding .pcm file(In my case it was the UIImage.h from UIKit framework, so removed the UIKit.pcm).Then I cleaned the project and only then I was able to build it successfully. In earlier versions of Xcode these files were locked basically and were not allowed to edit. But its not the case now. Hope this helps someone who face the same situation.
The only solution there worked for me was running the following command:
sudo rm -R /var/folders/
But that gave me a lot of troubles in OS X.
I thought because /var/folders/ is for temporary files it should be okay to just empty anything in it.
But I was wrong see the following post: link
And the problem you described occurred every-time I tried to build my Xcode project - I'm building it from the CLI though Jenkins.
Which means I couldn't run the rm command every-time. So I found some inspirations and wrote the following ruby script which solved my problem:
#!/usr/bin/env ruby
require 'fileutils'
cache = Dir.glob("/var/folders/**/com.apple.DeveloperTools*")
FileUtils.rm_rf(cache)
I hope it would be helpful to someone.
Deleting project.xcworkspace did a trick for me.
project.xcworkspace is a directory which describes schema of current Xcode workspace state. Each time Xcode is launched it will regenerate project.xcworkspace if not exist already.
In order to delete project.xcworkspace:
Right click on your project file yourProject.xcodeproj
From drop-down menu choose Show Package Content
Purge xcworkspace file
If you are building on command line using xcodebuild remove '-parallelizeTargets' option passed to the command. That fixed the issue for me
After going through a lot of answers and helpful suggestions, I found out the solution to be: Uninstall Xcode 6 and reinstall it through the available dmg file and then install all the components for Xcode.
Product + Option -> Clean Build Folder, Clean Build Project, Deleting Module Cache files and Derived data files, using touch .pch, deleting pcm file, using command line to remove var/folders (Surprisingly, all of this did not help in my case)
Was stuck at it for more than 3 hours before finding the solution. Hope this helps someone.
Thanks.
Just open terminal and fire below command:
rm /Users/pratik/Library/Developer/Xcode/DerivedData/ModuleCache/LKL48GNAN6S7/UIKit-2X95M2Q1NPNPL.pcm
give your file path which return .pcm error. and then Clean Project and Run...Enjoy!!!

I'm getting "clang: error: no input files"

I had a file which I deleted and replaced with another file, somewhere else, of the same name.
Despite cleaning, and trying this multiple times, I keep getting this error:
clang: error: no such file or directory: '/Users/Andrew/App/Version 1.1/XCode/UIImage+Alpha.m'
clang: error: no input files
I can't continue working on my app because of it. Any ideas?
The problem might be because your project > target > Build Phases > Compile Sources is trying to compile a file that doesn't exist. It might be in there twice, like the below screen shot. My project contains UIImage+FFXtras, I can even remove it and re-add it and this won't resolve the problem!
I'm not sure how the project gets into this state - but I know it's not obvious what is going wrong. Highlight the red problem one and remove it.
So have a look in compile sources phase for the file clang is complaining about.
Got the similar troubles.
It seems XCode does not generate correct relative filepath when your project refer to an already existing source tree (relative path does not contain the .xcodeproj in the path of the file to be compiled).
There is a simple fix however: in the project explorer select the file or files files then look at the options in the file inspector. One of them is labeled "Location"; set it to absolut path and try again. This fixed the issue for me :)
Additional to all answers:
delete derived data
reboot
delete derived data
clean
build
Success!
Only this sequence works for me in my case.
I use quite a few cocoa pods and have just had this happen to me. A quick "pods update" sorted things out for me. -phil
If you are using vs code and facing this issue which says
clang: error: no such file or directory: 'filename'
clang: error: no input files
Error while running files:
I solved this issue by removing the space or replacing the space with underscore(_) in the filename .extension
In case everything fails (i.e. first try bames53 suggestion)
Ok, this might be dangerous so make a copy of your whole project first:
close Xcode
locate the project file in the Finder
right click, choose "show package contents"
open project.pbxproj in a text editor of your choice, but not Xcode
search for your file
at the beginning of the line that shows up, you'll see some id like 640450991409CF5C00B3B580. Search for this and delete any line you find.
pay attention, not to break the syntax (balance parenthesis and brackets, pay attention for commas)
when you are done, save the file and try to open the project in Xcode. Add the missing file via the Add file… dialog of Xcode. It is still in the folder of your project — if you added it successfully in the first place — you just got rid of all project references.
dont be surprised, if it doesnt work instantly — you have a copy. copy it again, new try.
And remember: make a copy of your whole project first — for every try. or copying the project.pbxproj might be enough.
Add this line in your pod-file and run pod install:
use_frameworks!
I had this error in monodevelop. I just went to edit>preferences
and changed the default location of the program files. It was set to the monodevelop default they give you when you open a file and not the folder i changed it too.
Likely, you need to adjust the settings of xcode, where you stored your files.
I was seeing this while setting up a React Native project. Solved it using:
sudo xcode-select --switch /Applications/Xcode.app
Source
Comment Quoted from another site was the issue is resolved for me
hmm that's strange. Try this - click on the name of your project on the list of files/folders on the left in Xcode (at the very top of the list). Look at the "Targets" section on the left-hand side of the window to the right. Likely, there's two listed with the second being a "test" item. Right-click on that item and select "delete". Then try to run the project again. See screenshot below for a visual cue.

Resources