Xcode gives Apple Mach-O linker error - ios

I just compiled a project and Xcode returns these two errors which don't seem to be my code's fault. How do I fix them?
Undefined symbols for architecture i386:
"_vImageBoxConvolve_ARGB8888", referenced from:
-[UIImage(Blur) boxblurImageWithBlur:] in UIImage+Blur.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Teaching a man (or women) how to fish:
Usually Mach-O Linker Error means you have not included a header file for a function you are using in your code.
Easiest way is to copy that function or method call and paste into Xcode quick search using shift+command+O. This will search all frameworks (and header files), find that function or method call and show you its location (the header in this case):
In this case, this call belongs to the Accelerate framework so on top of your file, enter:
#import <Accelerate/Accelerate.h>
When doing quick search, you might have to get rid of leading underscore. In other words, search for vImageBoxConvolve_ARGB8888
Hope this helps

Google is your friend: someone else fixed this by adding the Accelerate framework to their project (and this does look like a framework error).
https://github.com/rnystrom/RNBlurModalView/issues/5
Make sure you also have the QuartzCore framework included as well, as that is also required by that library.

Apparently vImageBoxConvolve_ARGB8888() is not defined. See if the Accelerate framework is properly included in the project.

Related

Contradicting frameworks on -ObjC

So in my project I have the FacebookSDK, the ParseSDK and FirebaseSDK. Facebook and parse both need bolts, so I implemented that. However it will not compile unless I remove the -ObjC flag. The problem is that if I remove this tag, the code will compile, but It will cause a runtime error when trying to initialise Firebase because it requires -ObjC. I am in a mess. Can I set the flag only for that specific framework? Thanks for any help.
( I think this should be a comment, but I don't have enough rep yet, hope this helps to solve this.)
I'm having the exact same problem (with SponsorPay SDK instead of FirebaseSDK), Facebook SDK & Parse work fine together until i add the -ObjC flag, needed by SponsorPay to work.
Deleting Bolts.framework is not the solution, since that gives some linking errors:
"_BFTaskMultipleExceptionsException", referenced from:
___53+[PFObject(Private) deleteAllAsync:withSessionToken:]_block_invoke214 in Parse(PFObject.o)
___65+[PFObject(Private) _deepSaveAsync:withCurrentUser:sessionToken:]_block_invoke311 in Parse(PFObject.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I get the exact same error if I use the Bolts.framework included in the FacebookSDK package.
But, using the Bolts.framework included in the Parse Library I got a different error:
ld: 91 duplicate symbols for architecture x86_64
All frameworks and libraries are updated.
EDIT:
Using cocoapods solved the problem for me too!
See: FacebookSDK and Bolts conflicting each other (duplicate symbols) on build.
I would suspect that Facebook is broken, and is including bolts itself. No thirdparty framework should include another thirdparty framework, since it leads to exactly this. All third-party frameworks should be linked at the final application stage. Go into any frameworks that link their own sub-libraries, and remove the sub-sublibraries (and open bugs against the offenders).

linking springboard in iOS tweak

I'm trying to develop a simple ios tweak that uses some springboard components. I've dumped the headers and included the one I need (SBLockScreenNotificationScrollView.h), but when I compile I get a linker error:
Undefined symbols for architecture armv7s:
"_OBJC_CLASS_$_SBLockScreenNotificationScrollView", referenced from:
objc-class-ref in NotificationSwipe.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've tried copying the SpringBoard binary from phone and adding it under Link Binary with Libraries in xcode. Thanks for the help.
When you don't have class implementation or library it defined in you have to obtain the class at runtime. This is what objc_getClass function is for. It returns an objc class at runtime and gives you the ability to use the class without knowing anything about him at compile-time.
Just replace SBLockScreenNotificationScrollView with objc_getClass("SBLockScreenNotificationScrollView").
I suggest you read about objective-C runtime. Developing tweaks requires you to understand at least basics in which case you wouldn't ask this kind of questions.

Conflicting libraries in iOS project

So basically I have two libraries that are I think conflicting with each other. I have the following settings for the key "Library Search path":
"$(SRCROOT)/projectname/Release-iphone/lib" for one of my libraries, and "$(SRCROOT)/projectname" for another.
I have added a CorePlot library into my project but to work it requires the following Linker Flags: -ObjC -all_load.
Now when I add one or both of them I get the following message and my project won't build:
duplicate symbol _OBJC_CLASS_$_GTMHTTPFetcher in:
/Users/user/Library/Developer/Xcode/DerivedData/projectname-chibchblpntaapfagqcohtkixhib/Build/Intermediates/projectname.build/Debug-iphoneos/projectname.build/Objects-normal/armv7/GTMHTTPFetcher.o
/Users/user/Dropbox/Projectname/projectname/projectname/libGTLTouchStaticLib.a(GTMHTTPFetcher.o)
duplicate symbol _OBJC_METACLASS_$_GTMHTTPFetcher in:
/Users/user/Library/Developer/Xcode/DerivedData/projectname-chibchblpntaapfagqcohtkixhib/Build/Intermediates/projectname.build/Debug-iphoneos/projectname.build/Objects-normal/armv7/GTMHTTPFetcher.o
/Users/user/Dropbox/Projectname/projectname/projectname/libGTLTouchStaticLib.a(GTMHTTPFetcher.o)
ld: 176 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The problem turns out to be with the Google API library libGTLTouchStaticLib.a but I don't get how do linker flags influence it.
It looks as though you have the source file included directly into your project as well as having a link to the library. You should choose one or the other (probably the library).
screw -all_load that was a hack to load categories. should work without it

Cocoa Static Library with ZXing error

My project uses some Cocoa static libraries, one of which is a Zxing Project. I am getting a lot of errors while trying to incorporate this project. Weirdly enough, I was able to create a demo with Zxing in a separate project, without any errors. My main project builds and runs ok, as long as I do not include the Cocoa static library for Zxing.
So the question is, how do I include the ZXing static library to my Cocoa project? How do I configure library (e.g. how do I set the Header Search Paths~~).
Thanks.
Some detail about my project
The Structure
EnjoyMobile
-CustomStaticLibrary.xcodeproj
-ZXingWidegt.xcodeproj
Header search Paths in my -CustomStaticLibrary Target
./zxing/iphone/ZXingWidget/Classes
./zxing/cpp/core/src
The error
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_QRCodeReader", referenced from:
objc-class-ref in libCustomerLibrary.a(CustomerViewController.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Zxing is kind of a painfull integration, also in the newer versions of Xcode Apple added more error checks. I would suggest you to use cococapods for a better integration or this ObjectiveC wrapper here
It's not seeing some of the lib classes. Double check the steps in the README, particularly step 2. If it still fails, post the link command that fails.

iOS strange linker behavior -- can't get GData to compile with Three20

I've been trying to compile the Google Data libraries in a project with three20. The problem is if I add the "-ObjC" flag to my target as needed to get the GData to link I end up getting errors such as this in Three20:
ld: duplicate symbol _OBJC_METACLASS_$_TTBaseViewController in /Users/macuser/Dropbox/DFJ/three20/Build/Products/Release-iphoneos/libThree20UICommon.a(TTBaseViewController.o) and ../three20/Build/Products/Release-iphoneos/libThree20UICommon.a(TTBaseViewController.o)
collect2: ld returned 1 exit status
Now if I take out the -ObjC flag then the google libraries don't link:
"_OBJC_CLASS_$_GDataServiceGoogleYouTube", referenced from:
objc-class-ref-to-GDataServiceGoogleYouTube in PitchStart.o
How to get both of these to play nice with each other?
I fixed it. You cannot link to the compiled library. Rather just drag all of the source .m and .h files into your project!

Resources