From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 57815158009 for ; Fri, 23 Jun 2023 13:57:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 84E28E0845; Fri, 23 Jun 2023 13:57:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6CBD0E0845 for ; Fri, 23 Jun 2023 13:57:19 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 95E4833BE2E for ; Fri, 23 Jun 2023 13:57:18 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8A420A66 for ; Fri, 23 Jun 2023 13:57:16 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1687528472.ae09a2683a18f7148048d0b037ec80227e1571ce.grobian@gentoo> Subject: [gentoo-commits] repo/proj/prefix:master commit in: scripts/ X-VCS-Repository: repo/proj/prefix X-VCS-Files: scripts/bootstrap-prefix.sh X-VCS-Directories: scripts/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: ae09a2683a18f7148048d0b037ec80227e1571ce X-VCS-Branch: master Date: Fri, 23 Jun 2023 13:57:16 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 08e497dd-9b53-4308-8af2-a6310a2497be X-Archives-Hash: 41556228af2b625c0a4576473022e5e7 commit: ae09a2683a18f7148048d0b037ec80227e1571ce Author: Fabian Groffen gentoo org> AuthorDate: Fri Jun 23 13:54:32 2023 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Fri Jun 23 13:54:32 2023 +0000 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ae09a268 scripts/bootstrap-prefix: provide safe compiler wrappers in stage1 On systems like Ubuntu installing gcc doesn't mean installing g++, so when PATH isn't set to just host (original) before looking up g++, it ends up on the wrapper being created, causing an endless loop at runtime. Thus, check if gcc/g++ can be found in host PATH, if not, error out suggesting to install or make them available. Signed-off-by: Fabian Groffen gentoo.org> scripts/bootstrap-prefix.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index c50340fb91..d722e0139f 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -1490,15 +1490,27 @@ bootstrap_stage1() { # If the version of our binutils an older one, they may not # provide what the system gcc is configured to use. # We need to direct the system gcc to find the system binutils. + EXEC="$(PATH="${ORIGINAL_PATH}" type -P gcc)" + if [[ -z ${EXEC} ]] ; then + eerror "could not find 'gcc' in your PATH!" + eerror "please install gcc or provide access via PATH or symlink" + return 1 + fi cat >> "${ROOT}"/tmp/usr/local/bin/gcc <<-EOF #! /bin/sh PATH="${ORIGINAL_PATH}" export PATH - exec "$(type -P gcc)" "\$@" + exec "${EXEC}" "\$@" EOF + EXEC="$(PATH="${ORIGINAL_PATH}" type -P g++)" + if [[ -z ${EXEC} ]] ; then + eerror "could not find 'g++' in your PATH!" + eerror "please install g++ or provide access via PATH or symlink" + return 1 + fi cat >> "${ROOT}"/tmp/usr/local/bin/g++ <<-EOF #! /bin/sh PATH="${ORIGINAL_PATH}" export PATH - exec "$(type -P g++)" "\$@" + exec "${EXEC}" "\$@" EOF chmod 755 "${ROOT}"/tmp/usr/local/bin/g{cc,++} fi