tcmode: disable pseudo when running the toolchain

The sourcery toolchain writes temporary files to /tmp, and includes the
username. If multiple users are doing builds with pseudo enabled, it'll try to
write to the other user's file, since both will use 'root', and the build will
fail as a result.

Initially, I attempted to alter CC, KERNEL_CC, LD, etc to prepend with 'env
PSEUDO_UNLOAD=1 ', but this isn't ideal, as it seems there are cases where our
vars aren't obeyed. For example, the kernel build runs gcc -E, but it seems it
gets that from the cross-compiler prefix, not from CC, and we aren't passing
anything in for CPP. So, for now, use wrappers to deal with it, to ensure that
absolutely any call to any of the toolchain binaries will unload pseudo.

JIRA: MEIP-393, SB-1905

Signed-off-by: Christopher Larson <kergoth@gmail.com>
This commit is contained in:
Christopher Larson
2014-04-10 08:15:22 -07:00
parent 1cc4c3b067
commit 6bd4ec919a

View File

@@ -151,12 +151,12 @@ def populate_toolchain_links(d):
for f in files:
base = os.path.basename(f)
newpath = os.path.join(bindir, base)
try:
os.symlink(f, newpath)
except OSError as exc:
if exc.errno == errno.EEXIST:
break
bb.fatal("Unable to populate toolchain binary symlink for %s: %s" % (newpath, exc))
if not os.path.exists(newpath):
with open(newpath, 'w') as new:
new.write('#!/bin/sh\n')
new.write('export PSEUDO_UNLOAD=1\n')
new.write('exec {0} "$@"\n'.format(f))
os.chmod(newpath, 0755)
# Ensure that we have a ld.bfd available, now that KERNEL_LD uses it
ld = d.expand('${TARGET_PREFIX}ld')