There are a fair number of related questions out there already, but I'm just not getting this resolved. I'm building an application that includes two separate static libraries: RestKit and another that's on NDA. When I build, I'm getting a Apple Mach-O linker error as follows:
duplicate symbol _NewBase64Decode
in /Users/geraldwburke/Desktop/iOS Programming/MyApp/someLib.a(NSData+Base64.o)
and /Users/geraldwburke/Library/Developer/Xcode/DerivedData/MyAppddlwzdeskfwaxyargomvfhurvxzi/Build/Products/Debug-iphoneos/libRestKit.a(NSData+Base64.o)
for architecture armv7
Now, I've seen some potential fixes out there. This article seemed promising. I also tried to add a build rule using the script from this blog entry. I've tried adding and removing -ObjC, -all_load, and -force_load linker flags. No matter what I have tried, I still get that same error. Does anyone have any idea how to fix this?
BTW I will delete my identical post. Posted it on the wrong acct.
The easiest solution is to modify the source code of one of those libraries to not define NewBase64Decode. RestKit is open source; I don't know if you have the source to your secret NDA library.
Related
So I've been trying to add the Semantics3 objective-c code to a project I'm working on. I followed the directions they had on their Github page to no avail, I always get an Undefined symbols for architecture x86_64: linking error, even though prior to creating the builds i made sure valid architectures in build settings contained armv7 armv7s arm64 and that the right targets were selected. I also made sure I was adding the .a file that was in the universal folder in /Product. Not exactly knowing if I built their code right, however, I tried going through "adding a static library to your code" section in http://www.raywenderlich.com/41377/creating-a-static-library-in-ios-tutorial, I do everything correctly, the compiler finds the header files, but then after I add the static library, the project still won't build and I still get the same error. I read through numerous answers on SO and elsewhere online, and nothing I did seemed to fix the issue. What could be wrong?
I'm trying to use ASIHTTP in my app.
I had some probelms importing and linking everything right, but I found all the answers here except one.
I get a "Apple mach-o linker error" for many items, all referenced from a ASIWebPageRequest class methods in a file called "ASIWebPageRequest.o".
I don't really know where to find this file and how to fix this issue,
Anyone has a clue?
Thanks,
Yonathan
Edit - Fixed it by adding libxml2.dylib to my project, for some reason it is not included in http://allseeing-i.com/ASIHTTPRequest/Setup-instructions. I just compared the frameworks included in ASIHTTPRequest demo projects to mine and found out it was missing.
Fixed it by adding libxml2.dylib to my project, for some reason it is not included in http://allseeing-i.com/ASIHTTPRequest/Setup-instructions. I just compared the frameworks included in ASIHTTPRequest demo projects to mine and found out it was missing.
I've been trying to integrate Sharekit to a project that already has google analytics.
I followed the installation guide on the sharekit git wiki which told me to include the 'other linker flags' "-ObjC" and "-all_load"
However when I try compiling I am getting duplicate symbol errors in google analytics, such as:
duplicate symbol _OBJC_IVAR_$_OAServiceTicket.data in:
/Users/x3ro/Library/Developer/Xcode/DerivedData/APPNAME-bgfudbwainndvsdmvtafsrwfryvz/Build/Intermediates/APPNAME.build/Debug-iphonesimulator/APPNAME.build/Objects-normal/i386/OAServiceTicket.o
/Users/x3ro/APPNAME/Developer/Xcode/DerivedData/APPNAME-bgfudbwainndvsdmvtafsrwfryvz/Build/Products/Debug-iphonesimulator/libShareKit.a(OAServiceTicket.o)
Removing the flags solves these errors, however I know this isn't a good idea and I'll very likely run into issues down the line. Any help in getting the flags and both libraries to work together would be really appreciated.
Use the linker flag "-force_load" with the path to Sharekit.
It look like something like this:
-force_load $(BUILT_PRODUCTS_DIR)/libRestKit.a
From Apple Documentation:
-all_load forces the linker to load all object files from every archive it sees, even those without Objective-C code. -force_load is available in Xcode 3.2 and later. It allows finer grain control of archive loading. Each -force_load option must be followed by a path to an archive, and every object file in that archive will be loaded.
You can find others answers with this related post:
Using the force_load linker flag with RestKit (iOS)
I have used OA consumer class in my app and while trying to run it i got this error and i dint understand the problem. i have added -ObjC to other linker flags also. i have searched google but dint find any related to this. I have disabled the arc and do i need to add any linker flags or is there any other problem.
can you please tell me whether there is an error in code or do i have to change the linker settings
These are linker errors -- it's finding the headers just fine, but the library is missing at link time. Make sure the OA library is in the Linked Frameworks and Libraries list for your target.
I removed this error after lots of trails, the problem in my case is the corefoundation framework is corrupted, it has shown a small question mark on it, after i carefully read the exception, it says that some files are missing from the corefoundation framework, then i removed the framework and copied a new one from another project then the errors gone.
Note: while you are removing any file, don't just remove references , move it to trash, other wise the Xcode may give you a error file already exist and cannot be copied.
I have created static library and it's working fine for device but giving warning
"ignoring file ../Test/build/Debug-iphoneos/libTest.a, missing required architecture i386 in file" if I try to deploy it on simulator and hence gives error for all references of that library.
I have read about this error on SOF but not got any workaround for this. I have followed this link to create and use static library.
http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/
So please give solution for this.
Thanks in adv.
These can be quite the pain in the ass. The long and the short of it is that you need to add i386 to your architecture for your static library and rebuild it. If you are using Xcode 4, your problems get compounded even further because your library doesn't build into one nice neat little libMy.a file. You end up with 4 different files depending on your setup.
You can read this answer on Build fat static library for Simulator and Device. This helped me out more than you can imagine.
If you get that far, don't forget about your headers and linker flags. Using static libraries can be great, but they can also be a pain. Hope this helps a little.