GNU bug report logs - #50174
[PATCH core-updates-frozen 1/2] gnu: make-bootstrap: Fix build of static gawk.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Thiago Jung Bauermann <bauermann@HIDDEN>; Keywords: patch; dated Mon, 23 Aug 2021 20:53:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Added indication that bug 50174 blocks50358 Request was from Thiago Jung Bauermann <bauermann@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 50174 <at> debbugs.gnu.org:


Received: (at 50174) by debbugs.gnu.org; 23 Aug 2021 21:02:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 23 17:02:06 2021
Received: from localhost ([127.0.0.1]:42705 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mIH54-0000hK-Bl
	for submit <at> debbugs.gnu.org; Mon, 23 Aug 2021 17:02:06 -0400
Received: from mx.kolabnow.com ([95.128.36.41]:26514)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bauermann@HIDDEN>) id 1mIH52-0000gp-8x
 for 50174 <at> debbugs.gnu.org; Mon, 23 Aug 2021 17:02:05 -0400
Received: from localhost (unknown [127.0.0.1])
 by ext-mx-out001.mykolab.com (Postfix) with ESMTP id BE1F2B53
 for <50174 <at> debbugs.gnu.org>; Mon, 23 Aug 2021 23:01:55 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h=
 content-transfer-encoding:content-type:content-type:mime-version
 :message-id:date:date:subject:subject:from:from:received
 :received:received; s=dkim20160331; t=1629752515; x=1631566916;
 bh=FkmpiQnyhfi9l7dIWympg0FEP1XND2zpPWlrmq3pKs0=; b=PKo7Ojft8cb4
 orvjU6+OXlag+AS9hz2MIRnJ/d58jZIhIH3qS0wvdZnaXwLrVBTvjF0IwL8UVVC0
 SAENBwRc3Zyq/Zi7NXVWmrigW2Ij/xTYk5+X5oNVA3yHS/XZYkI6g8bFGIIUCfWm
 LttX8yK2Ch+eyRiUlTrPt6XIu2EZhc6u921Yr6EWYmLsYo/RgOmp9qrS9xx5NNiU
 eKY/hU72q44V0wjrZi6yycdmvUVVeij2pCIOlUH/KNbIsKdIEPL6SeoMZDIfLObG
 DWbDnEYaLYUmcovlPRApYNc1kAC6y1cUbWeMSImp2ICtbbdddYc/FHKfckJBB8PF
 wL7s+93dg4rpjTDp6Z58gktZSocqhmxCDQfHj+ihvFea1VknMRt7lH99EbrmQ+th
 +FqhLc942eV5wn4ntvfmtrz6Ku3Y/rGzjfkLWn62faIQMlu5lOAQ2GIOSeG/1KnO
 Tfcy6VFbQcDikLM60LPRjT9/6BMmopCIbZz69JGlu8SjKCA/ilIY67InItPJ+tTb
 i3Q/WMRl2ZwFzDUU28AVHySoW7xz3nWcfX31bYIJRZfnXEwj+R1ZnC8ZnWaZSSIq
 +fsYDtNL8VIje5jfw1VchGrkr6JcuRs7V5qwIe0cur7uD1ofhhnkVK2l3cKbtQ5p
 MLGwRP2ATvLhLPFl8IKklJcXBv4Ij4Q=
X-Virus-Scanned: amavisd-new at mykolab.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 tagged_above=-10 required=5
 tests=[BAYES_00=-1.9] autolearn=ham autolearn_force=no
