add -std=c++11 to $CXXFLAGS when building binutils 2.42+ with system GCC 4.8.1 to 5.x#3728
add -std=c++11 to $CXXFLAGS when building binutils 2.42+ with system GCC 4.8.1 to 5.x#3728boegel merged 5 commits intoeasybuilders:developfrom
-std=c++11 to $CXXFLAGS when building binutils 2.42+ with system GCC 4.8.1 to 5.x#3728Conversation
… GCC 4.8.1 to 5.x
| and self.toolchain.comp_family() == toolchain.SYSTEM | ||
| ): | ||
| res = run_shell_cmd('g++ --version') | ||
| gxx_version = res.output.strip().split(' ')[2] |
There was a problem hiding this comment.
This is not strictly correct, it should be
gxx_version = res.output.strip().split(' ')[-1]
Since it is the last part of the output that contains the version.
On Ubuntu [2] would return something similar to "13.3.0-6ubuntu2~24.04)" while [-1] returns "13.3.0"
Also, I don't really know if we want to support a SYSTEM GCC compiler that old...
What is it from?
There was a problem hiding this comment.
And this can be easily solved by adding a hook that adds that to configopts (where it should really go) for a site with such an old system gcc.
And it should add -std=c++11 to CXXFLAGS, not override it in the style of the lines above.
There was a problem hiding this comment.
We have a function for this in framework, better use this?
Either get_gcc_version, or get_tool_version('g++') (both from easybuild.tools.systemtools`)
There was a problem hiding this comment.
My command to get g++ version is indeed not strictly correct. I will commit after.
gxx_version = res.output.strip().split(' ')[-1]
This is not strictly correct for RHEL-based Linux distributions as well. Maybe g++ -v not g++ --version is better. The last line of g++ -v output string looks easier to parse. I will check it later.
The reason I created this PR is I'm working on CentOS 7 to compile universal binaries targeting glibc 2.17. eb foss-2024a.eb -r will first compile binutils-2.42 with SYSTEM toolchain including gcc-4.8.5. However, gcc-4.8.5 uses the dafault C++ standard (C++ 98) during compilation even if gcc-4.8.5 had already support C++ 11 standard. The build option --std=c++11 must be explicitly specified. This will cause compilation failure, as described in the issue easybuilders/easybuild-easyconfigs#22651.
Next, what is the range of affected versions of gcc? See https://gcc.gnu.org/projects/cxx-status.html.
GCC 4.8.1 was the first feature-complete implementation of the 2011 C++ standard, previously known as C++0x.
So, the start of range is 4.8.1 (include 4.8.1).
This mode is the default in GCC 6.1 up until GCC 10 (inclusive); it can be explicitly selected with the -std=c++14 command-line flag, or -std=gnu++14 to enable GNU extensions as well.
Up util gcc-6.1.0, the default standard changed to C++ 14. So, the end of range is 6.1.0(not include 6.1.0). That is, gcc 4.8.1 to 5.x. The command g++ -dM -E -x c++ /dev/null | grep __cplusplus can be secondary verification.
There was a problem hiding this comment.
We have a function for this in framework, better use this?
Either
get_gcc_version, orget_tool_version('g++') (both fromeasybuild.tools.systemtools`)
I will try this. Thank you.
There was a problem hiding this comment.
@lijiebio Thanks for the extra changes!
I included some minor code cleanup in cdb5eb7, should be good to go now as long as tests don't reveal any unexpected problems.
Beware that you're going into uncharted territory with doing builds in an old & unsupported OS like CentOS 7, you'll likely run into more problems because of this, mainly with installations that involve the system toolchain and hence system compiler, but potentially also because of the old glibc version...
There was a problem hiding this comment.
One concrete example that you'll hit with the soon to be released EasyBuild v5.1.0: easybuilders/easybuild-easyconfigs#22798
| and self.toolchain.comp_family() == toolchain.SYSTEM | ||
| ): | ||
| res = run_shell_cmd('g++ --version') | ||
| gxx_version = res.output.strip().split(' ')[2] |
There was a problem hiding this comment.
We have a function for this in framework, better use this?
Either get_gcc_version, or get_tool_version('g++') (both from easybuild.tools.systemtools`)
CXXFLAGS="-std=c++11" for SYSTEM GCC 4.8.1 to 5.x-std=c++11 to $CXXFLAGS when building binutils 2.42+ with system GCC 4.8.1 to 5.x
|
@boegelbot please test @ jsc-zen3 |
|
@boegel: Request for testing this PR well received on jsczen3l1.int.jsc-zen3.fz-juelich.de PR test command '
Test results coming soon (I hope)... Details- notification for comment with ID 2904513281 processed Message to humans: this is just bookkeeping information for me, |
|
Test report by @boegelbot Overview of tested easyconfigs (in order)
Build succeeded for 6 out of 6 (6 easyconfigs in total) |
|
Test report by @boegel Overview of tested easyconfigs (in order)
Build succeeded for 6 out of 6 (6 easyconfigs in total) |
|
Test report by @boegel Overview of tested easyconfigs (in order)
Build succeeded for 4 out of 4 (4 easyconfigs in total) |
|
@lijiebio Thanks a lot for your contribution! |
easybuilders/easybuild-easyconfigs#22651