ofxiOSBoost icon indicating copy to clipboard operation
ofxiOSBoost copied to clipboard

Visibility settings cause warnings when compiling for Release

Open mhaylock opened this issue 9 years ago • 7 comments

When compiling our app for Release I get warnings like:

ld: warning: direct access in void boost::throw_exception<boost::gregorian::bad_month>
(boost::gregorian::bad_month const&) to global weak symbol typeinfo for 
boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::
gregorian::bad_month> > means the weak symbol cannot be overridden at runtime. This was 
likely caused by different translation units being compiled with different visibility 
settings.

I can see this occurs because "Symbols Hidden by Default" is YES in a Release build. A bit of Googling suggests that boost should have been compiled with -fvisibility=hidden -fvisibility-inlines-hidden, which was the case until this commit.

Would the fix be as simple as reintroducing these compilation options, or do they cause other problems?

mhaylock avatar Oct 28 '15 02:10 mhaylock

Yeah definitely re-introducing that line. Thanks for this report.

danoli3 avatar Oct 28 '15 05:10 danoli3

No problem, although (just incase you didn't already mean this) to clarify: it should be re-introduced for both iphone and iphonesim :)

mhaylock avatar Oct 28 '15 05:10 mhaylock

Fixed in new releases for 1.59.0 and master.

danoli3 avatar Oct 28 '15 07:10 danoli3

@danoli3 it's not clear to me why, but trying this new version I get the visibility warnings in Debug now, even if I do change "Symbols Hidden by Default" to YES to DEBUG.

Perhaps I've lead you astray with my suggestion here?

mhaylock avatar Oct 28 '15 10:10 mhaylock

I found this: http://stackoverflow.com/questions/19190458/visibility-linker-warnings-when-compiling-ios-app-that-uses-boost

Interesting might be related to clang++ vs clang.............weird. Want to try and edit the build script yourself to clang rather than clang++ here: https://github.com/danoli3/ofxiOSBoost/blob/master/scripts/build-libc%2B%2B.sh#L29

See if that gets rid of the warnings? After re-building

danoli3 avatar Oct 28 '15 11:10 danoli3

@danoli3 I did try using clang (saw that myself) with no luck.

I've observed that no matter what the setting for "Symbols Hidden by Default" (including making sure it's consistent in the Pods project as well) it never passes -fvisibility=hidden when compiling while in DEBUG mode. Seems like an Xcode bug, but perhaps I'm missing something…

mhaylock avatar Oct 29 '15 02:10 mhaylock

Yeah throw Apple a report: https://bugreport.apple.com

Let me know what their engineers say.

danoli3 avatar Oct 29 '15 04:10 danoli3