Weird Xcode linker error - ios

I'm getting this Xcode error:
ld: warning: directory not found for option '-L/Volumes/Macintosh HD2/Users/dgd/Dropbox/Websites/iCalTools.com/CalendarFilter/iCal'
ld: warning: directory not found for option '-LFilter/TestFlightSDK3.0.0'
ld: library not found for -lTestFlight
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My code is at this path:
/Volumes/Macintosh HD2/Users/dgd/Dropbox/Websites/iCalTools.com/CalendarFilter/iCal Filter
and it appears Xcode is choking on the 2nd blank for some reason and incorrectly splitting the path to TestFlight.
The really strange part is if I delete the TestFlight API and it's Library Search Paths, then add it back in, it compiles and runs fine, even though the library search paths appear to be broken at the space still:
Everything continues to work until I close the project and reopen it. Then I have to remove and readd TestFlight again.
(One more note, I tried to remove the blank from the directory but ran into so many more Xcode and git problems trying to rename it that I gave up and reverted back. At some point during that process I ended up with exactly the same problem with Xcode choking on the blank in "Macintosh HD2" instead)
EDIT
I emailed TestFlight support about this issue and received the response below which fixed the problem. I had tried most of these steps before except for deleting the files from disk (I did have several old copies of TestFlight on disk, but not in the project) and possibly checking the Copy Items box. I still don't know what the problem really was and consider this a workaround, so I'm not adding this as an answer. Maybe someone will be able to explain what's going on here.
Sorry for the trouble.
These errors usually come up if there are issues with the Library Search Paths. Please remove the "Filter/TestFlightSDK3.0.0" line and then do the following:
Open Xcode and select all the TestFlight SDK files in your project (libTestFlight.a, TestFlight.h, TestFlight+AsyncLogging.h, TestFlight+ManualSessions.h)
Delete all the selected files by choosing the move to trash option
Open your project in Finder (Right click the main project folder and select show in finder)
Double check for TestFlight SDK files and delete any found.
Download the TestFlight SDK v3 again and extract the zip
Drag and drop the contents of the SDK folder into your project. At the adding files prompt, check off the defaults (Copy items, Create groups, add target)
Clean the build and attempt to create a new IPA

