From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id WM/cAL0KJGGXWgAAgWs5BA (envelope-from ) for ; Mon, 23 Aug 2021 22:53:17 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id oPIWOLwKJGE0GQAA1q6Kng (envelope-from ) for ; Mon, 23 Aug 2021 20:53:16 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8C5EC1607A for ; Mon, 23 Aug 2021 22:53:13 +0200 (CEST) Received: from localhost ([::1]:33520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIGwR-0008LY-JF for larch@yhetil.org; Mon, 23 Aug 2021 16:53:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIGwI-0008KS-LB for guix-patches@gnu.org; Mon, 23 Aug 2021 16:53:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59375) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIGwI-0001EH-Ai for guix-patches@gnu.org; Mon, 23 Aug 2021 16:53:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mIGwI-0000SC-9Q for guix-patches@gnu.org; Mon, 23 Aug 2021 16:53:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50174] [PATCH core-updates-frozen 1/2] gnu: make-bootstrap: Fix build of static gawk. Resent-From: Thiago Jung Bauermann Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 23 Aug 2021 20:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50174 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50174@debbugs.gnu.org Cc: Thiago Jung Bauermann X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16297519301678 (code B ref -1); Mon, 23 Aug 2021 20:53:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Aug 2021 20:52:10 +0000 Received: from localhost ([127.0.0.1]:42688 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIGvR-0000Qz-CS for submit@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 ) id 1mIGvM-0000Qm-0Y for submit@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 ) id 1mIGvK-0007Mm-4Q for guix-patches@gnu.org; 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 ) id 1mIGvE-0000KC-3X for guix-patches@gnu.org; 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 ; 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 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 ; 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 ; 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) Date: Mon, 23 Aug 2021 17:51:27 -0300 Message-Id: <20210823205127.27102-1-bauermann@kolabnow.com> 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@kolabnow.com; 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-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+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Thiago Jung Bauermann X-ACL-Warn: , Thiago Jung Bauermann via Guix-patches From: Thiago Jung Bauermann via Guix-patches via X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1629751993; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=kPxGyJproYxkbVySbjQueetwDLNDFK0K3i9tyvh0vQ4=; b=YfcbI/xBjRm9evXmresO2uH92IG77BBWg6xKL77Nths011wZba81ZwUbHz1m764WvydMY5 1kAexQUL8AqKuY7cMNRQn5yhgdF/CWqsMnkvZ7h5SfU/GkBlJiRRNAgEYbn3V+enjY/1G1 nDH5w9VDq/wkXqANdhL7znLHMMj5isiomc91F9GeAMb/aGH6a/ek7coH0484NYp5bJcncQ FXbdcCDgV/DnZ0iDSMMhHlxSvbTNZVTHLA4E7E+PjkSoz+2t5wUINuoziaWIkWzRusfeMP ldWX8STIISXuXUZU7ajcr/Hpyf4WTT8v30QwZM5J1Lll3zixaxWqJCzN7PrROA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1629751993; a=rsa-sha256; cv=none; b=sPSulg2oQMXTa9Dq0JXQhonmxcgtZTfBnaqLUrso4wT1LCsYQuTqi94MWMjP82NXhTLpjw iCA/4yzqqrqrAUMhOBb6SH01wRsmPlXbtthX4tYavqbu2S0Ynh0D5rc95yYXvJ/arWm1WZ NKjOkEV3h1scYkHjTvK9rkwtwhwTfImm/ccvmJ4mf1+GSCQIq/DDn5i21xwb02khvrQ3oX xlJbpf9C+jWUAOIGCPjuTeHWWscAMY4RjZHgK9BMk26g1TVeRE7XIAhbbKUsS314SCoLRy l05ub1ekW1gBXNKsDJ+TjzE9ue0y7VjEl9Qo/gKj+vfIEv6nws7RKtQjoyO2uQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=kolabnow.com header.s=dkim20160331 header.b=T5k3j+f+; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -2.92 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=kolabnow.com header.s=dkim20160331 header.b=T5k3j+f+; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 8C5EC1607A X-Spam-Score: -2.92 X-Migadu-Scanner: scn0.migadu.com X-TUID: AKSP0byAgory * gnu/packages/make-bootstrap.scm (%static-inputs)[finalize-with-ld-flags]: New function. [map]: Add new clause to match three elements. [map]: 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")