简体   繁体   中英

-fvisibility=hidden not passed by compiler for Debug builds

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?

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM