• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Custom iOS framework links fine for Debug Config, but not for Release
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom iOS framework links fine for Debug Config, but not for Release


  • Subject: Re: Custom iOS framework links fine for Debug Config, but not for Release
  • From: David Hoerl <email@hidden>
  • Date: Tue, 10 May 2016 13:56:19 -0400

If I set:

Apple LLVM 7.1 - Code Generation
--------------------------------
Symbols Hidden By Default
 YES

Then the framework itself fails to link with this error (for all affected architectures):

ld: warning: cannot export hidden symbol _OBJC_CLASS_$_SBSoundEffects from /Volumes/Data/Users/dhoerl/Library/Developer/Xcode/DerivedData/AVSoundTrackSwitch-dzmmopcnssvgksakqtxssehrgwev/Build/Intermediates/SoundEffects.build/Release-iphoneos/SoundEffects.build/Objects-normal/arm64/SBSoundEffects.o

So, again, failing to understand how the "Exported Symbols File" works.


On 5/10/16 1:37 PM, Alex Zavatone wrote:
I've got these settings for those items

Generate Debug Symbols: Yes
Symbols Hidden by Default: No

And as you saw, she builds for debug and release.

For where that build error happens, could you paste in the full error message?  PRess command 8 and expand the error for that error.

On May 10, 2016, at 11:30 AM, David Hoerl wrote:

On 5/9/16 8:11 PM, Jens Alfke wrote:

The release version of the framework isn’t exporting any of its symbols,
probably. A debug build exports all symbols by default, but IIRC a
release one doesn’t. I use an exported-symbols (.exp) file to tell the
linker which symbols to export — you configure that with the “Exported
Symbols File” option in the Linker build settings. The .exp file is just
a list of symbols, one per line; for obscure reasons function and global
variable names have to be prefixed with a “_”. For an Obj-C class use
the name “.objc_class_name_SBSoundEffects”.

—Jens

Thanks to Jens and Alex I'm getting closer. Confounding the issue is that I somehow "fixed" the link problem - now Release builds just fine - and I am unsure what I did [although I suspect it was an incorrectly specified include in the umbrella header file].

Great - so now Release builds. But now that I know about limiting the Exported symbols to just the bare minimum, I cannot seem to make the "exported symbols" file "take". That is, no matter what I do, running "nm" and "nm -g" on the Debug and Release binary shows no difference between them regardless of the options I play with.

Of all the options below, "Symbols Hidden By Default" would seem to offer the ability to limit symbols, but setting it to YES (for Release) breaks the link (error inline).

These are the available options that would appear to be relevant:

Settings are only for Release Build Config

Deployment
----------
Strip Debug Symbols During Copy
 YES (Doesn't seem to matter)

Strip Style
 ALL

Use Separate Strip
 no effect

Linking
-------
Exported Symbols File
 Project/SomeFile (I know its getting picked up since I can put garbage in the file and get errors

 [contents are one line + "\n" ->
  .objc_class_name_SBSoundEffects (thanks Jens!)]

Apple LLVM 7.1 - Code Generation
--------------------------------
Symbols Hidden By Default
 NO [setting it to YES breaks the Framework:
"ld: warning: cannot export hidden symbol _OBJC_CLASS_$_SBSoundEffects"


So what is the magic sauce?


- David


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Custom iOS framework links fine for Debug Config, but not for Release
      • From: Alex Zavatone <email@hidden>
References: 
 >Custom iOS framework links fine for Debug Config, but not for Release (From: David Hoerl <email@hidden>)
 >Re: Custom iOS framework links fine for Debug Config, but not for Release (From: Jens Alfke <email@hidden>)
 >Re: Custom iOS framework links fine for Debug Config, but not for Release (From: David Hoerl <email@hidden>)
 >Re: Custom iOS framework links fine for Debug Config, but not for Release (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Re: Navigating to Project or Target settings quickly in Xcode 6?
  • Next by Date: Re: Custom iOS framework links fine for Debug Config, but not for Release
  • Previous by thread: Re: Custom iOS framework links fine for Debug Config, but not for Release
  • Next by thread: Re: Custom iOS framework links fine for Debug Config, but not for Release
  • Index(es):
    • Date
    • Thread