5

I'm trying to compile a C++11 project on a bunch of old machines with old kernels. They're running CentOS 6.2, 6.3 Alt Linux 4.1. Others are unknown but similarly old. The machines won't let me install a newer version of GCC. 4.4 is the max they can run, and rewriting the project isn't an option.

I somehow managed to build GCC 4.6 locally on one machine, and used it to compile my project, but I don't want to repeat that on every machine. Is there a painless way to compile or run the code on all the machines?

  • Working, but bad solution: Compile the binary static. Then it should run under the other machines without having to install newer gcc runtime libraries there. – jofel Oct 8 '13 at 14:17
  • Is it possible to upgrade these old machines to something more modern? – bigdaveyl Oct 8 '13 at 14:23
  • @bigdaveyl no ( they have some specific hardware and drivers are only available for old kernels.. and so on ) – user286215 Oct 8 '13 at 14:24
  • 3
    @MohsenPahlevanzadeh How does downgrading solve the problem? Old distros do not have C++11 support and newer ones do not ship with the required drivers. (From my own experience I can confirm that this is indeed an issue.) – Marco Oct 8 '13 at 14:38
  • 1
    @user286215 “Is there a painless way to compile or run the code on all the machines?” I'm afraid, the answer is no. You may want to add some information to your question why upgrading to a newer distribution (the obvious solution) is not an option. – Marco Oct 8 '13 at 15:17
2

Probably the best way would be to compile the new version of gcc for all of the machines. You can do this with a script (lfs does this). You should be "safe" copying, pasting, and then running the script from a temp account via ssh.

You could also try and update your repos to have Centos install them for you. Centos might try to upgrade your entire system though.

Also, are you using -std=c++11? If so, you might want to try -std=c++0x.

1

The problem is still actual for me and i've found a nice solution for CentOS - Devtoolset https://www.softwarecollections.org/en/scls/rhscl/devtoolset-3/

It provides a current versions of GCC and some other tools for RHEL/CentOS 6/7.

  • 1
    Be careful, some third party repositories are reported to break the system badly. – vonbrand Jan 11 '16 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.