__GXX_ABI_VERSION: 1002 vs. 1008

Marc Glisse marc.glisse@inria.fr
Mon Jun 15 05:40:00 GMT 2015


On Mon, 15 Jun 2015, Nathan Ridge wrote:

> I recently ran into an issue related to two compilers giving different values
> for __GXX_ABI_VERSION [1].
>
> The two compilers were gcc 5.1, which reported '1008', and clang 3.6, which
> reported '1002'.
>
> The issue is that a library (wxWidgets) produces a fatal runtime error if there
> is a mismatch between the __GXX_ABI_VERSION of the compiler used to
> build the library, and the compiler used to build the application using the
> library.
>
> What I'd like to know is:
>   - what exactly does __GXX_ABI_VERSION signify?

-fabi-version=n
https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html

>   - why do gcc 5.1 and clang 3.6 report different values?

Clang's value is likely meaningless, they copied all the macros that gcc 
was defining at the time of 4.2.

>   - is the library's behaviour (of producing a fatal runtime error upon a
>     mismatch) appropriate?

I think it is a bad idea, it ignores -fabi-compat-version and causes 
trouble for users, whereas the ABI changes only affect corner cases and 
usually result in compilation failure, not weird runtime behaviors. Do 
they also check _GLIBCXX_USE_CXX11_ABI? But it is their choice, I can 
understand wanting to eliminate as many outside sources of bugs as 
possible before investigating issues. Now that g++ uses -fabi-version=0 by 
default, there will probably be enough pressure that they will have to 
remove that error (at least downgrade it to a warning), or all 
distributions will do that for them.

-- 
Marc Glisse



More information about the Gcc-help mailing list