From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 03 08:32:44 2017 Received: (at submit) by debbugs.gnu.org; 3 Sep 2017 12:32:44 +0000 Received: from localhost ([127.0.0.1]:44958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1doU4x-00008Q-R4 for submit@debbugs.gnu.org; Sun, 03 Sep 2017 08:32:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49171) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1doU4w-00008E-Pf for submit@debbugs.gnu.org; Sun, 03 Sep 2017 08:32:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1doU4m-0004SR-TC for submit@debbugs.gnu.org; Sun, 03 Sep 2017 08:32:37 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:57248) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1doU4m-0004SK-Q3 for submit@debbugs.gnu.org; Sun, 03 Sep 2017 08:32:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1doU4i-0005kF-2W for guix-patches@gnu.org; Sun, 03 Sep 2017 08:32:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1doU4d-0004QA-IF for guix-patches@gnu.org; Sun, 03 Sep 2017 08:32:28 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47362) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1doU4X-0004P8-9S; Sun, 03 Sep 2017 08:32:17 -0400 Received: from [2a01:e0a:1d:7270:6a6c:dc17:fc02:cfda] (port=44148 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1doU4W-0001Oa-OF; Sun, 03 Sep 2017 08:32:17 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH 0/1] core-updates: Add "static" output to glibc Date: Sun, 3 Sep 2017 14:32:03 +0200 Message-Id: <20170903123203.14255-1-ludo@gnu.org> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Hello Guix! This patch for ‘core-updates’ adds a “static” output to glibc, which shaves 9 MiB out of it. “glibc:static” is always part of the implicit inputs of ‘gnu-build-system’ though, such that building a statically-linked package does not require any modification. I’d like to apply it shortly if there are no issues. Thanks, Ludo’. Ludovic Courtès (1): gnu: glibc: Add "static" output. gnu/packages/base.scm | 49 +++++++++++++++++++++++++++++++++++++++++-- gnu/packages/commencement.scm | 22 +++++++++++++++---- gnu/packages/cross-base.scm | 1 + 3 files changed, 66 insertions(+), 6 deletions(-) -- 2.14.1 From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 03 08:34:01 2017 Received: (at 28336) by debbugs.gnu.org; 3 Sep 2017 12:34:01 +0000 Received: from localhost ([127.0.0.1]:44963 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1doU6D-0000Ac-78 for submit@debbugs.gnu.org; Sun, 03 Sep 2017 08:34:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49625) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1doU6B-0000AO-UQ for 28336@debbugs.gnu.org; Sun, 03 Sep 2017 08:34:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1doU61-000552-VZ for 28336@debbugs.gnu.org; Sun, 03 Sep 2017 08:33:54 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1doU5v-0004zv-IT; Sun, 03 Sep 2017 08:33:43 -0400 Received: from [2a01:e0a:1d:7270:6a6c:dc17:fc02:cfda] (port=44158 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1doU5v-0006qG-1F; Sun, 03 Sep 2017 08:33:43 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 28336@debbugs.gnu.org Subject: [PATCH 1/1] gnu: glibc: Add "static" output. Date: Sun, 3 Sep 2017 14:33:36 +0200 Message-Id: <20170903123336.14357-1-ludo@gnu.org> X-Mailer: git-send-email 2.14.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 28336 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) This shrinks glibc:out from 37 MiB to 29 MiB. * gnu/packages/base.scm (glibc/linux)[outputs]: Add "static". [arguments]: Add #:modules. Add 'move-static-libs' phase. * gnu/packages/commencement.scm (static-bash-for-glibc): Augment #:configure-flags to pass "-L LIBC:STATIC". Add the "static" output of GLIBC-FINAL to 'inputs'. (%boot2-inputs, %final-inputs): Likewise. (canonical-package): Adjust to deal with multiple-output packages. * gnu/packages/cross-base.scm (cross-gcc): Add the "static" output of LIBC to 'native-inputs'. --- gnu/packages/base.scm | 49 +++++++++++++++++++++++++++++++++++++++++-- gnu/packages/commencement.scm | 22 +++++++++++++++---- gnu/packages/cross-base.scm | 1 + 3 files changed, 66 insertions(+), 6 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 532bb3e95..ef81f2069 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -542,7 +542,8 @@ store.") ;; users should automatically pull Linux headers as well. (propagated-inputs `(("kernel-headers" ,linux-libre-headers))) - (outputs '("out" "debug")) + (outputs '("out" "debug" + "static")) ;9 MiB of .a files (arguments `(#:out-of-source? #t @@ -553,6 +554,11 @@ store.") ;; RUNPATH checks. #:validate-runpath? #f + #:modules ((ice-9 ftw) + (srfi srfi-26) + (guix build utils) + (guix build gnu-build-system)) + #:configure-flags (list "--enable-add-ons" "--sysconfdir=/etc" @@ -657,7 +663,46 @@ store.") ;; "bilingual" eval/exec magic at the top of the file. "") (("exec @PERL@") - "exec perl")))))))) + "exec perl"))))) + + (add-after 'install 'move-static-libs + (lambda* (#:key outputs #:allow-other-keys) + ;; Move static libraries to the "static" output. + (define (static-library? file) + ;; Return true if FILE is a static library. The + ;; "_nonshared.a" files are referred to by libc.so, + ;; libpthread.so, etc., which are in fact linker + ;; scripts. + (and (string-suffix? ".a" file) + (not (string-contains file "_nonshared")))) + + (define (linker-script? file) + ;; Guess whether FILE, a ".a" file, is actually a + ;; linker script. + (and (not (ar-file? file)) + (not (elf-file? file)))) + + (let* ((out (assoc-ref outputs "out")) + (lib (string-append out "/lib")) + (files (scandir lib static-library?)) + (static (assoc-ref outputs "static")) + (slib (string-append static "/lib"))) + (mkdir-p slib) + (for-each (lambda (base) + (rename-file (string-append lib "/" base) + (string-append slib "/" base))) + files) + + ;; Usually libm.a is a linker script so we need to + ;; change the file names in there to refer to STATIC + ;; instead of OUT. + (for-each (lambda (ld-script) + (substitute* ld-script + ((out) static))) + (filter linker-script? + (map (cut string-append slib "/" <>) + files))) + #t)))))) (inputs `(("static-bash" ,static-bash))) diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 2b67881ed..318a2795b 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -583,12 +583,24 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (let* ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0 glibc-final-with-bootstrap-bash (car (assoc-ref %boot1-inputs "bash")))) - (bash (package (inherit static-bash) + (bash (package + (inherit static-bash) (arguments - `(#:guile ,%bootstrap-guile - ,@(package-arguments static-bash))))) + (substitute-keyword-arguments + (package-arguments static-bash) + ((#:guile _ #f) + '%bootstrap-guile) + ((#:configure-flags flags '()) + ;; Add a '-L' flag so that the pseudo-cross-ld of + ;; BINUTILS-BOOT0 can find libc.a. + `(append ,flags + (list (string-append "LDFLAGS=-static -L" + (assoc-ref %build-inputs + "libc:static") + "/lib")))))))) (inputs `(("gcc" ,gcc) ("libc" ,glibc-final-with-bootstrap-bash) + ("libc:static" ,glibc-final-with-bootstrap-bash "static") ,@(fold alist-delete %boot1-inputs '("gcc" "libc"))))) (package-with-bootstrap-guile @@ -663,6 +675,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (define %boot2-inputs ;; 3rd stage inputs. `(("libc" ,glibc-final) + ("libc:static" ,glibc-final "static") ("gcc" ,gcc-boot0-wrapped) ,@(fold alist-delete %boot1-inputs '("libc" "gcc")))) @@ -923,12 +936,13 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" ("binutils" ,binutils-final) ("gcc" ,gcc-final) ("libc" ,glibc-final) + ("libc:static" ,glibc-final "static") ("locales" ,glibc-utf8-locales-final)))) (define-public canonical-package (let ((name->package (fold (lambda (input result) (match input - ((_ package) + ((_ package . outputs) (vhash-cons (package-full-name package) package result)))) vlist-null diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index abc3a2821..369083eab 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -248,6 +248,7 @@ target that libc." ,@inputs))) (libc `(("libc" ,libc) + ("libc:static" ,libc "static") ("xkernel-headers" ;the target headers ,@(assoc-ref (package-propagated-inputs libc) "kernel-headers")) -- 2.14.1 From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 05 04:19:56 2017 Received: (at 28336-done) by debbugs.gnu.org; 5 Sep 2017 08:19:56 +0000 Received: from localhost ([127.0.0.1]:50193 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dp95Q-000600-2b for submit@debbugs.gnu.org; Tue, 05 Sep 2017 04:19:56 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49374) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dp95O-0005zn-Le for 28336-done@debbugs.gnu.org; Tue, 05 Sep 2017 04:19:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dp95F-0000UX-0M for 28336-done@debbugs.gnu.org; Tue, 05 Sep 2017 04:19:49 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54972) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dp95E-0000UT-TH for 28336-done@debbugs.gnu.org; Tue, 05 Sep 2017 04:19:44 -0400 Received: from [193.50.110.184] (port=38936 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dp95E-0005Ij-Bp for 28336-done@debbugs.gnu.org; Tue, 05 Sep 2017 04:19:44 -0400 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: 28336-done@debbugs.gnu.org Subject: Re: [bug#28336] [PATCH 0/1] core-updates: Add "static" output to glibc References: <20170903123203.14255-1-ludo@gnu.org> Date: Tue, 05 Sep 2017 10:19:42 +0200 In-Reply-To: <20170903123203.14255-1-ludo@gnu.org> ("Ludovic \=\?utf-8\?Q\?Cou\?\= \=\?utf-8\?Q\?rt\=C3\=A8s\=22's\?\= message of "Sun, 3 Sep 2017 14:32:03 +0200") Message-ID: <87mv69v9pd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 28336-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Ludovic Court=C3=A8s skribis: > This patch for =E2=80=98core-updates=E2=80=99 adds a =E2=80=9Cstatic=E2= =80=9D output to glibc, which > shaves 9=C2=A0MiB out of it. > > =E2=80=9Cglibc:static=E2=80=9D is always part of the implicit inputs of > =E2=80=98gnu-build-system=E2=80=99 though, such that building a staticall= y-linked > package does not require any modification. > > I=E2=80=99d like to apply it shortly if there are no issues. Pushed as 6dff905e51202bbdebbad8811b6509584d12a796. Ludo=E2=80=99. From unknown Sat Jun 21 03:22:32 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 03 Oct 2017 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator