Date: Thu, 7 Jan 2021 11:05:55 GMT From: Alex Richardson <arichardson@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: d037edf82071 - main - tools/build/make.py: Fix macOS build after a920b9817 Message-ID: <202101071105.107B5tp1011237@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=d037edf82071d8efb5a58d8d1a923cdfea2e0a7c commit d037edf82071d8efb5a58d8d1a923cdfea2e0a7c Author: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> AuthorDate: 2020-12-22 16:14:32 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> CommitDate: 2021-01-07 10:55:21 +0000 tools/build/make.py: Fix macOS build after a920b9817 If we set STRIPBIN, we also have to set XSTRIPBIN since we otherwise use the host /usr/bin/strip during buildworld. However, this does not work on macOS since /usr/bin/strip doesn't handle ELF binaries. --- tools/build/make.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/tools/build/make.py b/tools/build/make.py index d06686f8be63..146d4a7b6d47 100755 --- a/tools/build/make.py +++ b/tools/build/make.py @@ -207,8 +207,8 @@ if __name__ == "__main__": parsed_args.host_bindir) # Using the default value for LD is fine (but not for XLD!) - use_cross_gcc = parsed_args.cross_compiler_type == "gcc" # On non-FreeBSD we need to explicitly pass XCC/XLD/X_COMPILER_TYPE + use_cross_gcc = parsed_args.cross_compiler_type == "gcc" check_required_make_env_var("XCC", "gcc" if use_cross_gcc else "clang", parsed_args.cross_bindir) check_required_make_env_var("XCXX", @@ -219,9 +219,26 @@ if __name__ == "__main__": parsed_args.cross_bindir) check_required_make_env_var("XLD", "ld" if use_cross_gcc else "ld.lld", parsed_args.cross_bindir) - check_required_make_env_var("STRIPBIN", - "strip" if use_cross_gcc else "llvm-strip", - parsed_args.cross_bindir) + + # We also need to set STRIPBIN if there is no working strip binary + # in $PATH. + if not shutil.which("strip"): + if sys.platform.startswith("darwin"): + # On macOS systems we have to use /usr/bin/strip. + sys.exit("Cannot find required tool 'strip'. Please install the" + " host compiler and command line tools.") + if parsed_args.host_compiler_type == "clang": + strip_binary = "llvm-strip" + else: + strip_binary = "strip" + check_required_make_env_var("STRIPBIN", strip_binary, + parsed_args.cross_bindir) + if os.getenv("STRIPBIN") or "STRIPBIN" in new_env_vars: + # If we are setting STRIPBIN, we have to set XSTRIPBIN to the + # default if it is not set otherwise already. + if not os.getenv("XSTRIPBIN") and not is_make_var_set("XSTRIPBIN"): + # Use the bootstrapped elftoolchain strip: + new_env_vars["XSTRIPBIN"] = "strip" bmake_binary = bootstrap_bmake(source_root, objdir_prefix) # at -j1 cleandir+obj is unbearably slow. AUTO_OBJ helps a lot
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101071105.107B5tp1011237>