pmbootstrap needs to be adjusted to distcc 3.3
Yesterday, distcc
has been upgraded to 3.3 in Alpine Linux (edge
branch, which is what we use). distcc uses a white-list for allowed compiler names now, which means we need to fill up that white-list with our cross compilers in order to still have them working. Actually, the white-list are a bunch of symlinks that need to have the allowed compiler's name and point to /usr/bin/distcc
.
In pmbootstrap
we are masquerading the compiler names already by using paths like /usr/lib/arch-bin-masquerade/aarch64/gcc
. We need to change that workflow, because the white-listed compiler names must not contain a path separator character.
In addition, there's built-in support for cross compilers in distcc
now by automatically resolving compiler names to the fully qualified name (i.e. x86_64-linux-gnu-gcc
instead of gcc
). Unfortunately that did not work out of the box with our compilers when I tried it.
I'm working on a proper fix. In the meantime, here's a patch that restores the old and insecure behavior (which allows all processes on your PC with TCP access to execute any program in the chroot with user rights, as the --make-me-a-botnet
option indicates).
Without any patching, distcc will fail and fall back to "native" compilation (that is, running the foreign arch GCC in QEMU). So it is slower, but still working.
--- a/pmb/build/_package.py
+++ b/pmb/build/_package.py
@@ -351,6 +351,7 @@ def run_abuild(args, apkbuild, arch, strict=False, force=False, cross=None,
env["CCACHE_PATH"] = "/usr/lib/arch-bin-masquerade/" + arch + ":/usr/bin"
env["CCACHE_COMPILERCHECK"] = "string:" + get_gcc_version(args, arch)
env["DISTCC_HOSTS"] = "127.0.0.1:" + args.port_distccd
+ env["DISTCC_NO_CROSS_REWRITE"] = "1"
# Build the abuild command
cmd = ["abuild", "-D", "postmarketOS"]
diff --git a/pmb/chroot/distccd.py b/pmb/chroot/distccd.py
index 441841d6..7128ffc9 100644
--- a/pmb/chroot/distccd.py
+++ b/pmb/chroot/distccd.py
@@ -101,7 +101,8 @@ def generate_cmdline(args, arch):
"--jobs", args.jobs,
"--nice", "19",
"--job-lifetime", "60",
- "--daemon"
+ "--daemon",
+ "--make-me-a-botnet"
]
if args.verbose:
ret.append("--verbose")
--
2.18.0
EDIT: env["DISTCC_NO_CROSS_REWRITE"] = "1"
isn't even necessary.