I am building a project in which I have enabled
GCC_SYMBOLS_PRIVATE_EXTERN because I am consuming static libraries that were pre-built with those flags on.
However, when I build my project for Debug
-fvisibility=hidden is not included in the compiler flags, but it does get included when I build my project for Release.
Is there any other flag that I need to turn on to make this happen?
Seems like an Xcode bug. I didn’t find any other solution that setting
OTHER_CFLAGS explicitly (in debug build only, on the same level
GCC_INLINES_ARE_PRIVATE_EXTERN is set) to override it:
OTHER_CFLAGS = "-fvisibility=hidden";
This is old, but it it seems the conflict comes from the Enable Testability setting. If you turn that off, then -fvisibility=hidden will work properly. It seems that Enable Testability has higher precedence over GCC_SYMBOLS_PRIVATE_EXTERN.
If you need that setting, you can always modify the settings on a configuration basis and mix and match (ie. Enable Testability is on and OTHER_CFLAGS containing -fvisibility=hidden)