Richard Viney
Richard Viney

Reputation: 1007

Symbol visibility linker warnings in Xcode 4.4

I've moved from Xcode 4.3 to the new 4.4 version that was just released and now get a few dozen linker warnings of this nature when building a framework:

Direct access in <some method> to global weak symbol <some other method>
means the weak symbol cannot be overridden at runtime. This was likely
caused by different translation units being compiled with different
visibility settings.

There are a few other questions on SO about this warning which seem to be solved by making sure -fvisibility=hidden -fvisibility-inlines-hidden is on everywhere and then doing full rebuilds, but this hasn't solved the warnings in my case. I have triple-checked and -fvisibility=hidden -fvisibility-inlines-hidden is present for all the compiles done by Xcode, including C++ files, Objective C++ files and the precompiled header. I have done full rebuilds including wiping out Xcode's DerivedData for my project. Nothing seems to help.

These warnings didn't occur under Xcode 4.3, but I don't have another Mac handy with 4.3 on to go back and sanity check with. I'm still running Lion.

The other weird thing is that the project has an external SCons build system that builds all the same code with -fvisibility=hidden -fvisibility-inlines-hidden using the Xcode 4.4 command line tools and it doesn't report any of these linker warnings (same compiler version in both cases).

I'm going to keep digging, but any expert insight would be appreciated. Maybe it's an Xcode 4.4 change I'm unaware of?

Thanks.

Upvotes: 1

Views: 635

Answers (1)

Richard Viney
Richard Viney

Reputation: 1007

It turns out I needed to remove -fvisibility-inlines-hidden from both my .framework build and the .app build, this made the warnings disappear.

Upvotes: 2

Related Questions