5

I need to use newer version of GCC (7.3.1) to link against libraries that were compiled by GCC 4.8. For libstdc++ ABI I just need to set _GLIBCXX_USE_CXX11_ABI=0 macro, but what about language ABI (-fabi-version)? Do I need to set -fabi-version to the same version that old compiler uses, or -fabi-compat-version? Thanks.

equeim
  • 107
  • 10
  • As I know it is not really possible to intermix all that. If you use STL it needs the new ABI to get all features run. Compiling it with old ABI enabled will result in errors or reduced feature set. Why you can't compile all libs with current release? – Klaus Jul 09 '18 at 12:43
  • Because I'm compiling for distribution that has only GCC 4.8. Recompiling the whole system is not an option. AFAIK there shouldn't be any problem with old libstdc++ ABI if all libraries that you link with use it too (and this is my case). You will just use old implementations of std::string and sts::list. Anyway I was asking about language ABI, not libstdc++ ABI. – equeim Jul 09 '18 at 13:02
  • In that case I would advice you to install the old compiler in parallel and use it as a cross compiler for the old systems you maintain. Intermixing code which needs different ABIs is not a good idea. But if you say youneed to use C++14 which requires the ABI change and want to run it on a system which can not use this ABI you simply can't continue! – Klaus Jul 09 '18 at 13:04
  • But isn't -fabi-version option (https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html) is what I need? It allows newer versions of GCC to compile with old ABI, or am I missing something? – equeim Jul 09 '18 at 13:09
  • But it can't work if you use new features which are requiring the new ABI. You try to use c++14, which requires new ABI. So how should that work if the compiler can't put the needed information to object files? – Klaus Jul 09 '18 at 13:24
  • Description of -fabi-version option in documentation doesn't mention any C++14 features, only bugfixes. – equeim Jul 09 '18 at 13:52

2 Answers2

1

It's tricky to play with various gcc, as @Goswin von Brederlow said. You should use gcc 4.8 with -std=c++1y in order to use C++14 as suggested here

ractiv
  • 712
  • 8
  • 19
0

Don't. Too many problems.

Better to install or build a gcc-4.8.

Goswin von Brederlow
  • 11,875
  • 2
  • 24
  • 42