-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Building mbgl-native with g++ against binary libs built with clang++ #2502
Comments
Linux/gcc linker errors appear to be fixed when building with |
Here is a linux build with the link error:
The command that compiles
The command that compiles
Dumping symbols from
|
http://demangler.com/ is able to demangle that symbol, and it matches the name of the symbol that GCC thinks is undefined. My hunch is this is simply a compiler bug, in that they don't agree what the mangled name of the symbol should be, though I'm not sure whether it's clang-3.5's or GCC's fault. I'm going to build mbgl again with |
Had to use
Compare that to the symbol that clang-3.5 generated:
I've highlighted the one character difference. |
The Conclusion: this is a GCC ABI bug, which can be fixed by compiling in GCC with Documentation for
Note that clang does not have an equivalent of
Fun times. |
Confirmed that Since |
On Linux some users will prefer clang++ and others g++. So we want to support both compilers, as long as they are recent enough to support c++14.
Note: On OS X life is easy because only clang++ is used commonly. And despite there being both
libc++
andlibstdc++
present on OS X, Apple has worked to make them binary compatible (so applications can link one and then link a dependent library that links another without problems).Mixing these two compilers is generally fine in my experience because clang++ aims at g++ compatibility. But in the end they are different compilers. So subtly different compiler flags may behave different and linking binaries from each is not 100% since even if things work today, they may not tomorrow as these compilers iterate quickly.
Let's use this ticket as a master ticket to flesh out where mixing compilers breaks down. Let's restrict scope to
mbgl
code and the specific deps we require. And toc++14
and just recent clang++ and g++ versions. And let's ignore-flto
which is notoriously non compatible/portable. Let's get a good working sense of these questions:-std=c++11
and-std=c++14
be mixed or not mixed.clang++
andg++
be mixed or not mixed and for what versions?-fvisibility=hidden
and-fvisibility-inlines-hidden
pay into this complexity?Background:
The text was updated successfully, but these errors were encountered: