0

I use RHEL/Centos 8 to compile app/lib for RHEL/Centos 7.

Centos 7's stdlibc++ has maximum (old ABI):

  • CXXABI_1.3.7
  • GLIBCXX_3.4.19

I use CMake with -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 to compile my libraries and my applications for the old ABI to be run on Centos 7.

Nevertheless, the application still requires upper versions: CXXABI_1.3.9 and GLIBCXX_3.4.21.

  • Why? How can I compile for the old ABI?
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC) 
Alexis
  • 2,136
  • 2
  • 19
  • 47
  • ? May be you are using a "devtoolset compiler" ... which uses the old libstdc++ ? ..... Extra native compilers for CentOS 7 : https://stackoverflow.com/questions/47175706/how-to-install-gcc-4-9-2-on-rhel-7-4/47189915#47189915 → → item 3 .. 9. – Knud Larsen May 05 '21 at 18:04
  • No, I'm using Centos 8 to compile lib/app for Centos 7 (old). It seems `D_GLIBCXX_USE_CXX11_ABI` is just for the `cxx11` linking and that has nothing to do with the actual ABI version... I need to set gcc option `-fabi-version=7`. But that is discouraged and I should use Docker. – Alexis May 05 '21 at 23:13
  • Sorry for misunderstanding. .... .... The easy way : Install CenrOS 6.10 into a Virtual Machine or into any old or newer computer. Using a new OS to compile for old is not suggested. – Knud Larsen May 06 '21 at 06:51

0 Answers0