[CMake] Android NDK, clang, and ODR violations

Christopher Broadbent chris at macolighting.com
Thu Jul 27 19:22:16 EDT 2017


On 28/07/2017 02:28, Dan Albert wrote:
> (in case threading doesn't work since I'm not a list member and can't 
> reply to the original message: 
> https://cmake.org/pipermail/cmake/2017-July/065886.html)
> 
> I'm pretty sure -Wl,--detect-odr-violations is just giving you false 
> positives. Note that the warning message says "/possible/ ODR 
> violation". We tried using this flag in the Android platform recently 
> and found lots of false positives too.
> 
> Those symbols are weak in libc++abi, so this is not an ODR violation 
> (they're not weak in libstdc++.so, and that's a bug, but not a harmful 
> one; I'm fixing it right now either way).
> 
> FWIW, CMake shouldn't be linking libstdc++.so /and/ libc++_static.a in 
> the same link either way, but this is actually something that both 
> upstream CMake, the NDK's CMake toolchain file, and ndk-build all get 
> wrong. It's something that we should resolve eventually, but it doesn't 
> actually cause any problems so it hasn't been prioritized. Could argue 
> that it has caused this problem, but this would still be firing on false 
> positives if you'd added your own new/delete replacements, and this 
> warning is still pretty much guaranteed to fire for libc++ because 
> libandroid_support will do exactly the same thing and try to replace a 
> bunch of things in libc.

Thanks, I'll move ahead with the switch, and look in to filtering out 
the warnings on these symbols, rather than disabling the ODR checks 
entirely.



More information about the CMake mailing list