Linker error compiling PDFKit - ios

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.

Related

Manual import of Twilio into Swift

I'm building a framework target to be used across multiple apps I am developing and I'm trying to include the Twilio SDK (TwilioCommon & TwilioConversationsClient) in this common framework target.
To do so, I had to create a modulemap to define a module from the headers. Ok, great. Everything seems to work fine. Except I'm getting an excessive number of warnings when following this model:
ld: warning: ignoring linker optimzation hint at _cftmdl_128_neon+0xF0 because ldrInfoC.offset == 0
ld: warning: ignoring linker optimzation hint at _cftmdl_128_neon+0xFC because ldrInfoC.offset == 0
ld: warning: ignoring linker optimzation hint at _cftmdl_128_neon+0x108 because ldrInfoC.offset == 0
....
....
I believe I've adhered to the Manual install for iOS page fairly well and I've created a minimal project on github to replicate this behavior.
Anyone able to spot mistakes? Is this a bug in the way the library was linked?
Versions and things:
XCode 7.2.1, Swift 2
TwilioCommon 0.2.0
TwilioConversationsClient 0.22.0
This question is remarkably similar to this one:
How do I resolve linker warning "ignoring linker optimzation hint at" in XCode?
If you're compiling the WebRTC library by yourself using build
scripts, the warnings are generated because of a missing parameter in
GYP_DEFINES.
In order to fix the warnings, the WebRTC library needs to be compiled
again with the parameter clang_xcode=1 in the GYP_DEFINES setting,
like below (only an example):
export GYP_DEFINES="$GYP_DEFINES OS=ios target_arch=arm64
clang_xcode=1" More about the issue can be found here, on the Chromium
forums: https://bugs.chromium.org/p/webrtc/issues/detail?id=5182
--
If you're not compiling the WebRTC library yourself, and instead
installing the WebRTC library from a 3rd party source, I don't believe
there is a fix as the warnings are stemming from the static library.

ld: library not found for -lPayPalMobile ios

i am working with xcode 6.1 on paypal integration.
i am getting following error each time when i open the project.
ld: library not found for -lPayPalMobile
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
every time i have to remove library search paths value and remove reference of paypal folder and again import it to project.
what is the problem i don't know please tell me what to do?
Edited
one thing more that if project name is "This is test" then what will be difference?
because i can see in library search paths that in first row "This" is coming in second row only "is" is there and in last (i.e. 3rd row) "test" is there.
Thank you.
Follow Below steps,
(1) Add Static library in Your project bundle.
(2) Add it in "link binary with libraries"
You need to go to your Target -> Build phase -> link binary with libraries.
as attached in below image.
(3) Give proper header search path for your linked library.
i.e. ($PROJECT_DIR)/Your path.
You can also read the steps that given in GitHub link of PayPal,
which give you proper direction.
Feel free to ask if you need more help regarding this.
As #Anuj mentioned this can be a problem related with Library Search Paths. Cocoa Pods sometimes gets a mess when updating it, or installing it again if you have it or not under Source Control.
I solved this problem right now by adding this flag under Library Search Paths:
$(inherited)
Hope it helps you
This is usually Header or Library Search Paths. It's better to use CocoaPods to manage your project dependancies. CocoaPods is the dependency manager for Objective-C projects. It has thousands of libraries and can help you scale your projects elegantly. You can import any static library using simple Podfile and command line.
Once you start using CocoaPods, you won't have to worry about header or library search paths. PayPal also has a spec in the CocoaPods Spec repository.

iOS - GA - library not found

I am trying to add Google Analytics to my iOS app. I followed the step of Google's tutorial but now my projet doesnt compile and I have the following error message.
ld: library not found for -lGoogleAnalyticsServices
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I checked and the the library libGoogleAnalytics_debug.a is in my project folder so I dont understand where the problem comes from.
Does anyone have an idea how to fix this?
Many thanks
Go to your project > Build settings > search for the LIBRARY_SEARCH_PATHS and check their paths.
just put lGoogleAnalyticsServices.a near with myapp.xcodeproj, and drag library in your frameworks block in xcode
I also had this error and was able to fix it like this:
Go to the app project settings
Go to the General tab
Under Linked Frameworks and Libraries, drag libGoogleAnalyticsServices.a to be at the end of the list.
Order matters because if a dependency of said library isn't built first, Xcode won't be able to link it.

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.

CommonCrypto isn't building for arch armv7 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.

Resources