Yes, you can usually use clang with GCC compiled libraries (and vice versa, use gcc with CLANG compiled libraries) because this is actually not a compilation, but a link , which matters. You may be out of luck and get unpleasant surprises.
In principle, you may have some dependencies on the version of libstdc++ used to link the corresponding libraries (if they are encoded in C ++). Actually, this usually does not really matter.
In C ++, name mangling could theoretically be a problem (there may be some angular cases, even incompatibilities between two different versions of g++ ). Again, in practice this is usually not a problem.
As a rule, you can mix CLANG (even different but close versions) with GCC, but you may have unpleasant surprises. What you would expect from any C ++ compiler (be it CLANG or GCC) is simply the ability to compile and link all the software (and all libraries) together using the same compiler and version. This is why updating the compiler in the distribution is a lot of work: developers must make sure that all packages are compiled (and they really get surprises!).
source share