Re: [OE-core] [PATCH 4/4] sanity.bbclass: add test for gcc < 5.0

Richard Purdie
2020-03-30T19:52:46Z

On Mon, 2020-03-30 at 12:43 -0700, Tim Orling wrote:
> +# The gcc version in CentOS-7 (4.8.5) is known to be a problem.
> +# Require at least gcc version 5.0.
> +#
> +# This can be fixed on CentOS-7 with devtoolset-6+
> +# https://www.softwarecollections.org/en/scls/rhscl/devtoolset-6/
> +#
> +# A less invasive fix is with scripts/install-buildtools (or with user
> +# built buildtools-extended-tarball)
> +#
> +def check_gcc_version(sanity_data):
> + from distutils.version import LooseVersion
> + import subprocess
> + build_cc = sanity_data.getVar('BUILD_CC').strip()
> + if build_cc == "gcc":
> + try:
> + result = subprocess.check_output(["gcc", "--version"], stderr=subprocess.DEVNULL).decode('utf-8')
> + except subprocess.CalledProcessError as e:
> + return "Unable to execute gcc --version, exit code %d\n%s\n" % (e.returncode, e.output)
> + version = result.split()[2]
> + if LooseVersion(version) < LooseVersion("5.0"):
> + return "Your version of gcc is older than 5.0 and will break builds. Please install a newer version of gcc (you could use the project's buildtools-extended-tarball or use scripts/install-buildtools).\n"
> + return None

I had forgotten we had this but a recent patch reminded me, would we
want to tweak this function:

http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/lib/oe/utils.py?h=master-next#n376

?

Cheers,

Richard