"Mismatch between program and library": C++ ABI 1008 vs. 1002

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

"Mismatch between program and library": C++ ABI 1008 vs. 1002

Nathan Ridge
Hi,

After recompiling my wxWidgets library and application with some newer
compilers, I ran into the following fatal error on startup:

Fatal Error: Mismatch between the program and library build versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1008,STL containers,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1002,STL containers,compatible with 2.8).

The only difference is the C++ ABI version, 1008 vs. 1002.

After some investigation, I discovered that the problem arises from the fact
that I compiled the library with gcc 5.1, which defines __GXX_ABI_VERSION
as 1008, but the application with clang 3.6, which defines __GXX_ABI_VERSION
as 1002.

Is this mismatch an actual problem? I regularly mix gcc and clang with no problems.

Note that I found a Fedora bug on this topic [1] where a GCC developer claimed that:

"That is a WxGTK bug. __GXX_ABI_VERSION can change, but usually the result is
still ABI compatible, g++ emits just some aliases when mangling has changed."

The Fedora maintainers patched the problem by converting the fatal error issued
by wxWidgets to a warning.

Is this assessment, and this fix, appropriate? If so, should the fix be applied to
upstream wxWidgets?

Thanks,
Nate

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1200611

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
 
To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users
Reply | Threaded
Open this post in threaded view
|

Re: "Mismatch between program and library": C++ ABI 1008 vs. 1002

Vadim Zeitlin-4
On Sat, 13 Jun 2015 22:19:42 +0000 Nathan Ridge wrote:

NR> The only difference is the C++ ABI version, 1008 vs. 1002.
NR>
NR> After some investigation, I discovered that the problem arises from the fact
NR> that I compiled the library with gcc 5.1, which defines __GXX_ABI_VERSION
NR> as 1008, but the application with clang 3.6, which defines __GXX_ABI_VERSION
NR> as 1002.
NR>
NR> Is this mismatch an actual problem?

 I don't know, but logically there must have been some reason for the ABI
change so it doesn't seem safe to suppose that the mismatch is not a
problem unless we know what exactly changed and can confirm that this
doesn't affect wxWidgets (because it doesn't use anything affected by the
change).

NR> Note that I found a Fedora bug on this topic [1] where a GCC developer
NR> claimed that:
NR>
NR> "That is a WxGTK bug.  __GXX_ABI_VERSION can change, but usually the
NR> result is still ABI compatible, g++ emits just some aliases when
NR> mangling has changed."

 I don't think "usually" is nearly good enough.

NR> The Fedora maintainers patched the problem by converting the fatal
NR> error issued by wxWidgets to a warning.
NR>
NR> Is this assessment, and this fix, appropriate?

 I don't think so.

NR> [1] https://bugzilla.redhat.com/show_bug.cgi?id=1200611

 ... and I left a comment there to this effect.

 Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/

attachment0 (203 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: "Mismatch between program and library": C++ ABI 1008 vs. 1002

Nathan Ridge
> NR> The only difference is the C++ ABI version, 1008 vs. 1002.
> NR>
> NR> After some investigation, I discovered that the problem arises from the fact
> NR> that I compiled the library with gcc 5.1, which defines __GXX_ABI_VERSION
> NR> as 1008, but the application with clang 3.6, which defines __GXX_ABI_VERSION
> NR> as 1002.
> NR>
> NR> Is this mismatch an actual problem?
>
> I don't know, but logically there must have been some reason for the ABI
> change so it doesn't seem safe to suppose that the mismatch is not a
> problem unless we know what exactly changed and can confirm that this
> doesn't affect wxWidgets (because it doesn't use anything affected by the
> change).

I posted about this to gcc-help [1]. It looks like __GXX_ABI_VERSION is
governed by the '-fabi-version=n' flag, whose default value has changed
over gcc releases.

Based on the documentation for this flag [2], here are the changes from
version 2 ('1002') to version 8 ('1008'):

  - Version 3 corrects an error in mangling a constant address as a
template argument.

       - Version 4, which first appeared in G++ 4.5, implements a standard
mangling for vector types.

       - Version 5, which first appeared in G++ 4.6, corrects the mangling of
attribute const/volatile on function pointer types, decltype of a
plain decl, and use of a function parameter in the declaration of
another parameter.

       - Version 6, which first appeared in G++ 4.7, corrects the promotion
behavior of C++11 scoped enums and the mangling of template argument
packs, const/static_cast, prefix ++ and –, and a class scope function
used as a template argument.

       - Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
builtin type and corrects the mangling of lambdas in default argument
scope.

       - Version 8, which first appeared in G++ 4.9, corrects the substitution
behavior of function types with function-cv-qualifiers.

     
These all look like very edge-case situations. Is it really worth being this strict
about them?

Regards,
Nate

[1] https://gcc.gnu.org/ml/gcc-help/2015-06/msg00091.html
[2] https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html
     

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users
Reply | Threaded
Open this post in threaded view
|

Re[2]: "Mismatch between program and library": C++ ABI 1008 vs. 1002

Vadim Zeitlin-4
On Mon, 15 Jun 2015 07:15:10 +0000 Nathan Ridge wrote:

NR> Based on the documentation for this flag [2], here are the changes from
NR> version 2 ('1002') to version 8 ('1008'):

 Thanks for the list!

NR>   - Version 3 corrects an error in mangling a constant address as a
NR> template argument.

 We're probably not affected by this.

NR>        - Version 4, which first appeared in G++ 4.5, implements a standard
NR> mangling for vector types.

 I'm not sure what are vector types, I suspect this is not std::vector<>
