[cfe-dev] Clang, AppleClang and hidden visibility issues in C++ libraries

René J.V. Bertin via cfe-dev cfe-dev at lists.llvm.org
Sun Nov 11 01:23:17 PST 2018


Hi,

I keep running into and hearing about issues where Qt/KDE projects fail to build because of symbols not being found during linking. This is in libraries provided by the project itself. These projects all set symbol visibility to hidden by default and when I run `nm` on the library supposed to provide the symbol I see it's there but labelled 't' instead of 'T'.

It seems that most of the time this occurs when using Apple's clang version from Xcode and that using a recent (>= 4) "stock" clang from MacPorts solves the issue, without changing anything else. I've been writing this off to the fact that my own AppleClang (from Xcode 6.2) is getting old but I just heard that the one from Mac OS 10.13 is affected too. I'm not sure exactly what stock clang version that corresponds to, but I'm hoping it should be at least 5.0 .

Any idea what can cause this, and more importantly, how to fix it?
The project mentioned above is libkcddb (https://cgit.kde.org/libkcddb.git/) and I have to suppose the relevant compiler options are set in the extra-cmake-modules (https://cgit.kde.org/extra-cmake-modules.git/; I'm not seeing anything suspicious in there though).

The way to catch stock clang or Apple's clang in cmake is still `CMAKE_CXX_COMPILER_ID MATCHES "Clang"`, right?

Thanks,
R.





More information about the cfe-dev mailing list