From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id aFnbCI98x2CwbAAAgWs5BA (envelope-from ) for ; Mon, 14 Jun 2021 17:58:07 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id yPUGBI98x2DkGQAAbx9fmQ (envelope-from ) for ; Mon, 14 Jun 2021 15:58:07 +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 622928144 for ; Mon, 14 Jun 2021 17:58:06 +0200 (CEST) Received: from localhost ([::1]:57796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lsoyS-00030C-Uh for larch@yhetil.org; Mon, 14 Jun 2021 11:58:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lsog2-0002tk-Al for guix-patches@gnu.org; Mon, 14 Jun 2021 11:39:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36064) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lsog2-0007in-2W for guix-patches@gnu.org; Mon, 14 Jun 2021 11:39:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lsog2-0004Ia-0z for guix-patches@gnu.org; Mon, 14 Jun 2021 11:39:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49025] [PATCH core-updates 36/37] cross-base: Fix cross-compiler for i686-linux-gnu. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 14 Jun 2021 15:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49025 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49025@debbugs.gnu.org Received: via spool by 49025-submit@debbugs.gnu.org id=B49025.162368510216386 (code B ref 49025); Mon, 14 Jun 2021 15:39:01 +0000 Received: (at 49025) by debbugs.gnu.org; 14 Jun 2021 15:38:22 +0000 Received: from localhost ([127.0.0.1]:47569 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lsofF-0004Fp-Pm for submit@debbugs.gnu.org; Mon, 14 Jun 2021 11:38:22 -0400 Received: from michel.telenet-ops.be ([195.130.137.88]:41494) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lsofD-0004AR-Kv for 49025@debbugs.gnu.org; Mon, 14 Jun 2021 11:38:12 -0400 Received: from butterfly.local ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by michel.telenet-ops.be with bizsmtp id H3eB250050mfAB4063eBzz; Mon, 14 Jun 2021 17:38:11 +0200 Message-ID: From: Maxime Devos Date: Mon, 14 Jun 2021 17:38:11 +0200 In-Reply-To: References: Content-Type: multipart/mixed; boundary="=-oH9qGEQAoJZ+smm4Quia" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1623685091; bh=WplP20+eB7mSS6oq9iP70QmaGoawFZIEwLgO+cNm+aw=; h=Subject:From:To:Date:In-Reply-To:References; b=M1XL1VCQ/JIqJfNbS0E+jjEGp9cqx9B9fB0txie1AgAXUxAb5AQRgvD88WNQ9k0RO En0tkczhdEy4/WCw6sFBHe+OKv5ezM2iXm6L7G1z038m3McggMrJ7HgWQllHfnNq0H xrt+HMAChIYys8eCi+SQjSm+lw5aNm10sRWqP+ozt49IrSIQZcK8vS7hGxGZou5kut qG1gw+TteCEliKS14E37yzB8RbtAVsYqPVX76Y4fhXzZRO5Y6SGkkjTDge37o7oZ60 4yeIkKOil844KSaxQpq8feg/Qg60707NVQXm987e1fUvRp/DL4WojDnjkuaZhYysOq GUsUS/OfT8X4g== 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1623686286; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=WplP20+eB7mSS6oq9iP70QmaGoawFZIEwLgO+cNm+aw=; b=ArLe4uAT64Bm61/eqQTSPohEYUU3NYvP3kcaOmJzN0lyCw1I0AFyaMYAybQN7a/KDau+Wz bFJQRL5gfduPaQaAKHY92tTziBlliP/lcKoozPrJDjrEU03aG/DsnKWtOv8kbj0eRcc6/O MYNF0U1sKzXvv32YIdvemwWsE2t4kijIoA86rlBLloXJ6LitWlehSz0Lq4UyFQsSQFIDzX PXv43hWUbf1Wez2o+tpG1ZpnL82d3FF8Avy40vv7mtRHrOTXo4qZuuiHJW2pEIFHXzC21X RA+c/G7QA4CegQV9JdXyzB09GBZ3n/gGr09MEmApJQFAN7rnLmg4D/LIEpjWLA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1623686286; a=rsa-sha256; cv=none; b=GL7swtx5I9qt8xvrEcu05zn/D3cPmMnzZQ3j1u/KDw4lGfKLyi01OKG9mpLxQdX7sfIVu5 loXYa/YDNq1GLn8hFI/9/81GA8RGWIGcIBN+gOn538l7LjcEXge0Bkxl1zrlaa31CxvsFh Oyu7yAR+vQAbtpMhr0oXe1hcztnrktG1WP/saQDIJoC5rVmUopMy7uzlDR8K1/KM7Qq5wT qG+OTt7GQD8JrGkOom/FvLtlABdLF545PF0mOmi7E/xaJJ0yJHmAuawupX97FbR38m9Xrv Oyp1DP7MpAwyVJEkfHr9mKvzSxST8AjhcULZ8+Sk59Er6nZqo+JHLRnEalB0Vw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=M1XL1VCQ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); 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: -1.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=M1XL1VCQ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); 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: 622928144 X-Spam-Score: -1.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: qGL4n5Qjf2Ol --=-oH9qGEQAoJZ+smm4Quia Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit GCC doesn't find libgcc_s.so anymore and looks in the wrong location. Fix this (well, more a work-around really). * gnu/packages/cross-base.scm (cross-gcc-arguments)<#:configure-flags>: Add --with-toolexecdir, such that libstdc++ ends up in the right place. Add --with-slibdir such that libgcc_s.so end up in the right place. (cross-gcc-arguments)<#:phases>{move-shared-libraries}: New phase, moving libraries in the correct place. Delete .la files, libasan.so and libusan.so to prevent circular references. Likewise, fix a reference in libstdc++.so.VERSION-gdb.py. --- gnu/packages/cross-base.scm | 63 +++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 3 deletions(-) --=-oH9qGEQAoJZ+smm4Quia Content-Disposition: attachment; filename="0036-cross-base-Fix-cross-compiler-for-i686-linux-gnu.patch" Content-Transfer-Encoding: 8bit Content-Type: text/x-patch; name="0036-cross-base-Fix-cross-compiler-for-i686-linux-gnu.patch"; charset="UTF-8" diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 9487ac9238..995b4ae065 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -7,6 +7,7 @@ ;;; Copyright © 2019, 2020, 2021 Marius Bakke ;;; Copyright © 2019 Carl Dong ;;; Copyright © 2020 Mathieu Othacehe +;;; Copyright © 2021 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -33,6 +34,7 @@ #:use-module (guix packages) #:use-module (guix download) #:use-module (guix utils) + #:use-module (guix gexp) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) #:use-module (srfi srfi-1) @@ -169,9 +171,26 @@ base compiler and using LIBC (which may be either a libc package or #f.)" )) ;; Install cross-built libraries such as libgcc_s.so in - ;; the "lib" output. + ;; the "lib" output. At least for version 8.4.0, GCC + ;; will put libstdc++ in ${toolexecdir}/lib instead. + ;; (A bug?) So set --with-toolexecdir as well. + ,@(if libc - `((string-append "--with-toolexeclibdir=" + `((string-append "--with-toolexecdir=" + (assoc-ref %outputs "lib")) + (string-append "--with-toolexeclibdir=" + (assoc-ref %outputs "lib") + "/" ,target "/lib")) + '()) + ;; At least for GCC 8.0, libgcc_s.so and libstdc++.so + ;; are not installed in the location specified in + ;; --with-toolexeclibdir so GCC will not find it + ;; when cross-compiling, say, GNU Hello. + ;; + ;; Work-around by specifying slibdir. This is not + ;; sufficient, see move-shared-libraries below. + ,@(if (and libc (version>=? (package-version xgcc) "8.0")) + `((string-append "--with-slibdir=" (assoc-ref %outputs "lib") "/" ,target "/lib")) '()) @@ -193,7 +212,45 @@ base compiler and using LIBC (which may be either a libc package or #f.)" ,flags)) flags)) ((#:phases phases) - `(cross-gcc-build-phases ,target ,phases)))))) + (if (and libc (version>=? (package-version xgcc) "8.0")) + #~(modify-phases (cross-gcc-build-phases #$target #$phases) + (add-after 'install 'move-shared-libraries + (lambda _ + (let* ((slib (format #f "~a/~a/lib/" #$output:lib #$target)) + (badlib (format #f "~a/~a/lib/" #$output #$target)) + (libs (map basename (find-files badlib #:fail-on-error? #t)))) + (for-each + (lambda (lib) + (let ((from (string-append badlib lib)) + (to (string-append slib lib))) + (when (file-exists? to) + (error "~a was found twice, refusing to overwrite!" + lib)) + ;; The debugging script libstdc++.so.VERSION-gdb.py has + ;; reference to #$output. Correct it. + (when (string-suffix? "-gdb.py" lib) + (substitute* from + (("libdir = '(.*)'") + (string-append "libdir = '" slib "'"))) + (system* "cat" from)) + ;; The .la files have references to BADLIB, + ;; leading to cyclic references between + ;; the outputs of the package. Remove them + ;; and hope noone notices. + ;; + ;; Likewise, libasan.so.* and libubsan.so.* + ;; have references to #$output. + (if (or (string-suffix? ".la" lib) + (string-prefix? "libasan.so" lib) + (string-prefix? "libubsan.so" lib)) + (delete-file from) + (rename-file from to)))) + libs) + ;; If you have "cyclic references" problems, + ;; uncomment this and use --keep-failed to figure + ;; things out. + (copy-recursively #$output:lib "out-test"))))) + #~(cross-gcc-build-phases #$target #$phases))))))) (define (cross-gcc-patches xgcc target) "Return GCC patches needed for XGCC and TARGET." --=-oH9qGEQAoJZ+smm4Quia--