CommonCrypto isn't building for arch armv7 iOS - ios

I recently just upgraded to the new XCode. After I upgraded, some of my apps won't build. I get this error:
ld: cannot link directly with /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/system/libcommonCrypto.dylib. Link against the umbrella framework 'System.framework' instead. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've tried everything - cleaning, reimporting, changing architectures...
Please help

I resolved this issue in a diffent way after I tried both the above where neither worked for me.
The problem was that when I was adding the library from the main interface (main build-settings...etc) I was searching initially for crypto and then two libs comes back libcorecrypto.dylib and liblibcommonCrypto.dylib, if you notice, both exists in gray-color unlike the usually yello-colored libs that you normally add. Adding these causes the compiler to report back (some other libs are missing, such as the libz, or another lib that will be needed the more functions you take on.
If you notice the above two libs would normally sit under JavaScriptCore.framework library (which is the yellow one), therefore, by removing the above two and adding JavaScriptCore.framework instead, the problem was resolved, and build successful showed
Also to mention that based on the gray-libs existing as a bundle inside JavaScriptCore.framework, the libcrypto and the other one will not exists under the /Library/.../system/path as mentioned above, i.e. you didn't delete them from your system, they're just not there.
Again, the solution is:
*From your main XCODE project settings, don't add:*dd
libcorecrypto.dylib
liblibcommonCrypto.dylib
Instead, add:
JavaScriptCore.framework
In your .m (code), just source them normally by doing:
#include <CommonCrypto/CommonDigest.h> (or any of your other libs as needed in code)...
It should work fine.
I hope this helps.
Kind Regards

I just solved this as follows:
It turns out that the libcommonCrypto.dylib error was a red herring.
After removing libcommonCrypto.dylib as suggested above, I got 9 new errors.
At first glance, I assumed they were Crypto errors, but in fact they were not; for me, it actually traced back to zLib not being included, which was "imported" in a deeper part of the overall implementation (of which crypto is a part).
For me specifically, it traced back to ASIDataDecompressor.h, #import < zlib.h>
I fixed it by including the missing libz.dylib framework; ultimately, I did not have to explicitly include libcommonCrypto.dylib.
So, be sure to check the errors closely after toggling libcommonCrypto, and make sure some OTHER libraries are not missing, instead.

I'm using cocoapods for library management. One of the libraries (you can simple search in your workspace) contained reference to CommonCrypto.framework which was red in the list of frameworks in its project settings.
In my case I had to remove the dependency on CommonCrypto.framework, but this solution lasts just to another update of your pods.
Btw I'd like to know a command to list the graph of dependencies among the libraries in the Podfile.

I had the same error,
ld: in '/usr/lib/system/libcommonCrypto.dylib', missing required architecture arm64 in file /usr/lib/system/libcommonCrypto.dylib (2 slices) for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I solved this problem by checking my $PATH. It was a missing file.
Using find / -type f -name libcommonCrypto.dylib
Comparing my libs with my friends mac systems, it shows that this file was not present on my computer :
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/system/libcommonCrypto.dylib
Xcode using $PATH fallback on /usr/lib/system/libcommonCrypto.dylib but it's not the good built (i386 insteadof arm stuff).
I copied the version of my friend, move in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/system/ and then I was able to build my projects again.
There is a vicious problem here cause there is a lot same file for this lib depending of your architecture and most of them are not intended to be used for ios builds. But the $PATH env var will fallback on /usr/lib when no files are found on dedicated dirs.
Xcode fallback on /usr/lib/system/libcommonCrypto.dylib but this is definitely not the correct lib cause it not a built for ios, but a built for my mac.

Better Solution ,as it says remove libcommonCrypto.dylib,and replace by adding SystemConfiguration.framework.It worked for me,might be useful to someone.I was getting Linker Error saying gettingLink against the umbrella framework 'System.framework' instead.

Related

Xcode 10 beta: linker command failed with exit code 1 RPSystemBroadcastPickerView [duplicate]

An Xcode beginner's question:
It is my first experience with Xcode 4.6.3.
I am trying to write a very simple console program, that searches for paired BT devices and prints them to an NSLog.
It builds with the following error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_IOBluetoothDevice", referenced from:
objc-class-ref in main.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 searched like crazy. The common problem should be a reference to a file, of which only the header files are imported and no implementation (*.m-file) is found by the linker. The IOBluetooth library is however, a standard Framework like the Foundation Framework.
What am I missing in my above statement?
I also have tried building it for a 32-bit machine (build fails again). It is clearly a linker error, however I have no idea, to what it relates, except that there is an issue with finding the implementation for IOBluetoothDevice, on both x86 and x64 architecture, while the header files are from a standard included Framework, called IOBluetooth?
For your information my main code "main.m" being:
#import <Foundation/Foundation.h>
#import <IOBluetooth/objc/IOBluetoothDevice.h> // Note the import for bluetooth
#import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h> // Note the import for bluetooth
int main(int argc, const char * argv[])
{
#autoreleasepool {
IOBluetoothDevice *currentDevice;
NSArray *devices = [ IOBluetoothDevice pairedDevices];
for (id currentDevice in devices){
NSLog(#"%i : %#",[ currentDevice classOfDevice ], [ currentDevice name ]);
}
}
return 0;
}
Thanks for any help or pointers to the right direction.
It looks like you are missing including the IOBluetooth.framework in your project. You can add it by:
Clicking on your project in the upper left of the left pane (the blue icon).
In the middle pane, click on the Build Phases tab.
Under "Link Binary With Libraries", click on the plus button.
Find the IOBluetooth.framework from the list and hit Add.
This will make sure that the IOBluetooth.framework definitions are found by the linker. You can see that the framework is a member of your target by clicking on the framework in the left pane and seeing the framework's target membership in the right pane (note I've moved the framework under the Frameworks group for organization purposes):
UPD
Apple requires to use arm64 architecture. Do not use x32 libraries in your project
So the answer below is not correct anymore!
Old answer
The new Xcode 5.1 sets the architecture armv7,armv7s,and arm64 as default.
And sometimes the error "build failure “Undefined symbols for architecture x86_64”" may be caused by this. Because, some libs (not Apple's) were compiled for x32 originally and doesn't support x64.
So what you need, is to change the "Architectures" for your project target like this
NB. If you're using Cocoapods - you should do the same for "Pods" target.
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_xxx",
referenced from:
objc-class-ref in yyy.o
This generally means, you are calling "xxx" (it may be a framework or class) from the class "yyy". The compiler can not locate the "xxx" so this error occurs.
You need to add the missing files(in this case "xxx") by right click on your project folder in navigator window and tap on "Add files to "YourProjectName"" option.
A popup window will open your project files in Finder. There, you can see the missing files and just add them to your project. Don't forget to check the "Copy items if needed" box. Good luck!!
I have also seen this error on Xcode 7.2 when the derived data becomes corrupted (in my case I interrupted a build and suspect that was the root cause).
So if the other solutions (notably Chris's and BraveS's which I suspect are more likely) do not fit your problem try deleting derived data (Select: Window / Projects / Derived Data -> Delete) and re-building.
(Added for reference by others - I know the original question has been answered correctly).
Under Xcode 9.0b5 you may encounter this because Xcode 9.0b5 has a bug in it where when you add source code, it does not honor the target settings. You must go in and set each file's target manually afterwords:
In my Case , it was not a library, it was some classes ..
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_ClassNmae", referenced from: objc-class-ref in
SomeClassName" . . .
d: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
Solution
I had several targets in Xcode with several schemas ( Production , Dev etc ) .. some of my newly added implementation ( Class.m ) were missing in
Xcode->Targets->Build Phases->Compile Sources
So I had to add them manually.
then I could compile & build successfully.
I also encountered the same problem , the above methods will not work . I accidentally deleted the files in the following directory on it .
Or
~/Library/Developer/Xcode/DerivedData/
I tried just about everything here but my problem turned out to be the remnants of a previous cocoapods build. What worked for me was:
rm -Rf Pods; pod install
Delete Derived Data (Window/Projects... select your target. click Delete Button)
Rebuild
I have faced this issue many times. This usually comes when you delete your build folder.
The easy solution is to de-integrate and install the pod files again.
pod deintegrate
pod install
When updating to Xcode 7.1, you might see this type of error, and it can't be resolved by any of the above answers. One of the symptoms in my case was that the app runs on the device not in the simulator. You'll probably see a huge number of errors related to pretty much all of the frameworks you're using.
The fix is actually quite simple. You just need to delete an entry from the "Framework Search Paths" setting, found in your TARGETS > Build Settings > Search Paths section (make sure the "All" tab is selected)
If you see another entry here (besides $(inherited)) for your main target(s) or your test target, just delete the faulty path from all targets and rebuild.
I have found this can also occur if you drag a folder with Objective-C files into your project. If that folder appears blue I think it indicates its not properly linked. You can verify this (if you use version control) because whenever you add new files the pbxproj file should update with links to those new files. However you may find that after you added a folder that the pbxproj file did not change (and hence there is a linking error). So you will get auto-complete working and it will find the classes you imported, but when it goes to actually build the image it fails with this error code.
The solution is to not add the folder but rather add the files. Do this and you should see the pbxproj file update and it should fix this error.
This also assumes you've done what was suggested above and have properly linked all the right frameworks.
I know it's an old question but today got the same error and non of the above solutions worked.
Have fixed it however by setting option:
Project -> Architecture -> Build Active Architecture Only
to Yes
and project compiles and builds properly
I had the same error, because instead of deleting a file I simply removed references to it. Locating the file in Finder and removing it helped.
In my case, I built a custom framework with Deployment target set to 9.1, but the Deployment target of my app was lower, which supports 8.1. Minimize the custom framework Deployment target solved my problem.
If you're getting this error when trying to link to a C file, first double check the function names for typos. Next double check that you are not trying to call a C function from a C++ / Objective-C++ environment without using the extern C {} construct. I was tearing my hair out because I had a class that was in a .mm file which was trying to call C functions. It doesn't work because in C++, the symbols are mangled. You can actually see the concrete symbols generated using the nm tool. Terminal to the path of the .o files, and run nm -g on the file that is calling the symbol and the one that should have the symbol, and you should see if they match up or not, which can provide clues for the error.
nm -g file.o
You can inspect the C++ symbols demangled with this:
nm -gC file.o
I got it solved by adding "-lc++" in Other Linker Flags in Build Settings.
In my case problem was compiled framework architecture.
I'm running Xcode 11 and using Swift 5.1
I had 3 target like:
MyApp
MyAppTests
MyAppFrameWork
I was tried to run tests but MyAppFrameWork product was compiled for Generic iOS Devices and the Test target needed an arm x86-64, So I rebuilt Framework for iOS Simulators and test cases successfuly start running.
This is also happend with apple M1 chip.
Here is my solution just check Open using Rosetta
Steps:
Go to application > right click xcode > get info > check Open using Rosetta
Restart the system.
I am late to the party but thought of sharing one more scenario where this could happen.
I was working on a framework and was distributing it over cocoapods.
The framework had both objective c and swift classes and protocols and it was building successfully.
While using pod in another framework or project it was giving this error as I forgot to include .m files in podspec.
Please include .swtift,.h and .m files in your podspec sources as below:
s.source_files = "Projectname/Projectname/**/*.{swift,h,m}"
I hope it saves someone else's time.
in my case I had to add
target 'SomeTargetTests' do
inherit! :search_paths
end
to my podfile and then delete the /Pods directory and run `pod install`
(Xcode 10.1)
This might help somebody. It took me days to finally figure it out. I am working in OBJ-C and I went to:
Project -> Build Phases -> Compile sources and added the new VC.m file I had just added.
I am working with legacy code and I am usually a swifty, new to OBJ-C so I didn't even think to import my .m files into a sources library.
EDIT:
Ran into this problem a second time and it was something else. This answer saved me after 5 hours of debugging. Tried all of the options on this thread and more. https://stackoverflow.com/a/13625967/7842175 Please give him credit if this helps you, but basically you might need to set your file to its target in file inspector.
All in all, this is a very vague Error code that could be caused for a lot of reasons, so keep on trying different options.
What helped me was adding s.static_framework = true to my /podspec in the project that was throwing the error.
For me, this started to happen after merge conflict.
I tried to clean and remove build folder, but none of it helped. This issue kept happening regardless. Then I relinked the reference by deleting the groups that was problematic and re-added to the project and it worked.
Could also be an #include <windows.h> in the .c file that you're trying to compile.
Sometime, I forget to copy library from Release-universal and mistakenly copy from Release-iphoneos. Usually Release-iphoneos contains .a file which has been pruned for X86. and so it gives the error.
in my case, removing selection of target membership and then select again fix the issue.
Check William Cerniuk answer with the attachment photo.
Undefined symbols for architecture x86_64
I have run on this issue when used CocoaPods with some dependency which did not have specific version, that is why after pod update it downloaded the latest version which included some breaking changes
Upgrade dependencies and code for using them
Set specific version of pod
Remove Derived Data[About] folder
In my case I was getting this error: Undefined symbols for architecture x86_64: "_OBJC_CLASS _ $ _ RCTImageLoader"
And I was able to fix it by adding the following line in my Podfile file:
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
Reference
It happens when you are using architecture arm6, arm7 in your current project but any 3rd party framework which you are trying to consume in your project is built over x86_64.
For e.g If you are using Cocoa Pods in your project, then you need to add following script to make sure all 3rd party frameworks ensure arm6, arm7. i.e
Sample podfile with script to be add at end
target 'XYZ_ProjectTarget' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for XYZ_ProjectTarget
pod 'pod_name'
target 'XYZ_TargetTests' do
inherit! :search_paths
# Pods for testing
end
target 'XYZ_TargetUITests' do
# Pods for testing
end
end
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ARCHS'] = 'armv7 armv7s'
end
end
end

Xcode 6 linker error - Undefined symbols for architecture armv7

After upgrading to Xcode 6 beta 7 (and now still with Xcode 6 GM) I am unable to link my Swift app. I receive errors such as:
Undefined symbols for architecture armv7:
"_swift_stdlib_compareNSStringDeterministicUnicodeCollation", referenced from:
...
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have seen the other SO posts that recommend deleting the Derived Data folder and/or using the Clean Build Folder option to get past this error, but that solution didn't help at all in my case. Nothing has changed about my code or the CocoaPods I'm using since Xcode 6 beta 5 which is the last time it worked.
Any ideas?
EDIT:
A full posting of the error log:
Undefined symbols for architecture arm64:
"_swift_stdlib_compareNSStringDeterministicUnicodeCollation", referenced from:
TFC12MyProject21BarcodeViewController13captureOutputfS0_FTGSQCSo15AVCaptureOutput_24didOutputMetadataObjectsGSQGSaPSs9AnyObject___14fromConnectionGSQCSo19AVCaptureConnection__T_ in BarcodeViewController.o
"__TFSs21_arrayConditionalCastU___FGSaQ__GSqGSaQ0_", referenced from:
TFC12MyProject27SessionsTableViewController17viewWillDisappearfS0_FSbT_ in SessionsTableViewController.o
"__TFSs15_arrayForceCastU___FGSaQ__GSaQ0", referenced from:
__TFC12MyProject7RestApi12tokenMappingfS0_FT_CSo15RKEntityMapping in RestApi.o
__TFC12MyProject28AttendeesTableViewControllerg24fetchedResultsControllerCSo26NSFetchedResultsController in AttendeesTableViewController.o
__TFC12MyProject27SessionsTableViewControllerg24fetchedResultsControllerCSo26NSFetchedResultsController in SessionsTableViewController.o
__TFC12MyProject21BarcodeViewController13startScanningfS0_FT_Sb in BarcodeViewController.o
"__TFSs26_forceBridgeFromObjectiveCU__FTPSs9AnyObject_MQ__Q_", referenced from:
__TFC12MyProject7RestApi12resetRestKitfS0_FT_T_ in RestApi.o
__TFC12MyProject16BluetoothManager17_startAdvertisingfS0_FT_T_ in BluetoothManager.o
__TFC12MyProject19LoginViewController32registerForKeyboardNotificationsfS0_FT_T_ in LoginViewController.o
__TFC12MyProject19LoginViewController35deregisterFromKeyboardNotificationsfS0_FT_T_ in LoginViewController.o
__TFC12MyProject19LoginViewController16callProcessLoginfS0_FT_T_ in LoginViewController.o
__TFC12MyProject21CheckinViewController16enableBeaconModefS0_FT_T_ in CheckinViewController.o
__TFC12MyProject21BarcodeViewController13startScanningfS0_FT_Sb in BarcodeViewController.o
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What's happening here has nothing to do with your Derived Data location.
When a swift application is built, it goes through several steps:
Write auxiliary files
Create product structure
Compile swift source for each architecture
Copy resource rules plist
Copy application bridging header
Link against swift runtime libraries for each architecture
Copy application swift module for each architecture
Create the application binary
Copy resources build phase
Copy the swift standard libraries into the application
Package it up
Sign it
Whew! That's a lot. Your build is failing when linking against the swift runtime libraries. They live in Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos inside the Xcode developer directory. Specifically, the library that is not being correctly linked is libswiftCore.dylib. If you use nm on that library, you can see it defines your first missing symbol:
quellish% nm /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib | grep compareNSStringDeterministicUnicodeCollation
00197c8c T _swift_stdlib_compareNSStringDeterministicUnicodeCollation
000000000018352c T _swift_stdlib_compareNSStringDeterministicUnicodeCollation
You can also use lipo to see what architectures are in the file:
quellish% xcrun lipo -info /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib
Architectures in the fat file: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib are: armv7 arm64
It contains armv7 and arm64. It's not the library architecture that's the problem.
Linking against the swift standard library is not working. It's possible that source control or migrating Xcode versions has caused your project file to drop part of the linking step, or it's simply not able to find the libraries it needs to link against. Xcode project files are complex and use a lot of references - it's possible that a merge, etc. caused a critical reference to be come dissociated from the linking step. Without a full build log and a look at your machine it may not be possible to tell.
This library, as you might guess, has nothing to do with the project's derived data location.
The best way to move forward would unfortunately be to recreate the project file. Comparing the build log of the broken project to a swift project that does build correctly may provide some insights, but it may also be a waste of time - something fixable may be the problem, but more likely not.
I would encourage you to file a bug and include the troublesome project file with it.
I have solved my issue by deleting all the data in the ~/Library/Developer/Xcode/DerivedData folder. I read about that in another thread, but ignored it thinking a clean included that process!
I have Updated on Yosemite, Xcode 6.1.
I have updated gem xcodeproj (0.19.4) and cocoapods (0.34.4).
I have resolve my conflict by :
Clearing the Library/Developer/Xcode/DerivedData folder
replace in Target -> Build Settings -> Linking -> Other Linker Flags : $(OTHER_LDFLAGS)
Check in Target -> Build Phases -> Copy Pods Resources : "${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh"
1) I face the same problem but just clear the applications from derived data from User/Library/Developer/Xcode/DerivedData and I am able to run the code.
2) In your case may be, it will run by removing armv7 architecture from build settings. And make sure your compiler is Default Compiler in Build Settings.
Thanks I hope this helpful to you and everyone.
This seems to be caused (for most) by linking a third-party library that does not support the requested architecture.
I had somewhat similar problem (a linker error from Apple's framework). As it turned out, the problem was that I was missing the library LocalAuthentication.framework. I am wondering if maybe you need to delete the Foundation.framework from the Build Phase tab (in the Link Libraries section), and then re-add it? Maybe that will solve the problem?
'Upgraded' to xcode 6 and swift app wouldn't build for simulator yet would build fine on an iPad - Linker error, undefined symbols for i386 for the simulator.
Clearing the Library/Developer/Xcode/DerivedData folder worked for me.
There appears to be a bug in Xcode 6.0.1 that is causing the linker to drop dependencies in existing project files. I have had this same problem across several different projects, new and old, since the 6.0.1 update.
The easy 'fix' is to just trash your entire 'Derrived Data' and all build files (i.e. manually clean the project) and then rebuild after a fresh Xcode restart. Magically, the linker now finds all the missing architectures/symbols.
NOTE: I have had several incompatible v-table crashes caused by this same bug. The C++ linker appears to be generating incomplete linkages, causing absurd errors where there are no real errors to be found. Again, just rebuild from a clean state and .. ta da.. save yourself a LOT of headache and wasted time tracking down a non-issue.
I solved this issue after trying all that was suggested here with no luck.
Like someone said earlier, it's a SourceControl issue.
One of my project files (the one referenced in the error message) was missing from the project browser. However, XCode still had a reference to it (I was going to the class definition when I was selecting "jump to definition" from Xcode GUI).
As a matter of fact, the project.pbxproj was not listing it. This was probably a Git Issue. In any event, I just recreated the file in the same directory it has been recreated and voila.
I am a filly when it comes to iOS Objective C, though I have been coding in several other languages for many years. So I am stabbing around in the dark most of the time with Objective C.
I started having this error, "Undefined symbols for architecture armv7", directly after declaring some "global" variables in my .h file like so:
extern NSString *globalNotes;
extern NSString *globalUserCountry;
I was then referring to these variables from the .m file like so:
globalNotes= #"Error (Marker 1010)";
globalUserCountry= #"No result";
THE FIX - To correct this, I changed them to object properties like so:
#property(nonatomic, strong, readwrite) NSString *globalNotes;
#property(nonatomic, strong, readwrite) NSString *globalUserCountry;
And referred to them like so:
self.globalNotes= #"Error (Marker 1010)";
self.globalUserCountry= #"No result";
That seemed to fix my problem.

Duplicate symbols for architecture - CocoaPods + Sonic.framework

I'm using CocoaPods and everythnig works fine until I add Sonic.framework.
I'm getting a linker error:
ld: 96 duplicate symbols for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Complete log:
http://pastebin.com/TqdWWYdt
Any help?
The conflicting package is most likely AFNetworking, it can be found in the build log you posted (at line 7, duplicate symbol _OBJC_IVAR_$_AFQueryStringPair._field in:.., googling for AFQueryStringPair leads you quickly into AFNetworking related places).
The offending symbol is declared here.
Does Sonic SDK embed AFNetworking by any chance?
It that's the case you might be lucky enough to be able to use the AFNetworking embedded in Sonic SDK, making the problem go away by simply dropping your own dependency on AFNetworking. If AFNetworking is a downstream dependency of one of your other dependencies it will be a bit more tricky. But at least you know where to look.
Edit: Since you have tagged the question with RESTKit too, that might be a more likely culprit than Sonic SDK (see e.g. this) thread.
There ,may be some files added multiple times in the project
Clear the pod file and pod install : removes everything.
Add all the framework into the podfile and call pod install :to install everything again
May be this will fix the issue
In my case it was caused by an extraneous -l"Pods-AFNetworking" in "Other Linker Flags" in the "Linking" section of my project's Build Settings. I removed this and a few other extraneous -lfoo arguments also in Other Linker Flags: all the duplicate symbols disappeared.
Other things you can check might include:
Copying 3rd party software into your app as part of the project's
collection of files, and then also adding it as a cocoapod by naming
it in the Podfile.
Including more than one version of the same 3rd party software in
your app.
Don't forget that you can uncheck a file's "Target Membership" checkbox for your target to keep it from being included in your build, so if you need multiple versions for compatibility reasons you can select which files are active by target.
You may also just be linking against multiple pod libraries. Make sure in Link Binary With Libraries you're not linking against both libPods.a and libPods-{target}, etc
This just happened to me after dividing a blanket podfile into target specific instructions.

Linker error compiling PDFKit

I am trying to integrate PSPDFKit for iOS in my project and I have not been yet able to success. After downloading the Demo version, adding the framework to my project, adding all the required libraries and placing
#import <PSPDFKit/PSPDFKit.h>
on the 'prefix' file, I get an linker error:
ld: section __objc_const (address=0x00613EA8, size=4651232504) would make the output executable exceed available address range for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
NOTE: My project uses PSTCollectionView and I have successfully compiled PSPDFKit on a test project (created only for that effect).
I would really appreciate any help. Thanks in advance.
Apparently, you have too many included files in your PCH file.
Try removing some of them, and include those files only where you need them, not globally.
As far as I understand it, this is a bug in Apple's compiler/linker chain. Please file a radar at radar.apple.com with your failing project. A workaround is to use the source code as a subproject instead of the precompiled binary.
As soon as I can get my hands on such a project, I can experiment with the settings to see if there's any workaround. Seems to only happen under very specific combinations with other 3rd party code.

Ho can I use adMob library for iOS without using -all_load linker flag

I'm adding adMob provide by google to my iOS app and I'm stuck on this part of the installation:
Add -all_load under Other Linker Flags in the project build info
If I add that flag, then another third party library breaks giving me the error message:
ld: duplicate symbol _vw_chartype_table_p in /Users/josh/ Projects/app/libs/libvt_universal.a(vw_ctype-3279EF26D0C25F3A.o) and / Users/josh/Projects/app/libs/ libvt_universal.a(vw_ctype-34AB9EC0B46D954C.o) for architecture i386
Is there any way to use the adMob library without using -all_load? For example, I've tried -force_load $(SOURCE_ROOT)/adMob/libGoogleAdMobAds.a
but
ld: file not found: /Users/USERNAME/Desktop/latest/bbbb/APPNAME/adMob/libGoogleAdMobAds.a
The reason Google suggests using -all_load is that they are using categories in their code, and Objective-C libraries with categories are not properly loaded by the llvm linker (well that was the case in 4.3 xcode, not sure about 4.4 with the newer clang).
So, I guess if you are brave you can try to just remove the all_load flag. It should build fine. If the bug is NOT fixed, what will happen is when you run your code, it will crash, since none of the categories the library uses will have been loaded. This might be a good thing to do in any case, as your project should build, and if it does not you can fix those problems first.
What I do suggest you do is use -force_load, which has llvm load the categories in the adMob library (among other things). To use it you MUST have a fully qualified path (ie starts at '/') to the library. Obviously if you use Terminal and run:
ls -l /Users/USERNAME/Desktop/latest/bbbb/APPNAME/adMob/libGoogleAdMobAds.a
its going to fail. So enter the proper path - hard coded - for now to just see if you can get the project to first build, then run. If it does you can later figure out what is the appropriate $(VAR) to use to find it inside your project.

Resources