问题
I've been creating some app for some months, and suddently Xcode 5 doesn't want to build it. It just complains with the following error.
Ld build/Debug-iphonesimulator/appname.app/appname normal i386
cd /Users/myname/proyectos/appname/dev/iOS/appname
setenv IPHONEOS_DEPLOYMENT_TARGET 5.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.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/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -L/Users/myname/proyectos/appname/dev/iOS/appname/build/Debug-iphonesimulator -L\"/Users/myname/proyectos/appname/dev/iOS/appname/appname/External/FlurryAnalytics\" -L\"/Users/myname/proyectos/appname/dev/iOS/appname/appname/External/SmartADServer\" -L\"/Users/myname/proyectos/appname/dev/iOS/appname/appname/External/TestFlight\" -F/Users/myname/proyectos/appname/dev/iOS/appname/build/Debug-iphonesimulator -F/Users/myname/proyectos/appname/dev/iOS/appname/appname/External -filelist /Users/myname/proyectos/appname/dev/iOS/appname/build/appname.build/Debug-iphonesimulator/Appname.build/Objects-normal/i386/appname.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=5.1 -weak_framework AdSupport -framework Security -framework MessageUI -framework Twitter -framework CoreLocation -weak_framework CoreMotion -framework AudioToolbox -framework AVFoundation -framework MediaPlayer -framework SystemConfiguration -framework MobileCoreServices -lz -framework CFNetwork -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -lTestFlight -framework comScore -lFlurry -Xlinker -dependency_info -Xlinker /Users/myname/proyectos/appname/dev/iOS/appname/build/appname.build/Debug-iphonesimulator/Appname.build/Objects-normal/i386/appname_dependency_info.dat -o /Users/myname/proyectos/appname/dev/iOS/appname/build/Debug-iphonesimulator/appname.app/appname
ld: warning: directory not found for option '-L"/Users/myname/proyectos/appname/dev/iOS/appname/appname/External/FlurryAnalytics"'
ld: warning: directory not found for option '-L"/Users/myname/proyectos/appname/dev/iOS/appname/appname/External/SmartADServer"'
ld: warning: directory not found for option '-L"/Users/myname/proyectos/appname/dev/iOS/appname/appname/External/TestFlight"'
ld: library not found for -lTestFlight
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If I understand it ok, it complains about testflight, but I haven't changed anything about it in weeks. It compiled it perfectly.
I have to say I've tried adding Adobe ADMS tracking library onto the project (but then undoing its addition). And then after that, linker errors appear.
Any hint? I'm COMPLETELY at lost and frustrated. Are my project files corrupt maybe? (Let's hope not!!) Any hope to recover them in such case?
Greetings
回答1:
"Problem solved".
Apparently it seemed (as ahwulf said, and I suspected) that my Project paths/libraries/headers where somehow corrupt inside Xcode 5.
What was my solution? After more additional tests, I just physically removed some of my apparently conflicting libraries (testflight, flurry, etc...) from the project (and ALSO from disk) and started compiling, waiting for the obvious compilation errors that would appear.
When they appeared, I just re-added the files XCode asked me to add (one file/library at a time), and then one by one, all these errors started to slowly disappear. My original linking error ALSO disappeared, so my project builds again.
I have the feeling I don't really know what I did, but "it worked".
回答2:
Something that worked for me in this situation was to remove 'libTestFlight.a' from my Link Binary With Libraries section in the Build Phases and clean my project then redrag it into this section from my File tree. (Of course if you want to use Testflight in your app make sure that you also have libz.dylib as a framework and the associated TestFlight files are also included in your project such as TestFlight.h, TeshFlight+AsyncLogging.h and TestFlight+ManualSession.h - if libz.dylib gets deleted and then readded it can cause this error). Good luck code warriors!
回答3:
XCode 5 appears to have a bug where it spontaneously adds an extra absolute path in build settings. Bitten me a couple of times already.
回答4:
I had the identical error for a very different reason.
Having upgraded from TestFlight 1.2.4 to TestFlight 2.0.2, the build worked on my own machine, but a nightly build on a different machine failed.
The simple reason that the library wasn't found was that it hadn't been committed. Our .gitignore is set to ignore .a files, so libTestFlight.a had not been included. Opening the project in Xcode made this more obvious than the command line build log.
git add -f sorted this out.
回答5:
I've faced the exact same problem with adding TestFlight 2.0.2. And it was also conflicting with Flurry (and some others). Removing (reference!) and re-adding all conflicting libraries with TestFlight being last helped me. But firstly don't forget to delete Library Search Paths.
来源:https://stackoverflow.com/questions/19278538/no-changes-in-testflight-libraries-and-xcode-5-now-says-ld-library-not-found-f