Try using quotation marks to separate items in the path.
$(inherited) "$(SRCROOT)" "$(SRCROOT)/../Dependencies/Frameworks"/** "$(SRCROOT)/MobileAppTracking-ios" "$(SYSTEM_APPS_DIR)/Reveal.app/Contents/SharedSupport/iOS-Libraries"
I have a project where our Framework search path looks like the above. That may help with paths that have spaces. If all else fails, can you try escaping spaces or moving your libraries to a path that does not include a space?

For paths in Xcode containing blanks just put quotes around the path (same for all settings that take paths: includes, search paths, etc.
"/Volumes/Mac HD/Users/The Count of Tuscany/Source/My Stuff/"

I got the same type of issues with it.
Just go to Build Settings. Type "search path" in the search box provided. Then see the references for your third party library. Delete the values.
Now go to your project file menu which displays your program files. Then delete the third party libraries for which you have linker errors. Make sure to backup these, as you'll need them in next step.
Now drag the same libraries you have in other folder or backup folder into your xcode project.
Now build.
I solved the same by the above steps. It usually happens when you move your xcode project from from one user/ mac to another. Or else if the libraries are missing as per the references.

Related

Xcode project/app name with spaces issue - framework not found

Is it possible that Xcode 6.1 doesn't finds my previously imported frameworks because of my 3 word app name? I'm using Parse and never ever had any problems with it. But actually when I open my project in Xcode I got an error that the framework doesn't found, which is absurd because it worked well earlier and I don't removed it. However if I delete the frameworks and add them again everything is fine. Am I doing something wrong or is it an Xcode bug?
ld: warning: directory not found for option '-F/Users/donip/Documents/Fl Travel Guide/Fl'
ld: warning: directory not found for option '-FTravel'
ld: warning: directory not found for option '-FGuide'
ld: framework not found ParseFacebookUtils
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Simply enclose your framework path in double quotes(""). For example:
"$(SRCROOT)/my framework/path"
"directory not found for option '-F/..."
Here '-F/..' shows it's a Framework Error. There could be 2 reasons for this.
Missing escape "\" character.
It seems search paths are broken up on several lines in the Framework Search Path or Library Search Paths. Or having spaces in path. Add the escape "\" character to fix it.
Click on your project (targets)->
Click on Build Settings->
Under Frameworks Search Paths, delete the paths.
I'm sure this is Xcode bug. Since a lot of other developers have problems with
frameworks paths, such as Absolute path issues
I'm sure You will find other issues too in SO.
I have encountered this issues myself too.
Best solution for me just commit working project files, and then
reset/revert new/wrong changes which done by Xcode.
For me, I had to delete (using Terminal):
/Users/xxxxxxx/Library/Developer/Xcode/DerivedData/PROJECT_NAME
Using:
rm -r PROJECT_NAME-xxxxxxxx
If you have multiple projects with the same name in the /DerivedData folder, first try deleting all but the most recent one. If that does not work, try deleting all projects including the most recent.
Just update your library location to such a path which doesn't have any spaces inbetween. For example, instead of :
'-F/Users/donip/Documents/Fl Travel Guide/Fl'
use
'-F/Users/donip/Documents/FlTravelGuide/Fl'
Just change the folder name, available in that path, then make the same change in project settings in Library Search Paths and Header Search Paths, wherever its been referred.
Hope this will resolve your query.

Xcode .pch error while compiling. clang file not found

I have a very annoying problem.
I backed up my code on Dropbox but now i get this error while compiling
clang: error: no such file or directory: '../firstFoo-Prefix.pch'
Since the only .pch file in my project in Xcode and my project folder is secondFoo-Prefix.pch and I don't know how to fix this error I've decided to remove every .pch file so i went into Project> Build Settings and removed everything in the Prefix Header and set Precompile Prefix Header to NO.
Before this the Prefix Header had value secondFoo-Prefix.pch and not firstFoo-Prefix.pch.
Even though the compiler should not look for .pch files I still get that error.
I've looked everywhere in my project but I can't seem to find anywhere firstFoo-Prefix.pch.
Any ideas?
Thank you
This can occur (not your fault) when the Xcode project file database gets messed up such that the referenced file does not appear in the navigation area but is still somehow included in one of the various list of files used for the build phases.
To see if this is the case:
In the Finder, right click on the project file and select 'Show Package Contents'
Right click on the file 'project.pbxproj' and 'Open With->TextEdit.app'
In TextEdit menu: 'Edit->Find->Find...' [or command-F] then enter '.pch'
Look at all occurrences of '.pch' [command -G to move to next one]
If you find occurrences of '../firstFoo-Prefix.pch' then your project file is corrupted. Looking at the context of the occurrence(s) will give you some indication of which area the corruption occurs in (e.g. build phase compile files list).
Sometimes just deleting those references (after having backed-up the project file of course) has worked for us but other times it just makes matters worse. The safest recovery is to create a new project file and copy over all the folder groups and settings manually. Your source code is all fine, it's just the cross-references and build settings that need reworking.
Do a clean for build using this combination: Shift+Option+Command+K
In my case, I have Framework which need to add to main project from derived data after it building successful. So copy items if needed was not tick marked and that's why giving error and also #ZAZ and #chiwangc mentioned cleaned it before building.

Xcode 5 Architecture i386 multiple duplicate symbols

I found the source folder for architecture i386, by copying the path specified by the error message in Xcode. There were several .o files which apparently were conflicting, however whenever I deleted one, and ran the program, it would replace it. What do I do? Also I've cleaned it and closed everything and restarted my computer. Thanks
The .o files are just the compiled versions of your source code, which is where the conflicts really lie. What you have is several things named the same thing, and the linker is stressing out over it. Take one of the error messages, you'll probably identify the name it says is conflicting (not the file, the symbol), it might have extra padded symbols, but you should recognize a method name or variable name that you used. Search for that in Xcode, and see where you're defining it more than once. A symbol can have only one definition, so if you're using it in multiple cases, you need to resolve that.
Possible Issue
This problem usually happens when you import .h files to Compile Sources.
Possible solution
Steps to clean project
Click on your project
Select target of your project
Go to Build Phases
Expand Compile Sources
Remove all files there
Steps to configure it again
On Compile Sources click + to add files again
Highlight .m on search
Add all .m files to your project
Clean project by going to Product->Clean on XCode Menu
Click run, and hope it will work!

directory not found Apple Mach-O linker warning but Library Search Path and Framework Search Path are empty

I'm getting these messages:
ld: warning: directory not found for option '-F"/Users/joel/Development/GHaikuTabbed"'
ld: warning: directory not found for option '-F"/Users/joel/Development/GHaikuTabbed/../../../Downloads"'
But when I go to Build Settings (as suggested at ‘ld: warning: directory not found for option’), Library Search Path and Framework Search Path are empty, so there's nothing to delete.
Thoughts on other things I can do to get rid of this warning?
Here is a description how to avoid a problem based on Apple Dev Forum posted before. It works for me so I repost description for those people who don't want to go and register at the forum.
The bug is due to an error in XCode 5 when it deals with the user adding new files or folders to the project.
Xcode is modifying the 'Library Search Paths' build setting, and making a god-awful mess of it.
Instead of adding $(SRCROOT)/ it is adding fully rooted paths to all new items, and adding random amounts of /// into other elements of the string.
It also seems to be duplicating source paths in some instances, probably because it's broken the existing ones, and thinks they need adding again.
The solution:
Copy out your Library Search Paths string into a text editor.
Remove any fully rooted paths that shouldn't be there, and replace them with the usual $(SRCROOT)/MyFiles/ type paths.
Remove all extraneous slashes and make sure each path has a " character at beginning and end to protect against spaces in filenames.
Paste the edited string back into Build Settings.
Clean, then Build. Should be back to normal.
This error may well recur if you add new files to your project, so beware.
My project.pbxproj looked like this:
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\\\"$(SRCROOT)/AdMob-v6.4.1\\\"",
"/MyProject/AdMob-v6.5.1",
);
I closed MyProject, deleted the line containing AdMob-v6.4.1, reopened the project, performed a "validate project settings", cleaned, and built, and now all is well.
Yeah, Xcode is jenky sometimes.
Did you try cleaning your build (Product > Clean Build Folder / Shift-Cmd-K) and trying again?
Another thing you can do is to search for the two entries in [project_name].xcodeproj/project.pbxproj, remove them, close XCode, re-open, Clean Build Folder and try again.
Good luck!
To summarise what #user2963906 is suggest, I show my solution to this problem, which I think much easy.
I assume that you have all your files and libraries in your project folder.
Open your project Targets
Find Search Paths topic and Library Search Paths
Choose and remove all paths here
Then add path like this: $(SRCROOT)/"Your App Name"
In the same window change drop-down list from the right from non-recursive to recursive
Shift-⌘-K and Run your project
I found a solution for this with my case on the iOS Developer Forums. It happened to me with Xcode 5. See Massive Linker Error Warnings (directory not found for option) yet . For me it was caused by Xcode 5 junking up the "Library Search Paths" build setting.
Easy Solution :
It's work for me
when you want to add new files or folders to the project through xcode 5 and above error display.Just follow below simple step.(Please don't forgot to get backup of your project).
Open your Project in Old XCode (I recommend XCode 4.6.3)
Add your files or folder. (it will not mess your library search path as it mess in XCode 5)
Close the old xcode and open your project with XCode 5 and start to code.
I faced the same problem but was unable to fix it as per the steps since no library folders were getting displayed in the Project properties window.
So I solved it in another way (you need to be able to use the Terminal and the VIM editor. Also take a backup of the project just in case)
Open a Terminal window
Go to the project folder.
The XCode project is a folder. use cd project name to go into that folder.
use vim to open and edit the project.pbxproj file.
Remove reference to the offending lines by searching using / and using the dd command on that line to delete it.
Save using :wq command
Open the project in XCode and build. Works like a charm.
I had to escape any spaces with a \
So for example:
/Users/Me/Folder\ with\ spaces\(and\ brackets\)
in Library Search Paths
This worked for me :
Create this real directories (with no content), add them to project, remove via remove reference, clean, delete for real
In project folder -> target , under 'Build Setting' search 'library search paths' and simply delete previous path in Debug & Release area.
Now add the line below line using + symbol
$(PROJECT_DIR)/Library
Note: After adding the above line click out from popup. its automatically display the full path.Then check this path with your Finder if any correction add after the $(PROJECT_DIR)/
Clean , Build and Run … Simple its cleared that error. :)
-Anup

Xcode 4.1 fatal error: stdlib modified since the precompiled header was built

Building an iPhone app, using:
Xcode 4.1
Base SDK iOS 4.3
Apple LLVM Compiler 2.1
I have started getting the following error:
fatal error: file
'/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/../lib/clang/2.1/include/stdint.h'
has been modified since the precompiled header was built
I have tried reinstalling Xcode and OS X - no luck. What's causing this?
First try a clean build via the Product -> Clean menu (as of XCode 4.6.2).
If that still doesn't work then open the Organizer (from the menu select Window->Organizer). Once the Organizer is open, select Projects from the toolbar at the top of the window. On the left is a list of projects, select the one you are having a problem with.
The details panel (to the right of the list) will display the project name, location, status. The row beneath that shows where the Derived Data is located. Click the Delete... button the far right. A dialog will appear, click Delete.
You can also manually delete the Derived Data:
~/Library/Developer/Xcode/DerivedData/{project name + gobly-gook}
This directory contains built products and indexes for the project. It is OK to delete it because it only contains items generated by Xcode. Xcode will regenerate everything next time the project is opened.
I was able to fix it in a much easier way, by simply choosing Product > Clean, then Product > Build from the Xcode menubar.
Deleting the DerivedData folder did not work for me when Archiving.
I had to look at Build Settings - Build Locations - Precompiled Header Cache Path and delete that folder.
For me that was:
/var/folders/_w/t0mj70hd1439tqgxff7_mtt00000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders
I thought I would add a separate answer rather than a comment to Cryptognome's answer, because it is in fact a different solution when the issue comes from running xcodebuild. Like Cryptognome, I had the error come up with the command-line tool xcodebuild. As an alternative to manually going into the /var subfolders, I found that I could set my own cache for the shared PCH, which you can do by setting the environment variable SHARED_PRECOMPS_DIR, e.g as follows
xcodebuild -target Foo -configuration Release SHARED_PRECOMPS_DIR=/tmp/foo/SharedPCH
This way, I never get the error in automatic builds.
Note in the above command, I would also typically set the OBJROOT and SYMROOT env var to build also in /tmp. At the end, I clean things up.
The xcodebuild command line tool sometimes fails with this error. This happened to me when I synched an svn workspace to an earlier build. The xcodebuild tool keeps its precompiled headers in the folder Ants mentioned:
/var/folders/... scrambled eggs .../-Caches-/com.apple.Xcode.503/SharedPrecompiledHeaders/
You have to look in the build command itself to see the actual folder name (-include /var/...), but it may be using several if you're building for different architectures (arm6, arm7, simulator, e.g.) So if you're having this problem with a command line build, just delete everything in /var/.../SharedPrecompiledHeaders.
Remove the contents for the Simulator by iOS Simulator > Reset Content and Settings... and hit Rest. This will remove any existing pre-compiled instances of the headers and resources. This worked for me
Solution:
1)Product->Clean
2)Product->Build
Error Type:
a kind of Build error
One of the causes:
one might have changed the framework file.
This sometimes happens when a change is made to a framework that another framework depends upon. The precompiled header cache gets out of sync, and Xcode is unable to compile the given project.
One of the Scenarios:
one might have chosen Jump To Definition and did some change after selecting a framework control.
I was able to get rid of this error simply by cleaning (command+shift+K) and rebuilding.
I tried above all but no use. Finally I deleted Xcode and re installed again. Now it is working fine..
Xcode->delete->install again
It might help some one...
I had this error on cordova when I ran : cordova run ios
fatal error: file '/Users/.../cordova/platforms/ios/CordovaLib/CordovaLib_Prefix.pch' has been modified since the precompiled header
'/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/CordovaLib_Prefix-bfgesbulnxtdepfwgniffeysypgv/CordovaLib_Prefix.pch.pch' was built
note: please rebuild precompiled header
'/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/CordovaLib_Prefix-bfgesbulnxtdepfwgniffeysypgv/CordovaLib_Prefix.pch.pch'
1 error generated.
** BUILD FAILED **
The following build commands failed:
CompileC build/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/armv7/NSDictionary+Extensions.o Classes/NSDictionary+Extensions.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC build/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/armv7/CDVInvokedUrlCommand.o Classes/CDVInvokedUrlCommand.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
I tried with clean and build but doesn't work, finaly I removed the folder '/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode' and works!
This tip, may be help others
Clean ways are not working for me, eventually I solved this issue by reinstall XCode.

Resources