return '\n'.join(output)
def host_gcc_version(d):
+ import re, subprocess
+
compiler = d.getVar("BUILD_CC", True)
- retval, output = getstatusoutput("%s --version" % compiler)
- if retval:
- bb.fatal("Error running %s --version: %s" % (compiler, output))
- import re
+ try:
+ env = os.environ.copy()
+ env["PATH"] = d.getVar("PATH", True)
+ output = subprocess.check_output("%s --version" % compiler, shell=True, env=env).decode("utf-8")
+ except subprocess.CalledProcessError as e:
+ bb.fatal("Error running %s --version: %s" % (compiler, e.output.decode("utf-8")))
+
match = re.match(".* (\d\.\d)\.\d.*", output.split('\n')[0])
if not match:
bb.fatal("Can't get compiler version from %s --version output" % compiler)