diff options
author | Alexey Sheplyakov <asheplyakov@altlinux.org> | 2021-02-24 15:36:09 +0400 |
---|---|---|
committer | Alexey Sheplyakov <asheplyakov@altlinux.org> | 2021-02-24 16:12:43 +0400 |
commit | 7f0d80dfe16577f55822ba86a1539e53f9d54417 (patch) | |
tree | 32c83cc6a4c58883e5eb97d6945639b7fb19d9fb /src/compile.c | |
parent | 033630dfe00951d9511c8c2a3dc17f3c9328cf58 (diff) | |
download | distcc-git-7f0d80dfe16577f55822ba86a1539e53f9d54417.tar.gz |
Improved cross-compilation with clang
With this patch I can cross-compile Linux kernel with clang and distcc.
Otherwise both remote compilation and local fallback fail like this:
cat > foo.c <<-EOF
int main(int argc, char **argv) { return 0; }
EOF
env DISTCC_HOSTS=127.0.0.1 distcc clang -c --target=aarch64-linux-gnu- -o foo.o foo.c
error: unknown target triple 'unknown', please use -triple or -arch
distcc[304773] ERROR: compile foo.c on 127.0.0.1 failed
distcc[304773] (dcc_build_somewhere) Warning: remote compilation of 'foo.c' failed, retrying locally
distcc[304773] Warning: failed to distribute foo.c to 127.0.0.1, running locally instead
error: unknown target triple 'unknown', please use -triple or -arch
distcc[304773] ERROR: compile foo.c on localhost failed
Linux' kernel makefiles specify the target arch with `--target=foo`,
and distcc expects `-target foo`, hence the problem.
Closes: #416
Diffstat (limited to 'src/compile.c')
-rw-r--r-- | src/compile.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/compile.c b/src/compile.c index 3496456..f66ad68 100644 --- a/src/compile.c +++ b/src/compile.c @@ -557,9 +557,14 @@ static void dcc_add_clang_target(char **argv) else return; + /* -target aarch64-linux-gnu */ if (dcc_argv_search(argv, "-target")) return; + /* --target=aarch64-linux-gnu */ + if (dcc_argv_startswith(argv, "--target")) + return; + rs_log_info("Adding '-target %s' to support clang cross-compilation.", target); dcc_argv_append(argv, strdup("-target")); |