Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linker error in Xcode 4.4

Upon upgrading from Xcode 4.3 to Xcode 4.4, I started to get the following error on building my iPhone app:

ld: section __objc_const (address=0x0010C720, size=7265990088) 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)

The memory address and number do not mean anything to me, but they remain consistent across clean and rebuilds. It is not clear to me how to find what they might be referencing.

The code did and still does compile in XCode 4.3.

Does anyone have any idea how I might track down what's causing this error?

like image 237
The Dirty Calvinist Avatar asked Aug 15 '12 18:08

The Dirty Calvinist


2 Answers

I had the very same error. Luckily, I could recall the moment when it appeared, rolled back and compared the revisions. It was a category with static methods on Google Analytics GAI class. I have no idea why it happened, since other categories in the project work just fine, but hope it helps someone too.

like image 144
Aleks N. Avatar answered Nov 15 '22 07:11

Aleks N.


You can see the sizes of all symbols (including global variables) in a Link Map File:

  • In the Build Settings for your target, go to the "Linking" section and set "Write Link Map File" to "Yes".
  • Build the program. The linker will fail, but the link map file is written.
  • Locate the link map file. The log output from the linker shows the parameters -map -Xlinker -/path/to/linkmapfile.txt. It is somewhere in the DerivedData folder of your project.
  • The link map file show addresses (first column) and sizes (second column) for all symbols. For global variables, it shows the name and in which object file they are located.
  • You should find the address of your error message (0x0010C720 in your example) in the link map file.
  • You can check the link map file for other symbols having a large size.

So perhaps this helps to narrow down the problem.

like image 43
Martin R Avatar answered Nov 15 '22 08:11

Martin R