JUCE9 new Opus and libwebp libraries leak symbols with -fvisibility=hidden

These two libraries added in JUCE9 have symbol export settings that survive -fvisibility-hidden. All previous libraries don’t do that. I had to add extra steps to my setup to strip ~200 symbols from my binaries.

The problem comes from OPUS_EXPORT and WEBP_EXTERN. They both boil down to __attribute__(((visibility("default"))) which is stronger than -fvisibility-hidden.
In opusfile.h there is also a #pragma GCC visibility push(default) that applies default to everything.

This is bad because if the lookup ever goes wrong cross-binary, it creates a very hard to find problem. On macOS this is quite unlikely, Linux is more problematic, but IMHO the best practice is to only export absolutely required symbols in releases.

3 Likes