run a c++ program with c++11 support in older CentOS machine

Issues related to applications and software problems
Post Reply
gane.prog
Posts: 1
Joined: 2018/08/27 12:21:16

run a c++ program with c++11 support in older CentOS machine

Post by gane.prog » 2018/08/27 13:25:48

How to upgrade libstdc++-4.4.7 on CentOS 6.10 to libstdc++-4.8.5 on CentOS 6.10

I build my c++ program on CentOS 7.5 with libstdc++-4.8.5 for c++11 using features.

Now I have to run my program on CentOS 6.10 for production.


Can I install libstdc++-4.8.5-28.el7.i686 on CentOS 6.10 if not any other posibilities ?

User avatar
TrevorH
Forum Moderator
Posts: 24098
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: run a c++ program with c++11 support in older CentOS machine

Post by TrevorH » 2018/08/27 17:51:46

Build your program on CentOS 6 if that's where you want it to run. You cannot get the newer glibc etc onto CentOS 6 and if you could, it would be way way simpler just to update to CentOS 7 in the first place.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

chemal
Posts: 448
Joined: 2013/12/08 19:44:49

Re: run a c++ program with c++11 support in older CentOS machine

Post by chemal » 2018/08/28 04:44:59

Now I have to run my program on CentOS 6.10 for production.
Compile your source code on 6.10. You can choose from five devtoolsets offering gcc 4.8.2, 4.9.2, 5.3.1, 6.3.1, and 7.3.1, respectively. That should be enough C++11.

User avatar
jlehtone
Posts: 2046
Joined: 2007/12/11 08:17:33
Location: Finland

Re: run a c++ program with c++11 support in older CentOS machine

Post by jlehtone » 2018/08/28 07:57:14

The "devtoolsets" come from Software Collections (SCL).
To install (these) SCL packages, you need:

Code: Select all

yum install centos-release-scl-rh
There are currently only two devtoolset versions, the older ones have been removed:
devtoolset-6 and devtoolset-7

Available versions of g++ are thus:

Code: Select all

compat-gcc-34-c++.x86_64            3.4.6-19.el6   base
devtoolset-6-gcc-c++.x86_64         6.3.1-3.1.el6  centos-sclo-rh
devtoolset-7-gcc-c++.x86_64         7.3.1-5.10.el6 centos-sclo-rh
gcc-c++.x86_64                      4.4.7-23.el6   base
To get the devtoolset version, I do recommend:

Code: Select all

yum install devtoolset-7-toolchain
That pulls in the tools to do a build.

In order to do a build:

Code: Select all

scl enable devtoolset-7 bash
make
exit
The scl starts a command (bash) with environment, where devtoolset-7 tools are first in PATH.
The binaries ought to run in normal environment.

Post Reply