1

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.

Rober
  • 427
  • 3
  • 8
  • This is your problem: size=4651232504 - is this designed for 64bit Macs? It would appear some integer has wrapped and while negative is looking like a unsigned huge number. Look at the above number in HEX and see if its 0xFFFFFFFF – David H May 03 '13 at 15:13
  • Thanks for the feedback but I am not sure what you want to say with that `size=462343505`is the problem. The app is an iOS app so it is a 32-bit ARM processor. I have checked the number 0xFFFFFFFF and is 4294967295 in decimal, not 4651232504 so they do not match. – Rober May 03 '13 at 15:40
  • My point is, just reading the error, there is some objectiveC const at an address with a size of 4 gigabytes. It is not possible to load such a large object on a 32 bit system. Track that down and your problem is solved. I suspect some MACROs that create the size of some static object are messed up (overflow, underflow) and causing this. No further idea except poking around - tedious for sure. – David H May 03 '13 at 15:50
  • I ran into this issue building a different library - linking with LTO made it go away (`-flto`). May help you. – Dan Field Aug 27 '19 at 19:32

2 Answers2

1

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.

Macmade
  • 52,708
  • 13
  • 106
  • 123
0

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.

steipete
  • 7,581
  • 5
  • 47
  • 81
  • Thanks for the feedback, apparently the problem was happening due to a category on PSUICollectionViewFlowLayout that fixed the flow layout. Once removed this category, there was no problem anymore. – Rober May 08 '13 at 15:02
  • That's a good hint, will keep than in mind when someone has this problem again. Thanks! – steipete May 10 '13 at 09:23