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

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?

Related

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

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.

Issue with running application on iOS9 XCode 7

After several hours of investigation I am stuck with this one. After migrating from Swift to Swift2 I manage to deal with all the errors, but in the end I got clang error:
ld: file not found:
-L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I am not really sure why does this happen nor how I can resolve it. Some of you got similar problem ?
I tried :
close/open XCode
clean build
clean build folder
delete derived data
tried to add another device (Devices screen, add simulator)
tried to build for iOS device ( same error, just instead of iphonesimulator i got iphoneos )
opened particular folder, everything is there
I am able to open iOS simulator from code
EDIT, Oct-9-2015:
After a bit more investigation, I found out following:
Pods compile correctly. Every one of them.
If I remove iphonesimulator/iphoneos they don't work
Tried to clear Library path, set it to various differenet values - no success (Library path because of -L at the start).
Found out that swiftCore is somehow missing in path:
Unable to find swiftCore; please set SWIFT_LIBRARY_PATH (currently '')
to the folder containing swiftCore.
Building from terminal to get more info about the error.
Tried to restart computer, reinstall XCode and other most common things
Tried other project - working without problem(project without pods)
Seems like this will be a diary till I commit suicide...
After 2 days of losing my mind, finally got to the solution. Hope it will save someones day :)
First, I decided to recreate the project file and pods to see if there is something wrong with them. It turned out they are fine. Project build without any issue.
So, clearly, problem was in the project/workspace file. I started comparing flag by flag, and ended up in changing the following:
Duplicate Pods_X.framework - removed one
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO - was YES before
GCC_SYMBOLS_PRIVATE_EXTERN = YES; - was no for debug
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - was something long before
If someone knows why this flags could produce something that painfull I will be happy to find out...

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 ) :)

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.

Xcode linker Directory not found for option

Xcode 4 is throwing me a warning about directory not found for option '-L/Users/t2wu/Documents/blah blah'. Yes it shouldn't be found because I removed it. I remove the directory and I also removed the directory setting in both the target and the project library search path. I also remove the .a file which I was linking before from the "Link binaries with Libraries". It compiles fine, it just gives me the warning. Why is it still having the -L flag?
Check the Build settings tab and make sure that the "Library search paths" option is empty.
At last resort, fire up Terminal and cd to the app project directory (appname.xcodeproj) and do a fgrep for the erroneous search path. I've found some of these lurking in the project.pbxproj file; ended up editing the file manually to get rid of them. (Of course you should make a copy of the file before doing so, in case you trash the project file.)
It'd also be worthwhile to do a "clean" on the project. How to Empty Caches and Clean All Targets Xcode 4.
I had the same issue in my project, it contains multiple custom framework created by me and the project. My issue is resolved by removing 'Framework search Paths' and 'Library Search Paths' from the target which has this issue.
In my case in targets -> build settings I removed searchpaths for which errors occured. Then removed libraries from project and added them again.
You may need to clear the Search Paths for the Tests target as well as the main project. This had me stumped for a little while.
I checked the library search path
I went to Build settings -> Search Paths change the "Framework Search Paths" to $(inherited)...that solved my problem
Sometimes, this error occurs if you open Project.xcodeprojinstead of Project.xcworkspace. Check your project directory and make sure to open Project.xcworkspace.

Resources