Reputation: 774
This is a bugger and it's been frustrating me for some time.
I get this output when building my Xcode project:
ld: library not found for -lz.1.2.3 clang: error: linker command failed with exit code 1 (use -v to see invocation)
The entire output:
Ld /Users/Yashwant/Library/Developer/Xcode/DerivedData/LROAuth2Demo-eviojihhpjtuqxfkfctmczczudhr/Build/Products/Debug-iphonesimulator/LROAuth2Demo.app/LROAuth2Demo normal i386
cd /Users/Yashwant/Downloads/OAuth/LROAuth2Demo
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export 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.1.sdk -L/Users/Yashwant/Library/Developer/Xcode/DerivedData/LROAuth2Demo-eviojihhpjtuqxfkfctmczczudhr/Build/Products/Debug-iphonesimulator -F/Users/Yashwant/Library/Developer/Xcode/DerivedData/LROAuth2Demo-eviojihhpjtuqxfkfctmczczudhr/Build/Products/Debug-iphonesimulator -filelist /Users/Yashwant/Library/Developer/Xcode/DerivedData/LROAuth2Demo-eviojihhpjtuqxfkfctmczczudhr/Build/Intermediates/LROAuth2Demo.build/Debug-iphonesimulator/LROAuth2Demo.build/Objects-normal/i386/LROAuth2Demo.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework Foundation -framework UIKit -framework CoreGraphics -framework SystemConfiguration -framework CFNetwork -lz.1.2.3 -framework MobileCoreServices -Xlinker -dependency_info -Xlinker /Users/Yashwant/Library/Developer/Xcode/DerivedData/LROAuth2Demo-eviojihhpjtuqxfkfctmczczudhr/Build/Intermediates/LROAuth2Demo.build/Debug-iphonesimulator/LROAuth2Demo.build/Objects-normal/i386/LROAuth2Demo_dependency_info.dat -o /Users/Yashwant/Library/Developer/Xcode/DerivedData/LROAuth2Demo-eviojihhpjtuqxfkfctmczczudhr/Build/Products/Debug-iphonesimulator/LROAuth2Demo.app/LROAuth2Demo
I have had few "linker command" failures before, but they seem to be fixed by simply cleaning the project and re-building. In this case, I was pointed out that I had to install the command line developer tools for Xcode 5, but unfortunately the error still doesn't go away.
For complete assurance I checked if I had actually installed them by using pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
and it returns:
package-id: com.apple.pkg.CLTools_Executables version: 5.1.0.0.1.1393561416 volume: / location: / install-time: 1396984437 groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group
So I restarted my computer, but still no results.
Upvotes: 0
Views: 661
Reputation: 774
The problem as @photoionized pointed out was partly due to the version of zlib
or libz
. Because the project was old it was using libz.1.2.3
instead of the latest libz.1.2.5
. So to update that, I found this question.
Basically I had to delete the old one and replace it with the new one.
Link against the libz.dylib, but add it through the Build Phases tab.
Project >> Target >> Build Phases >> Link Binary With Libraries
Press + under the list and select the libz.dylib then it will add the lib so it will work inbetween SDK updates.
Upvotes: 1