From patchwork Thu Dec 7 22:54:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 57368 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5DF0A27BBEC; Thu, 7 Dec 2023 22:56:33 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 04BC627BBE2 for ; Thu, 7 Dec 2023 22:56:30 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rBNHj-0000Zh-3J; Thu, 07 Dec 2023 17:55:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBNHe-0000Rn-G1 for guix-patches@gnu.org; Thu, 07 Dec 2023 17:55:54 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rBNHc-0002gt-Oq for guix-patches@gnu.org; Thu, 07 Dec 2023 17:55:53 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rBNHp-0006tZ-AU for guix-patches@gnu.org; Thu, 07 Dec 2023 17:56:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67686] [PATCH core-updates v2 7/7] gnu: glibc: Improve handling of empty .a files. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 07 Dec 2023 22:56:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67686 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67686@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 67686-submit@debbugs.gnu.org id=B67686.170198971626349 (code B ref 67686); Thu, 07 Dec 2023 22:56:05 +0000 Received: (at 67686) by debbugs.gnu.org; 7 Dec 2023 22:55:16 +0000 Received: from localhost ([127.0.0.1]:43355 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBNH1-0006qr-UF for submit@debbugs.gnu.org; Thu, 07 Dec 2023 17:55:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56962) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBNGx-0006pB-IZ for 67686@debbugs.gnu.org; Thu, 07 Dec 2023 17:55:11 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBNGf-0002KA-MX; Thu, 07 Dec 2023 17:54:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=I4VvSDLlifodOFRQLF6uT8NNYME3xKVmABE/CmmAdC4=; b=g9q6jtkr9nOGFpE23xN7 tCysFavP39lnsL4YgevsPA6Rr/eCZCUVjlfb/RMZ7SXZuMRIYozT/DASIOs+RfEOO6QTF9EtbMcLS x8N55vglezN1YPxbIvGR42xll7Bah3IQyD6dcP9JpEc46Ofr3MUOW8fPmnYuF4yqI/RzSOghG61iJ zsZIjoQBqEm1sX+r2SS7j9eQP24HYnk3jF6qJumpuWDuljqGmP1LWamE76wQ04zp4VbEPnTMbMqoF cd4e+JBgvAoYxOIWZOCTXFaAGl+Igc2xp/68j1eaqb0mxooS9QF14AmoqH3vo+yfpuABcPAwScz2S lrQ4F/Qs5QOQzQ==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 7 Dec 2023 23:54:10 +0100 Message-ID: <937aa63bbbbe688c12b9622150140f7739a63618.1701989279.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches This partially reverts 3b2de6529b9d77c8a74d431859a3ec334e9603c2, itself a followup to 25b30622b4a77cd4b2965b9d62fa310a22413d54. * gnu/packages/base.scm (glibc)[arguments]: In ‘move-static-libs’ phase, remove ‘empty-static-libraries’ variable and rewrite ‘empty-static-library?’ to check file type and size. * gnu/packages/commencement.scm (make-gcc-toolchain): Remove ‘copy-file’ call to create ‘librt.a’. Change-Id: I33c6825d5b1e6e790dfff494bac1da07d3389e77 --- gnu/packages/base.scm | 18 ++++++------------ gnu/packages/commencement.scm | 10 +--------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 1144110309..311d598c8e 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -968,19 +968,13 @@ (define-public glibc ;; and as such, it is useful to have these ".a" files in ;; OUT in addition to STATIC. - ;; XXX: It might be better to determine whether a static - ;; library is empty by some criterion (such as their file - ;; size equaling eight bytes) rather than hardcoding them - ;; by name. - - ;; XXX: We forgot librt.a for the current version! In - ;; the meantime, gcc-toolchain provides it, but remove - ;; that fix once librt.a is added here. - (define empty-static-libraries - '("libpthread.a" "libdl.a" "libutil.a" "libanl.a")) (define (empty-static-library? file) - (any (lambda (s) - (string=? file s)) empty-static-libraries)) + ;; Return true if FILE is an 'ar' archive with nothing + ;; beyond the header. + (let ((file (string-append (assoc-ref outputs "out") + "/lib/" file))) + (and (ar-file? file) + (= (stat:size (stat file)) 8)))) (define (static-library? file) ;; Return true if FILE is a static library. The diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 4ccbbb0881..6c0f295f30 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -3569,15 +3569,7 @@ (define* (make-gcc-toolchain gcc "libc-debug"))) (union-build (assoc-ref %outputs "static") (list (assoc-ref %build-inputs - "libc-static"))) - ;; XXX Remove once an empty librt.a is added to - ;; libc:out. - (copy-file - (string-append (assoc-ref %outputs "out") - "/lib/libpthread.a") - (string-append (assoc-ref %outputs "out") - "/lib/librt.a")) - #t)))) + "libc-static"))))))) (native-search-paths (append (package-native-search-paths gcc)