-fvisibility=hidden not passed by compiler for Debug builds

余生颓废 提交于 2019-12-11 00:44:34

问题


I am building a project in which I have enabled GCC_INLINES_ARE_PRIVATE_EXTERN and 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?


回答1:


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)




回答2:


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";


来源:https://stackoverflow.com/questions/35861502/fvisibility-hidden-not-passed-by-compiler-for-debug-builds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!