0

I have a C++ program that uses various C++14 features, and have been asked to compile it for a CentOS 6 system. GCC doesn't support C++14 features on CentOS 6 as far as I can tell (and based on compiler errors).

Is it possible to compile for C++14 on CentOS 6?

Assuming someone has created a whole compatibility layer for compiling C++14 on CentOS6, could I even distribute that executable? Or would the target machine ALSO have to install a compatibility layer?

I recall reading (years ago) about how to use different development toolchains at once, including I think those later than what was supported by the repos for the OS. Just can't recall details.

9
  • What version of gcc do you have installed? Looks like you need at least 5. gcc.gnu.org/projects/cxx-status.html#cxx14 Commented Jan 3, 2022 at 20:56
  • 2
    CentOS 6 has seen its last maintenance update in November 2020, i.e. over a year ago. I would have to hear a very convincing argument from the person doing the asking why I should bother compiling a binary for a dead OS version. Not just for the reasons stated in this question, but for safety and sanity reasons. Commented Jan 3, 2022 at 21:25
  • @DevSolar I deal with this at work. Containers have been a blessing and curse in this regard. Also, that'd be my answer, if CentOS 6 could support containers. I don't think it can even do that. Commented Jan 3, 2022 at 21:59
  • @RetiredNinja I'm running gcc 4.4.7 (last available from CentOS repo). Commented Jan 3, 2022 at 22:13
  • @DevSolar - My customer is pretty tech savvy so I assume they have carefully thought through their decision to use CentOS 6. (Not all customers appreciate that type of feedback) Commented Jan 3, 2022 at 22:14

1 Answer 1

-1

No, it is not possible to compile C++14 on CentOS 6. Only some C++11 features are available on CentOS 6.

CentOS runs GCC 4.4.7 where-in C++14 features start to become available with GCC 4.9 and higher.

The Boost libraries may be used to replicate some modern C++ features if on an outdated GCC version.

Sign up to request clarification or add additional context in comments.

2 Comments

It is completely possible to compile gcc 5 on CentOS 6 and get the needed support. I believe there is even a dev repo where you can just yum install a newer gcc. However, the real issue is a dead OS being used in a production environment.
What does compilation have to do with production? There is no "real issue" here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.