From owner-dev-commits-src-all@freebsd.org Thu Jan 7 11:05:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DE5C4CCC3E; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DBNh339wcz4tcX; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B98C7EDD; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107B5t0Q011238; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107B5tp1011237; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git) Date: Thu, 7 Jan 2021 11:05:55 GMT Message-Id: <202101071105.107B5tp1011237@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: d037edf82071 - main - tools/build/make.py: Fix macOS build after a920b9817 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d037edf82071d8efb5a58d8d1a923cdfea2e0a7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 11:05:55 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=d037edf82071d8efb5a58d8d1a923cdfea2e0a7c commit d037edf82071d8efb5a58d8d1a923cdfea2e0a7c Author: Alex Richardson AuthorDate: 2020-12-22 16:14:32 +0000 Commit: Alex Richardson 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