6

I am using Xcode to build a project that links precompiled object files. These object files contain some unresolved symbols that are dead-code. When Xcode builds for the iOS Device, it strips them when linking and everything works smoothly. When building for the Simulator, however, it doesn't strip them (-dead_strip is not passed to the linker) even though the option (Dead Code Stripping) is activated in the project configuration. If I manually add -dead_strip to the link command on the terminal it builds and runs correctly in the simulator.

How do I make Xcode pass -dead_strip as argument to the linker when building for the iOS Simulator? I prefer a clean solution, hot a hack.

Holger
  • 1,648
  • 1
  • 16
  • 26

2 Answers2

6

Try this steps:

1) Open XCode and press cmd + 1

2) Click on your project at left panel -> your target at middle panel

3) Click on "Build Settings"

4) Find "Other Linker Flags" and add here a your own linker arguments

Hope will be a useful

CReaTuS
  • 2,593
  • 1
  • 19
  • 31
  • While this did fix the problem, I'd still consider it a workaround rather than a clean solution. I am happy with half the bounty points. – Holger Aug 06 '12 at 14:19
2

From Apple Developer Docs it says that

GCC_DEBUGGING_SYMBOLS = full is a prerequisite for DEAD_CODE_STRIPPING.

Maybe that is set incorrectly?

Anurag Sharma
  • 4,276
  • 2
  • 28
  • 44
Liron
  • 2,012
  • 19
  • 39