You mean I should use the previous g++ version 5.0 or whatever? |
The maintainer said that this project requires G++7, so you
must use G++7 or later to compile this project.
The problem is that in general, code compiled by one compiler and one set of compiler settings is
not compatible with code compiled by another compiler and set of compiler settings. We would say that in general, code compiled with different settings or with different compilers have differing
application binary interfaces, or ABIs.
G++ tries to provide a forward-compatibility guarantee where there isn't one in general, but this time the guarantees couldn't be maintained.
You must build all of your code against the same ABI, preferably with the same compiler.
This might be as simple as saying
$ CC=gcc-7 CXX=/usr/bin/g++-7 cmake --build . clean
$ CC=gcc-7 CXX=/usr/bin/g++-7 cmake -DCMAKE_BUILD_TYPE=Release --build .
|
If that doesn't work because of dependencies on third-party libraries built against the old ABI, you need to either rebuild the old libraries with the new compiler (maybe a big deal), or specifically ask for G++7 to emit ABI-compatible code by specifying
_GLIBCXX_USE_CXX11_ABI=0 on the command line (easy):
$ CC=gcc-7 CXX=/usr/bin/g++-7 cmake -D_GLIBCXX_USE_CXX11_ABI=0 --build . clean
$ CC=gcc-7 CXX=/usr/bin/g++-7 cmake -D_GLIBCXX_USE_CXX11_ABI=0 \
-DCMAKE_BUILD_TYPE=Release --build . |
Then you should probably revert your system compiler to the old one, I guess with
update-alternatives if that's what you used. This particular change to the compiler settings (the default value of _GLIBCXX_USE_CXX11_ABI) is a breaking change. No need to uninstall G++7.
See this page for some background:
https://wiki.gentoo.org/wiki/Upgrading_GCC
This one is relevant to you too, despite the difference in the version numbers
https://wiki.gentoo.org/wiki/Upgrading_from_gcc-4.x_to_gcc-5.x