Re: Custom iOS framework links fine for Debug Config, but not for Release
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