ld: library not found for -lz.1.2.3 - objective-c

When trying to compile the software for iOS 5, XCode 4.2 throws an error:
ld: library not found for -lz.1.2.3
I found this post that tells me to replace 1.2.3. with 1.2.5
https://github.com/dbloete/ioctocat/issues/107
After doing what the link has suggested, it worked for XCode 4.2 but fails for older versions for XCode with the error
ld: library not found for -lz.1.2.5
Has anyone encountered the above situation? How can I resolve this so that it will not fail between the different versions of SDK?

Just use -lz, there's no need to use the versioned link to it. So remove libz-1.2.5.dylib from frameworks and add libz.dylib.

Related

XCode 6 and iOS 8 - Google APIs Client Library for Objective-C linker error

After upgrading XCode from 5.1.1 to 6.0 cannot compile my project - get linker errors:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_GTLDrivePermissionId", referenced from:
objc-class-ref in GTLDrive_Sources.o
"_OBJC_CLASS_$_GTLDriveChannel", referenced from:
objc-class-ref in GTLDrive_Sources.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does anyone know how to fix it?
Try this. It works for me after upgrading the AdMob SDK.
Following the SDK Release Notes you have to link two additional Frameworks:
https://developers.google.com/mobile-ads-sdk/docs/admob/ios/rel-notes
Official release for iOS 8 support.
Ad loading takes less time on the main thread on iOS 8.
Smart Banner ads are correctly displayed in landscape on iOS 8.
Requires linking against two new frameworks: EventKit and EventKitUI. These are auto-linked if modules and auto-linking frameworks are enabled.
Deprecated mediatedAdView property on GADBannerView.
Removed the previously deprecated loadAndDisplayRequest:usingWindow:initialImage: method on GADInterstitial.

Facebook iOS SDK 3.1 with XCode 4.2 linker errors

I've just updated the Facebook iOS SDK in my project from 3.0 to 3.1. The project does not compile anymore. Instead I get the following linker errors:
Undefined symbols for architecture i386:
"_ACFacebookAppIdKey", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookAudienceEveryone", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookAudienceFriends", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookAudienceKey", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookAudienceOnlyMe", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_ACFacebookPermissionsKey", referenced from:
-[FBSession authorizeUsingSystemAccountStore:accountType:permissions:defaultAudience:isReauthorize:] in FacebookSDK(FBSession.o)
"_OBJC_CLASS_$_ASIdentifierManager", referenced from:
objc-class-ref in FacebookSDK(FBSettings.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The Facebook docs clearly say:
The SDK relies on three other frameworks (AdSupport, Accounts and
Social) to use the Facebook features built into iOS6.
Those frameworks do not exist in Xcode 4.2 . Is there any workaround, i.e. can I download (where?) and add the frameworks manually to my project and will that suffice to get rid of the compile errors or do I have to upgrade to Xcode 4.5?
Those frameworks are part of iOS 6 (well, except for Accounts, which is from iOS 5). You won't be able to use them without upgrading to Xcode 4.5, and consequently, iOS 6 SDK.
You can still set your deployment target down to iOS 4.3, if that's your concern.
I think your options are:
Upgrade to Xcode 4.5, or
Use Facebook SDK 3.0.
To make things clear:
For XCode 4.5:
If you use FB SDK3.0, you only need to add Accounts and FacebookSDK frameworks.
If you use FB SDK3.1, you need to add Accounts, FacebookSDK, Social, and AdSupport frameworks.
If you use FB SDK3.2++, check by yourself what other frameworks you may or may not need. ;)
Hope that sums it up nicely for everyone.
The SDK relies on three other frameworks (AdSupport, Accounts and Social).
To add these, go to the 'Linked Frameworks and Libraries' section of the target's Summary pane, and add them.
Sobri is right. Either upgrade to Xcode 4.5 or use SDK 3.0 or If you want to use 3.1 then download the source from github, modify the build file(basically remove the references to frameworks provided by iOS 6.0 ) and rebuild the SDK. That ways you can use the SDK 3.1 as well as run it on older XCode versions.
The following steps may be helpful to resolve this issue
Download Facebook iOS SDK 3.0 from links present in the URL http://developers.facebook.com/ios/features/whats-new-ios-sdk-3/
Add the FacebookSDK framework from Mac Documents directory
Add sqlite3 to project
Then, I've tried the code in http://developers.facebook.com/docs/howtos/login-with-facebook-using-ios-sdk/ with the following changes (as it is for Facebook iOS SDK 3.1)
Replace openActiveSessionWithReadPermissions with openActiveSessionWithPermissions
Replace [FBSession.activeSession handleDidBecomeActive]; with [FBSession activeSession];
This worked for me. Try it once.
Thanks,
prodeveloper.