Received: from mx.kolabnow.com ([127.0.0.1])
 by localhost (ext-mx-out001.mykolab.com [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id Ii--DHBlx50Z for <50174 <at> debbugs.gnu.org>;
 Mon, 23 Aug 2021 23:01:55 +0200 (CEST)
Received: from int-mx001.mykolab.com (unknown [10.9.13.1])
 by ext-mx-out001.mykolab.com (Postfix) with ESMTPS id 7DAD4279
 for <50174 <at> debbugs.gnu.org>; Mon, 23 Aug 2021 23:01:52 +0200 (CEST)
Received: from ext-subm001.mykolab.com (unknown [10.9.6.1])
 by int-mx001.mykolab.com (Postfix) with ESMTPS id A32E98D7;
 Mon, 23 Aug 2021 23:01:49 +0200 (CEST)
From: Thiago Jung Bauermann <bauermann@HIDDEN>
To: 50174 <at> debbugs.gnu.org
Subject: [PATCH core-updates-frozen 2/2] gnu: make-bootstrap: Enable tests in
 static gawk build.
Date: Mon, 23 Aug 2021 18:01:35 -0300
Message-Id: <20210823210135.27392-1-bauermann@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 50174
Cc: Thiago Jung Bauermann <bauermann@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

The tests were disabled because gawk’s extension mechanism doesn’t work
when it’s built statically, and some tests fail because of that.

Another alternative is to disable the extension mechanism during
configuration time, which causes the testsuite to pass again.

* gnu/packages/make-bootstrap.scm (%static-inputs)[gawk]<#:tests?>: Remove.
<#:configure-flags>: Add.
---
 gnu/packages/make-bootstrap.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index 79eb9d60026f..2b4739b90eba 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -214,7 +214,9 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                    ;; plug-in mechanism just fail on static builds:
                    ;;
                    ;; ./fts.awk:1: error: can't open shared library `filefuncs' for reading (No such file or directory)
-                   #:tests? #f
+                   ;;
+                   ;; Therefore disable extensions support.
+                   #:configure-flags (list "--disable-extensions")
 
                    ,@(substitute-keyword-arguments (package-arguments gawk)
                        ((#:phases phases)




Information forwarded to guix-patches@HIDDEN:
bug#50174; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Aug 2021 20:52:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 23 16:52:10 2021
Received: from localhost ([127.0.0.1]:42688 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mIGvR-0000Qz-CS
	for submit <at> debbugs.gnu.org; Mon, 23 Aug 2021 16:52:10 -0400
Received: from lists.gnu.org ([209.51.188.17]:35540)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bauermann@HIDDEN>) id 1mIGvM-0000Qm-0Y
 for submit <at> debbugs.gnu.org; Mon, 23 Aug 2021 16:52:08 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:48460)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bauermann@HIDDEN>)
 id 1mIGvK-0007Mm-4Q
 for guix-patches@HIDDEN; Mon, 23 Aug 2021 16:52:03 -0400
Received: from mx.kolabnow.com ([95.128.36.42]:63078)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bauermann@HIDDEN>)
 id 1mIGvE-0000KC-3X
 for guix-patches@HIDDEN; Mon, 23 Aug 2021 16:52:00 -0400
Received: from localhost (unknown [127.0.0.1])
 by ext-mx-out001.mykolab.com (Postfix) with ESMTP id 3D9B0679
 for <guix-patches@HIDDEN>; Mon, 23 Aug 2021 22:51:53 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h=
 content-transfer-encoding:content-type:content-type:mime-version
 :message-id:date:date:subject:subject:from:from:received
 :received:received; s=dkim20160331; t=1629751908; x=1631566309;
 bh=kPxGyJproYxkbVySbjQueetwDLNDFK0K3i9tyvh0vQ4=; b=T5k3j+f+Wxsv
 nebyya6kfkVlWWtVZxB0z+6CLE0Mb3au94xFWog7NnqRRXSQGXwyUOclqYzLSOKE
 CXZR0NWG8j9O30nxrhG6cCs6j+cZYRGzy1Xvw0XOh+dsyVi5ASAsu2S4sPQHwDtE
 /5K2KFS5fTlG6k0+5l/Hp3Quy8P+WcviJphauSLUE+FBfeh5W40zguajarnJdaiu
 pd/3M74qFFlP6Ohp5n0rm+yZNBrhgMdyiB6KOenEeqFoom66BtpBSgUab681iuMe
 pJsFwt2bETNF3cecswhhd038nfrz7fabqG6Kr+ycmM12d6Yu3qfICrM+X4oAYA4L
 eJbWnTFVbLFIy20SBfBZW+LMZyqGpB7GOrRqd5enpdeIch095n1ptuawMyeB0qwJ
 ueihtzGuSAlqI2mwXZoZ3PvzzU62kRMw/7sxanzGZV9cqyYF8SiHMK1aydMAxzID
 AQTT5W22jDUKq7TqjS3BtgSeeNetkYSHj97jxB48xYzgDhU0xDB+Kp3Vu+8h/5Mp
 6ZL3/ERcjSxRiLQAtCFrhRrV9pdiGm5h3EbwjdGvCtyre0NE4J6lacjzn+npZs97
 oXDTuj9dGMgbnsdWQ68XFXMS5cIYn9vbB8JNI5ndAOd4WZwxI2v0t+X1whamVcfg
 nivbuL21Meod8I+uvBrSIK5Tx3Rv7AQ=
X-Virus-Scanned: amavisd-new at mykolab.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 tagged_above=-10 required=5
 tests=[BAYES_00=-1.9] autolearn=ham autolearn_force=no
Received: from mx.kolabnow.com ([127.0.0.1])
 by localhost (ext-mx-out001.mykolab.com [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id srBTMHvZ0QTf for <guix-patches@HIDDEN>;
 Mon, 23 Aug 2021 22:51:48 +0200 (CEST)
Received: from int-mx001.mykolab.com (unknown [10.9.13.1])
 by ext-mx-out001.mykolab.com (Postfix) with ESMTPS id 29B08279
 for <guix-patches@HIDDEN>; Mon, 23 Aug 2021 22:51:47 +0200 (CEST)
Received: from ext-subm003.mykolab.com (unknown [10.9.6.3])
 by int-mx001.mykolab.com (Postfix) with ESMTPS id 196518A8;
 Mon, 23 Aug 2021 22:51:46 +0200 (CEST)
From: Thiago Jung Bauermann <bauermann@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH core-updates-frozen 1/2] gnu: make-bootstrap: Fix build of
 static gawk.
Date: Mon, 23 Aug 2021 17:51:27 -0300
Message-Id: <20210823205127.27102-1-bauermann@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=95.128.36.42; envelope-from=bauermann@HIDDEN;
 helo=mx.kolabnow.com
X-Spam_score_int: -1
X-Spam_score: -0.2
X-Spam_bar: /
X-Spam_report: (-0.2 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
 DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
Cc: Thiago Jung Bauermann <bauermann@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

* gnu/packages/make-bootstrap.scm (%static-inputs)[finalize-with-ld-flags]:
New function.
[map]<match-lambda>: Add new clause to match three elements.
[map]<gawk>: Add linker option.
* guix/build-system/gnu.scm (static-package): Add ‘#:ld-flags’ keyword
argument.
---

Hello,

gawk for ‘static-binaries-tarball’ is failing to build natively, at least for
x86_64-linux¹ and powerpc64le-linux. On both of them, the problem is the same:

--8<---------------cut here---------------start------------->8---
ld: ext.o: in function `load_ext':
/tmp/guix-build-gawk-5.1.0.drv-0/gawk-5.1.0/ext.c:59: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
ld: /gnu/store/qmgsfxm3ad5n7bi947n7xw0wq86blqr9-glibc-2.33-static/lib/libc.a(getopt.o): in function `_getopt_internal_r':
(.text+0x6e0): multiple definition of `_getopt_internal_r'; support/libsupport.a(getopt.o):/tmp/guix-build-gawk-5.1.0.drv-0/gawk-5.1.0/support/getopt.c:404: first defined here
ld: /gnu/store/qmgsfxm3ad5n7bi947n7xw0wq86blqr9-glibc-2.33-static/lib/libc.a(getopt.o): in function `_getopt_internal':
(.text+0xcc0): multiple definition of `_getopt_internal'; support/libsupport.a(getopt.o):/tmp/guix-build-gawk-5.1.0.drv-0/gawk-5.1.0/support/getopt.c:1187: first defined here
ld: /gnu/store/qmgsfxm3ad5n7bi947n7xw0wq86blqr9-glibc-2.33-static/lib/libc.a(getopt.o):(.data+0x8): multiple definition of `optind'; support/libsupport.a(getopt.o):/gnu/store/zy7zwhxxbphqqmigp17j54dpbpz6wr38-glibc-2.33/include/bits/getopt_core.h:50: first defined here
ld: /gnu/store/qmgsfxm3ad5n7bi947n7xw0wq86blqr9-glibc-2.33-static/lib/libc.a(getopt.o):(.data+0x4): multiple definition of `opterr'; support/libsupport.a(getopt.o):/gnu/store/zy7zwhxxbphqqmigp17j54dpbpz6wr38-glibc-2.33/include/bits/getopt_core.h:55: first defined here
ld: /gnu/store/qmgsfxm3ad5n7bi947n7xw0wq86blqr9-glibc-2.33-static/lib/libc.a(getopt.o):(.data+0x0): multiple definition of `optopt'; support/libsupport.a(getopt.o):/gnu/store/zy7zwhxxbphqqmigp17j54dpbpz6wr38-glibc-2.33/include/bits/getopt_core.h:59: first defined here
ld: /gnu/store/qmgsfxm3ad5n7bi947n7xw0wq86blqr9-glibc-2.33-static/lib/libc.a(getopt.o): in function `getopt':
(.text+0xd20): multiple definition of `getopt'; support/libsupport.a(getopt.o):/tmp/guix-build-gawk-5.1.0.drv-0/gawk-5.1.0/support/getopt.c:1206: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:663: gawk] Error 1
make[2]: Leaving directory '/tmp/guix-build-gawk-5.1.0.drv-0/gawk-5.1.0'
--8<---------------cut here---------------end--------------->8---

This patch fixes it by passing “--allow-multiple-definition” to the linker.

Judging by the CI results, cross-builds seems to be working. I haven’t looked
into what’s different about them.

NB: I wasn’t sure how to write a changelog for ‘%static-inputs’ so I got a bit
creative.

¹ https://ci.guix.gnu.org/build/502639/details

 gnu/packages/make-bootstrap.scm | 14 +++++++++++---
 guix/build-system/gnu.scm       |  8 ++++++--
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index 12e59e9f8383..79eb9d60026f 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -260,10 +260,15 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                     `(modify-phases ,phases
                        (delete 'fix-egrep-and-fgrep)))))))
         (finalize (compose static-package
-                           package-with-relocatable-glibc)))
+                           package-with-relocatable-glibc))
+        (finalize-with-ld-flags (lambda (pkg ld-flags)
+                                  (package-with-relocatable-glibc
+                                   (static-package pkg #:ld-flags ld-flags)))))
     `(,@(map (match-lambda
               ((name package)
-               (list name (finalize package))))
+               (list name (finalize package)))
+               ((name package ld-flags)
+                (list name (finalize-with-ld-flags package ld-flags))))
              `(("tar" ,tar)
                ("gzip" ,gzip)
                ("bzip2" ,bzip2)
@@ -272,7 +277,10 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                ("coreutils" ,coreutils)
                ("sed" ,sed)
                ("grep" ,grep)
-               ("gawk" ,gawk)))
+               ("gawk" ,gawk
+                ;; gawk's gnulib defines some getopt symbols which are also in
+                ;; libc.a so this linker option is needed for a static build.
+                "-Wl,--allow-multiple-definition")))
       ("bash" ,static-bash))))
 
 (define %static-binaries
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index ea91be5bcd0c..acbd5b3a0de4 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -210,7 +210,7 @@ flags for VARIABLE, the associated value is augmented."
   "A version of P linked with `-static-gcc'."
   (package-with-extra-configure-variable p "LDFLAGS" "-static-libgcc"))
 
-(define* (static-package p #:key (strip-all? #t))
+(define* (static-package p #:key (strip-all? #t) (ld-flags #f))
   "Return a statically-linked version of package P.  If STRIP-ALL? is true,
 use `--strip-all' as the arguments to `strip'."
   (package (inherit p)
@@ -220,7 +220,11 @@ use `--strip-all' as the arguments to `strip'."
                   #:strip-flags '("--strip-unneeded")))))
        (substitute-keyword-arguments a
          ((#:configure-flags flags)
-          `(cons* "--disable-shared" "LDFLAGS=-static" ,flags))
+          `(cons* "--disable-shared" (string-append "LDFLAGS=-static"
+                                                    (if ,ld-flags
+                                                        (string-append " " ,ld-flags)
+                                                        ""))
+                  ,flags))
          ((#:strip-flags flags)
           (if strip-all?
               ''("--strip-all")




Acknowledgement sent to Thiago Jung Bauermann <bauermann@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#50174; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 10 Sep 2021 20:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.