0

In dealing with the same problem described in this question (only with different specific versions), I've added the following to my top-level CMakeLists.txt file:

add_definitions(-D__GXX_ABI_VERSION=1002)

...since 1002 is the version my build of wxWidgets wants. Okay, great; now the compiled program will run. But now when I do a make, every single compiled file emits the following warning:

<command-line>: warning: "__GXX_ABI_VERSION" redefined
<built-in>: note: this is the location of the previous definition

So yeah, I know I [re]defined __GXX_ABI_VERSION on the command-line, and I guess I knew that it was previously defined in some "built-in" fashion, but I did it on purpose. Is there something I can add to my CMakeLists.txt file to get that specific warning suppressed? I don't want to suppress any other redefinition warnings; just that specific one. I've taken to redirecting make's stderr to a file and greping it for "error:" in order to pick actual compilation errors out of the haystack of warnings, and that's a pain...

Brian A. Henning
  • 1,374
  • 9
  • 24

2 Answers2

1

I don't think manually changing the version is a good idea. You may get unexpected behaviors. The correct way to solve the problem is to really use the expected version not to patch the version name.

However, to answer your question you could try

add_definitions(-U__GXX_ABI_VERSION=0LD) #replace 0LD by the old version
add_definitions(-D__GXX_ABI_VERSION=1002)
Julien
  • 1,810
  • 1
  • 16
  • 34
  • Although I agree with the logic of your caution, it seems to be a widely-enough suggested approach that I'm comfortable with the risk. I will try what you suggested of specifically `-U`-ing the old value; I tried it with simply `-U__GXX_ABI_VERSION -D__GXX_ABI_VERSION=1002` and apparently the -U took precedence and the code was built without the symbol defined at all. – Brian A. Henning Mar 06 '19 at 12:45
  • Afraid your suggestion only results in an additional warning: `: warning: extra tokens at end of #undef directive`. But! I've just determined that the proper ABI version controlling argument, `-fabi-version=2` sets a value of 1002. So thanks for the warning, which urged me to find an alternative to my present approach! – Brian A. Henning Mar 06 '19 at 17:32
0

Thanks to Julien's prodding, I investigated the effects of the GCC option -fabi-version=.... Lo and behold, specifying -fabi-version=2 results in __GXX_ABI_VERSION being defined as 1002. So, the fix:

Change

add_definitions(-D__GXX_ABI_VERSION=1002)

to

add_definitions(-fabi-version=2)
Brian A. Henning
  • 1,374
  • 9
  • 24