From nobody Thu Jul 27 04:12:02 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RBHQp52ckz4pQ7L; Thu, 27 Jul 2023 04:12:02 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RBHQp36tdz3nY7; Thu, 27 Jul 2023 04:12:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690431122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6cSUNItSn1G2In6QSB8gSZG2yICxx4rLqeelcQEp9ms=; b=QOnbpu7EiOdvx4XuilOZvoRATU9h0ckUm9I/c6Nna7kUjBf/phye4b4nmafdkSekHnocfG Egvgn3rrWF/aqkHgEL6NlPZ3VEKB8/X99+G3eubQEfnFwRjLKc1kWIvwJ2FKPb5ZPETvBa GB3Rdk9Srf0gA/8Lz7UuTFwxOwyhkntjPYl1/px9JZtx5uVyUGB3zrRhwtSWMuOYuNO8Zv IiCeCO2UsD0j97O36XZeLXte2ifO9JkekkzKLofO4Ox+vhaoR55CSKigiuda+v2CWD0GXV Snlpz1wMcSrRXFq3p2plV0aaiBbvl8BIS9Kr6XwMfNYtw+CM3WkBzc4leYMcWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690431122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6cSUNItSn1G2In6QSB8gSZG2yICxx4rLqeelcQEp9ms=; b=n4xOdJvA3lshpCS5m9RmyjYom6VBcMu/qSTvtzSD0qoq3/bMHAoZUinpIVlns3z5hUWJLN OlXJtp81kDGf3bGgkDpPKprJiYCqnDsr4s54wkrfuq8g8+L6dA5gahayT7KgS7rWdzgACT DsG1DlGToMsW9ppi2+lxaes17RcSOEAEX3RveFdKV2Oa8irNMbJG3uWKfU2/QcFzVYD95a pCXm2H3fsA0Qv+9vtGqX8eLtjwTxlioioSC3g/LJzBcoePwuIY6bZ8eG7N87Wyat+Onfmj Up3EfASR6hke33Z980mvMPyo3fiMhZyRDOMVO8tLVD1GV2UrBJu7jQ6Yu7cHjQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690431122; a=rsa-sha256; cv=none; b=DveOFhS3oOT5bC/kurvQ/OqeiAZfFM4sclPZpTZZF07o55KIdux1x3+8Y2/C5IF/fFbelq z7s4A0DuW50/iYkRT9GPeQFAjTTfLZQx7TGC0jD8GIElLLlZq/wovfU8BR6CYlvrngPpf6 RZiIMGmERA652CyC/9XS6iMcfRyukCu3gG3yd/SQCFRc2gvrmbSjvRnw5+cTVTEfDbVuKV VXjZvF9dsJl1SKUtFDyknTkyqyERpNHbzCBA5J/BvjCjJsM6gsOu51Dws6OG6ifgeSTLzt 2KqggW0VG2AtPPAfPvTCVxtAupTKPnjcZ+LmP66WgJTK4ttkJz2M6YijnZOgdg== 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 4RBHQp1xqKz18yJ; Thu, 27 Jul 2023 04:12:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36R4C2sD097665; Thu, 27 Jul 2023 04:12:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36R4C2vh097664; Thu, 27 Jul 2023 04:12:02 GMT (envelope-from git) Date: Thu, 27 Jul 2023 04:12:02 GMT Message-Id: <202307270412.36R4C2vh097664@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 65f28f63a73d - main - tools/build: Create toolchain symlinks for non-absolute compiler/linker List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 65f28f63a73d3371d9d724a2018be6d1ada0d3e0 Auto-Submitted: auto-generated The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=65f28f63a73d3371d9d724a2018be6d1ada0d3e0 commit 65f28f63a73d3371d9d724a2018be6d1ada0d3e0 Author: Jessica Clarke AuthorDate: 2023-07-27 04:10:47 +0000 Commit: Jessica Clarke CommitDate: 2023-07-27 04:10:47 +0000 tools/build: Create toolchain symlinks for non-absolute compiler/linker If any of the toolchain variables are not absolute then we need to create a symlink in WORLDTMP/legacy/bin in order to make them available during a BUILD_WITH_STRICT_TMPPATH build. Reviewed by: brooks, jhb Differential Revision: https://reviews.freebsd.org/D41188 --- Makefile.inc1 | 5 ++--- tools/build/Makefile | 27 ++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 3f0546861bbd..964bdfc08699 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -602,9 +602,8 @@ STRICTTMPPATH= ${XPATH}:${BPATH}:${UNIVERSE_TOOLCHAIN_PATH} # still allow using the old behaviour (inheriting $PATH) if # BUILD_WITH_STRICT_TMPPATH is set to 0 but this will eventually be removed. -# Currently strict $PATH can cause build failures and does not work yet with -# USING_SYSTEM_LINKER/USING_SYSTEM_COMPILER. Once these issues have been -# resolved it will be turned on by default. +# Currently strict $PATH can cause build failures. Once the remaining issues +# have been resolved it will be turned on by default. BUILD_WITH_STRICT_TMPPATH?=0 .if defined(CROSSBUILD_HOST) # When building on non-FreeBSD we can't rely on the tools in /usr/bin being compatible diff --git a/tools/build/Makefile b/tools/build/Makefile index 7d6ed8befb30..46fd5c7d3159 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -312,6 +312,8 @@ _host_tools_to_symlink= basename bzip2 bunzip2 chmod chown cmp comm cp date dd \ _make_abs!= which "${MAKE}" _host_abs_tools_to_symlink= ${_make_abs}:make ${_make_abs}:bmake +_LINK_HOST_TOOL= ln -sfn + .if ${.MAKE.OS} == "FreeBSD" # When building on FreeBSD we always copy the host tools instead of linking # into WORLDTMP to avoid issues with incompatible libraries (see r364030). @@ -322,7 +324,7 @@ _COPY_HOST_TOOL= cp -pf # tools to another directory with cp -p results in freezes on macOS Big Sur for # some unknown reason. It can also break building inside docker containers if # there are ACLs on shared volumes. -_COPY_HOST_TOOL= ln -sfn +_COPY_HOST_TOOL= ${_LINK_HOST_TOOL} .if ${.MAKE.OS} == "Darwin" # /usr/bin/cpp may invoke xcrun: @@ -335,6 +337,20 @@ _host_abs_tools_to_symlink+= /bin/bash:sh _host_tools_to_symlink:= ${_host_tools_to_symlink:Nsh} .endif +# We also need to symlink any non-absolute toolchain commands. Clang finds its +# resource directory relative to itself, so CC/CXX/CPP must be symlinked, and +# we do the same for LD for consistency. There should be no concerns about +# installing over the current system since we don't use the toolchain during +# install. +.for var in CC CXX CPP LD +.for X in $${_empty_var_} X +.if !empty(${X}${var}) && !${${X}${var}:M/*} && \ + !${_toolchain_tools_to_symlink:U:M${${X}${var}}} +_toolchain_tools_to_symlink+= ${${X}${var}} +.endif +.endfor +.endfor + host-symlinks: @echo "Linking host tools into ${DESTDIR}/bin" .for _tool in ${_host_tools_to_symlink} @@ -359,6 +375,15 @@ host-symlinks: rm -f ${DESTDIR}/usr/libexec/flua ${_COPY_HOST_TOOL} /usr/libexec/flua ${DESTDIR}/usr/libexec/flua .endif +.for _tool in ${_toolchain_tools_to_symlink} + @export PATH=$${PATH}:/usr/local/bin; \ + source_path=`which ${_tool} || echo /dev/null/no/such`; \ + if [ ! -e "$${source_path}" ] ; then \ + echo "Cannot find host tool '${_tool}' in PATH ($$PATH)." >&2; false; \ + fi; \ + rm -f "${DESTDIR}/bin/${_tool}"; \ + ${_LINK_HOST_TOOL} "$${source_path}" "${DESTDIR}/bin/${_tool}" +.endfor # Create all the directories that are needed during the legacy, bootstrap-tools # and cross-tools stages. We do this here using mkdir since mtree may not exist