From patchwork Thu May 21 16:53:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1295374 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=jGYL6o2q; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49SbLN3H9dz9sSJ for ; Fri, 22 May 2020 02:54:02 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8182488509; Thu, 21 May 2020 16:53:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EgIRX4tqKyGE; Thu, 21 May 2020 16:53:56 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 2E531884BB; Thu, 21 May 2020 16:53:56 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id D96331BF36D for ; Thu, 21 May 2020 16:53:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id CE22D2042D for ; Thu, 21 May 2020 16:53:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CEpkBDCY4SpK for ; Thu, 21 May 2020 16:53:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by silver.osuosl.org (Postfix) with ESMTPS id B003C20494 for ; Thu, 21 May 2020 16:53:51 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id g14so2609823wme.1 for ; Thu, 21 May 2020 09:53:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IPBUbhzHPdz8keGbFCasCq3GgIFU9a3J+pqua25M98g=; b=jGYL6o2q8aJ6xg9NQMIR0Q+cB5x5bmucSlfWb0JRplco8B2nOljSXuwlTt2wpofGj1 fmi7LYDHWDpfjXazlk+zMMPCI7em/Xr5cLy7Xf7eIoY9PjK/vysog0EkeUzehuxq5BNy JJR9eS7bzRlJTGf/ADZOoVRJNd65qJkm8r2jHb2eIQzkUW8IW2izcqeRPYX+4q2Dh0Bj smk/PlbXL+T5CvYgtY8K02TcPAkiRuubqNUSZ79PBczwhCXa3ln/SeLRjJPHdeyqJGKm +4i/oPx4mESkWr1sbqFFC0FFeRXgdRw4WOdUW4/OmH8zZFdidGtNkZgkqFPTIPwq+29Z oNHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IPBUbhzHPdz8keGbFCasCq3GgIFU9a3J+pqua25M98g=; b=rSYZIeVQjyt0L1lyPmonbKR/A+HtKbKtJAiODN+IQ5kyFSFbgqOLYJqLBVEk9RqeoU k49Kj478gKPcOEj2708zzkpLL+GDUsmsejGXiEyZtIpSPGla+wPYQegesxwx7DKsRNNn cTuMDzowhmGQAQY2t9mAm+zaPWjI1EOOlMtexn8XJcQwz3n2rjdwMS5orJkVBQdMTMto gNT9JM/8vNEp/EDGg3h/5fAljQ57SLbCSFIQI1o3pAONPbsg5rg107+JKEpPeQ09qvMv 6B0mAKjjQJWSUGLstiXWB6xJmzcLzjM6qwhjCr8a9GyFgOMQhfemRpgPERyPrVoOny9Z k4HA== X-Gm-Message-State: AOAM532j636GF2M6O/wfNRW0OFbGn+bM0LtFSZC5hXyKUZmSl6O2SUpd Jz93fxV+j3lAVKuHSZqNLqGNt7h4U9M= X-Google-Smtp-Source: ABdhPJwX/ZFCVmYm+4Nnjbfd8QOBn7XrKAmFJBJ1IDou8DmUVFGdHIgvlzKJagxIblBERnRripO+Xg== X-Received: by 2002:a1c:6686:: with SMTP id a128mr1976225wmc.78.1590080029573; Thu, 21 May 2020 09:53:49 -0700 (PDT) Received: from localhost.localdomain (2a01cb0589880c0046708304bf1f24fd.ipv6.abo.wanadoo.fr. [2a01:cb05:8988:c00:4670:8304:bf1f:24fd]) by smtp.gmail.com with ESMTPSA id i15sm3271189wml.47.2020.05.21.09.53.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:53:48 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Thu, 21 May 2020 18:53:45 +0200 Message-Id: <20200521165345.2866046-1-romain.naour@gmail.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Subject: [Buildroot] [PATCHv3] package/gcc/9.3.0: fix host-gcc-final when ccache is used X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Dakin-Norris , Romain Naour , "Yann E . MORIN" , Thomas Petazzoni , Maxim Kochetkov Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" As reported by several Buildroot users [1][2][3], the gcc build may fail while running selftests makefile target. The problem only occurs when ccache is used with gcc 9 and 10, probably due to a race condition. While debuging with "make -p" we can notice that s-selftest-c target contain only "cc1" as dependency instead of cc1 and SELFTEST_DEPS [4]. s-selftest-c: cc1 While the build is failing, the s-selftest-c dependencies recipe is still running and reported as a bug by make. "Dependencies recipe running (THIS IS A BUG)." A change [5] in gcc 9 seems to introduce the problem since we can't reproduce this problem with gcc 8. As suggested by Yann E. MORIN [6], move SELFTEST_DEPS before including language makefile fragments. With the fix applied, the s-seltest-c dependency contains SELFTEST_DEPS value. s-selftest-c: cc1 xgcc specs stmp-int-hdrs ../../gcc/testsuite/selftests [1] http://lists.busybox.net/pipermail/buildroot/2020-May/282171.html [2] http://lists.busybox.net/pipermail/buildroot/2020-May/282766.html [3] https://github.com/cirosantilli/linux-kernel-module-cheat/issues/108 [4] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/c/Make-lang.in;h=bfae6fd2549c4f728816cd355fa9739dcc08fcde;hb=033eb5671769a4c681a44aad08a454e667e08502#l120 [5] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=033eb5671769a4c681a44aad08a454e667e08502 [6] http://lists.busybox.net/pipermail/buildroot/2020-May/283213.html Signed-off-by: Romain Naour Cc: Ben Dakin-Norris Cc: Maxim Kochetkov Cc: Thomas Petazzoni Cc: Yann E. MORIN --- ...move-SELFTEST_DEPS-before-including-.patch | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 package/gcc/9.3.0/0004-gcc-Makefile.in-move-SELFTEST_DEPS-before-including-.patch diff --git a/package/gcc/9.3.0/0004-gcc-Makefile.in-move-SELFTEST_DEPS-before-including-.patch b/package/gcc/9.3.0/0004-gcc-Makefile.in-move-SELFTEST_DEPS-before-including-.patch new file mode 100644 index 0000000000..227d35a7f0 --- /dev/null +++ b/package/gcc/9.3.0/0004-gcc-Makefile.in-move-SELFTEST_DEPS-before-including-.patch @@ -0,0 +1,81 @@ +From 811c8d628045c3d248144fc560a4bf80209ca16e Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Thu, 21 May 2020 15:58:02 +0200 +Subject: [PATCH] gcc/Makefile.in: move SELFTEST_DEPS before including language + makefile fragments + +As reported by several Buildroot users [1][2][3], the gcc build +may fail while running selftests makefile target. + +The problem only occurs when ccache is used with gcc 9 and 10, +probably due to a race condition. + +While debuging with "make -p" we can notice that s-selftest-c target +contain only "cc1" as dependency instead of cc1 and SELFTEST_DEPS [4]. + + s-selftest-c: cc1 + +While the build is failing, the s-selftest-c dependencies recipe is +still running and reported as a bug by make. + + "Dependencies recipe running (THIS IS A BUG)." + +A change [5] in gcc 9 seems to introduce the problem since we can't +reproduce this problem with gcc 8. + +As suggested by Yann E. MORIN [6], move SELFTEST_DEPS before +including language makefile fragments. + +With the fix applied, the s-seltest-c dependency contains +SELFTEST_DEPS value. + + s-selftest-c: cc1 xgcc specs stmp-int-hdrs ../../gcc/testsuite/selftests + +[1] http://lists.busybox.net/pipermail/buildroot/2020-May/282171.html +[2] http://lists.busybox.net/pipermail/buildroot/2020-May/282766.html +[3] https://github.com/cirosantilli/linux-kernel-module-cheat/issues/108 +[4] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/c/Make-lang.in;h=bfae6fd2549c4f728816cd355fa9739dcc08fcde;hb=033eb5671769a4c681a44aad08a454e667e08502#l120 +[5] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=033eb5671769a4c681a44aad08a454e667e08502 +[6] http://lists.busybox.net/pipermail/buildroot/2020-May/283213.html + +Upstream status: https://gcc.gnu.org/pipermail/gcc-patches/2020-May/546248.html + +Signed-off-by: Romain Naour +Cc: Ben Dakin-Norris +Cc: Maxim Kochetkov +Cc: Thomas Petazzoni +Cc: Yann E. MORIN +Cc: Cc: David Malcolm +--- +This patch should be backported to gcc 10 and gcc 9. +--- + gcc/Makefile.in | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/gcc/Makefile.in b/gcc/Makefile.in +index abae872cd63..e2ef3c46afc 100644 +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -1686,6 +1686,10 @@ $(FULL_DRIVER_NAME): ./xgcc + rm -f $@ + $(LN_S) $< $@ + ++# SELFTEST_DEPS need to be set before including language makefile fragments. ++# Otherwise $(SELFTEST_DEPS) is empty when used from various /Make-lang.in. ++SELFTEST_DEPS = $(GCC_PASSES) stmp-int-hdrs $(srcdir)/testsuite/selftests ++ + # + # Language makefile fragments. + +@@ -1950,8 +1954,6 @@ DEVNULL=$(if $(findstring mingw,$(build)),nul,/dev/null) + SELFTEST_FLAGS = -nostdinc $(DEVNULL) -S -o $(DEVNULL) \ + -fself-test=$(srcdir)/testsuite/selftests + +-SELFTEST_DEPS = $(GCC_PASSES) stmp-int-hdrs $(srcdir)/testsuite/selftests +- + # Run the selftests during the build once we have a driver and the frontend, + # so that self-test failures are caught as early as possible. + # Use "s-selftest-FE" to ensure that we only run the selftests if the +-- +2.25.4 +