‘ld: warning: directory not found for option’ while building iPhone app with Xcode 4
Question: ‘ld: warning: directory not found for option’ warning message pops up when I am building an iPhone application Archive with Xcode 4. The app links two static libraries – namely libOAuth.a and TwitterApi.a – and builds without errors and warnings with Xcode 3.2.5 and strangely with Xcode 4 when the configuration is set to Debug. I was suggested to copy these files to the ‘derived’ folder before I build the app. I copied them to that folder without any improvement. I googled the net but found no solution. I have never met this problem.
Answer: You have an Xcode 3 project which you want to manage with Xcode 4. Xcode 4 is not a facelift. It is a brand new product (for many of us it is a nightmare). In your case this warning is likely fired by a misconfiguration, and you have nothing to do with the derived folder.
1. Open your project, select your target app and navigate to Build Settings tab.
2. Go down to Search Paths group and expand Library Search Paths.
3. Compare your configuration of Debug and Release versions. You will find it different if you can build the debug bundle without warning, but the archive (release) fails.
4. Xcode tries to find your libraries going up and down the folder paths even in an unbelievable depth, but it is lost or can not find your files at their original folder. The search path of Xcode 4 can easily screw up for some reason. You likely have a derived “” – lonely $(SRCROOT) or an empty ../ – string in your configuration and you send the poor Xcode too far away. Remove these paths!