but rather something SSE-related?

NR>        - Version 5, which first appeared in G++ 4.6, corrects the mangling of
NR> attribute const/volatile on function pointer types, decltype of a
NR> plain decl, and use of a function parameter in the declaration of
NR> another parameter.

 We do use function parameters here and there but I don't know if our use
falls under this case.

NR>        - Version 6, which first appeared in G++ 4.7, corrects the promotion
NR> behavior of C++11 scoped enums and the mangling of template argument
NR> packs, const/static_cast, prefix ++ and –, and a class scope function
NR> used as a template argument.
NR>
NR>        - Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
NR> builtin type and corrects the mangling of lambdas in default argument
NR> scope.
NR>
NR>        - Version 8, which first appeared in G++ 4.9, corrects the substitution
NR> behavior of function types with function-cv-qualifiers.

 OK, those don't seem likely to affect us neither.

NR> These all look like very edge-case situations. Is it really worth being this strict
NR> about them?

 Probably not. So we could define some wxGXX_EFFECTIVE_ABI_VERSION in
wx/build.h as 1002 if __GXX_ABI_VERSION is between 1002 and 1008 and use it
in the build options signature instead of __GXX_ABI_VERSION itself. If
anybody feels like doing this, testing whether it really works and
submitting a patch if it does, it would be welcome, as always.

 TIA,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/

attachment0 (203 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Re[2]: "Mismatch between program and library": C++ ABI 1008 vs. 1002

Nathan Ridge
> NR>   - Version 4, which first appeared in G++ 4.5, implements a standard
> NR> mangling for vector types.
>
> I'm not sure what are vector types, I suspect this is not std::vector<>
> but rather something SSE-related?

Yeah, they're the SIMD vector types [1].

> NR>   - Version 5, which first appeared in G++ 4.6, corrects the mangling of
> NR> attribute const/volatile on function pointer types, decltype of a
> NR> plain decl, and use of a function parameter in the declaration of
> NR> another parameter.
>
> We do use function parameters here and there but I don't know if our use
> falls under this case.

I believe an affected case would look something like this:

template <typename T>
void foo(T a, decltype(a) b);

The criteria are:
  - the function is a template (otherwise the 'decltype' just gets expanded
    before mangling)
  - the type of one parameter references another parameter (such as via
    'decltype' or 'sizeof')
  - the type of the referenced parameter is dependent

> NR> These all look like very edge-case situations. Is it really worth being this strict
> NR> about them?
>
> Probably not. So we could define some wxGXX_EFFECTIVE_ABI_VERSION in
> wx/build.h as 1002 if __GXX_ABI_VERSION is between 1002 and 1008 and use it
> in the build options signature instead of __GXX_ABI_VERSION itself. If
> anybody feels like doing this, testing whether it really works and
> submitting a patch if it does, it would be welcome, as always.

I'll write a patch in the coming days. Thanks for your help in arriving at
a solution.

Regards,
Nate

[1] https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html
     

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users
Reply | Threaded
Open this post in threaded view
|

Re: "Mismatch between program and library": C++ ABI 1008 vs. 1002

Marian 'VooDooMan' Meravy-2
On 2015-06-15 20:00, Nathan Ridge wrote:
>> NR>   - Version 5, which first appeared in G++ 4.6, corrects the mangling of
>> NR> attribute const/volatile on function pointer types, decltype of a
>> NR> plain decl, and use of a function parameter in the declaration of
>> NR> another parameter.
>>
>> We do use function parameters here and there but I don't know if our use
>> falls under this case.

IMO "corrects the mangling of attribute const/volatile on function
pointer types" means like change mangled function name in case of like:

void fn(const char* ptr);
void fn(volatile char* ptr);

_OR_

void fn(char* const ptr);
void fn(char* volatile ptr);

this second case would be better, since I guess it is very rare, and I
don't know whether we use it at all.

IMO they meant the second case.

best,
vdm
.

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: "Mismatch between program and library": C++ ABI 1008 vs. 1002

Marian 'VooDooMan' Meravy-2
On 2015-06-16 23:42, Marian 'VooDooMan' Meravy wrote:

> On 2015-06-15 20:00, Nathan Ridge wrote:
>>> NR>   - Version 5, which first appeared in G++ 4.6, corrects the mangling of
>>> NR> attribute const/volatile on function pointer types, decltype of a
>>> NR> plain decl, and use of a function parameter in the declaration of
>>> NR> another parameter.
>>>
>>> We do use function parameters here and there but I don't know if our use
>>> falls under this case.
>
> IMO "corrects the mangling of attribute const/volatile on function
> pointer types" means like change mangled function name in case of like:
now I am re-reading this, and it looks like they actually meant pointers
to functions... So I guess this one is not our case either...

best,
vdm
.

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Re[2]: "Mismatch between program and library": C++ ABI 1008 vs. 1002

Nathan Ridge
In reply to this post by Nathan Ridge
>> So we could define some wxGXX_EFFECTIVE_ABI_VERSION in
>> wx/build.h as 1002 if __GXX_ABI_VERSION is between 1002 and 1008 and use it
>> in the build options signature instead of __GXX_ABI_VERSION itself. If
>> anybody feels like doing this, testing whether it really works and
>> submitting a patch if it does, it would be welcome, as always.
>
> I'll write a patch in the coming days. Thanks for your help in arriving at
> a solution.

I submitted a pull request [1], and verified that with this patch, I can successfully
mix my gcc 5.1 built library and my clang 3.6 built application.

Regards,
Nate

[1] https://github.com/wxWidgets/wxWidgets/pull/40
     

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users