Static library(ARC) work on non ARC app, met error: dyld: lazy symbol binding failed: Symbol not found: _objc_retainAutoreleasedReturnValue

Xcode 4.3.2
I wrote a static library, using ARC.
When I put it into a project, and test on iOS 4.3 simulator. (base on iOS 5.1, deploy target 4.3)
If the project using ARC, it works fine.
If the project not using ARC, met errors, such as:
dyld: lazy symbol binding failed: Symbol not found: _objc_retainAutoreleasedReturnValue
Referenced from: /Users/cnzzmobile/Library/Application Support/iPhone Simulator/4.3.2/Applications/A4EEB0A0-AC16-402C-B426-46667225F66D/test.app/test
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation
dyld: Symbol not found: _objc_retainAutoreleasedReturnValue
Referenced from: /Users/cnzzmobile/Library/Application Support/iPhone Simulator/4.3.2/Applications/A4EEB0A0-AC16-402C-B426-46667225F66D/test.app/test
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation
I searched a lot, but can't find an answer can solve this problem.
I remove jsonobjcet which only supported by iOS5, and -fobjc-arc also doesn't work.
Thanks
I found add "-fobjc-arc" at "other linker flag" can solve this problem on Xcode 4.3.2 based on iOS 5.1. Because the xcode can't find the lib which support ARC to link.
Notice that: add "-fobjc-arc" at "other linker flag" not at "Compile sources".
But this still doesn't work on old version Xcode 4(snow leopard) based on iOS 4.3.
I found some lib can work on both ARC and non ARC project without adding any special setting. I'm still waiting for the answer how to do this. Write code using pure C?
_objc_retainAutoreleasedReturnValue is a function of iOS 5.x's version of arc. You are attempting to build this framework and run it on iOS 4.3, which requires you to specify and deploy it for iOS 4.x, which runs the "ArcLite" framework.

Compiling link error with xcode 4.2 for my iphone apps

I pass to xcode 4.2 and when I compile I have this error:
ld: library not found for -lz.1.2.3
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang
failed with exit code 1.
I am assuming lz is supposed to be libz. If that is the case, you are looking for a very specific version of the lib, so you're problem can be fixed by changing it to 1.2. This is done where you add frameworks (Coredata etc) in Xcode.
Hope this helps.

Trying to hack the AWS IOS SDK so that it works for OSX. I get this error

I've removed the import of the UIKit framework, and now I get this error. Do I have to somehow recompile the framework? It's not really giving me anything to go on...
And if it means anything, I am able to run the SDK examples in IOS so there aren't any system requirements that I'm not meeting.
ld: warning: ignoring file /Developer/SDKs/MacOSX10.7.sdk/Library/Frameworks//AWSiOSSDK.framework/AWSiOSSDK, missing required architecture x86_64 in file
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_AmazonS3Client", referenced from:
objc-class-ref in Constants.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You can't just use the .framework provided by Amazon, because the binary is only for iOS. You need to rebuild the framework from the source, which thankfully comes in the SDK.
I created a XCode project with the source from the iOS SDK that appears to work. I have only tested some of the rudimentary S3 code but since it works in iOS, presumably, and I am able to communicate with S3, I think it should be good for all the services it supports.
https://bitbucket.org/danap/osx-aws-toolkit
Please feel free to fork and submit pull requests with changes.
I've created a fork of the AWS iOS SDK which can be built and used for Mac OS X development. Check it out: https://github.com/amberdixon/aws-sdk-ios. In the readme, I've included instructions on how to build the Mac OS X-compatible version of the AWS iOS SDK framework, which you can import into your OS X projects.