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 INUEBikIzmAdEgEAgWs5BA (envelope-from ) for ; Sat, 19 Jun 2021 17:07:21 +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 kBTDASkIzmDMFAAAbx9fmQ (envelope-from ) for ; Sat, 19 Jun 2021 15:07:21 +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 9886C21E9C for ; Sat, 19 Jun 2021 17:07:20 +0200 (CEST) Received: from localhost ([::1]:52980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lucZ5-0001NW-KH for larch@yhetil.org; Sat, 19 Jun 2021 11:07:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lucY7-00082i-Pd for guix-patches@gnu.org; Sat, 19 Jun 2021 11:06:19 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48904) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lucY5-00080y-Uq for guix-patches@gnu.org; Sat, 19 Jun 2021 11:06:19 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lucY5-0005i0-R3 for guix-patches@gnu.org; Sat, 19 Jun 2021 11:06:17 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49025] [PATCH v4 core-updates 35/36] 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: Sat, 19 Jun 2021 15:06:17 +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 Cc: othacehe@gnu.org, Maxime Devos Received: via spool by 49025-submit@debbugs.gnu.org id=B49025.162411517121839 (code B ref 49025); Sat, 19 Jun 2021 15:06:17 +0000 Received: (at 49025) by debbugs.gnu.org; 19 Jun 2021 15:06:11 +0000 Received: from localhost ([127.0.0.1]:60423 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lucXv-0005en-AI for submit@debbugs.gnu.org; Sat, 19 Jun 2021 11:06:11 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:59572) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lucX8-0005Wo-AW for 49025@debbugs.gnu.org; Sat, 19 Jun 2021 11:05:25 -0400 Received: from localhost.localdomain ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by baptiste.telenet-ops.be with bizsmtp id K3552500S0mfAB40135Jra; Sat, 19 Jun 2021 17:05:18 +0200 From: Maxime Devos Date: Sat, 19 Jun 2021 17:04:57 +0200 Message-Id: <20210619150458.12057-36-maximedevos@telenet.be> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210619150458.12057-1-maximedevos@telenet.be> References: <20210619150458.12057-1-maximedevos@telenet.be> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1624115118; bh=9fPKxbDGsBGp3i29YCYtxFWs2CsPI2hNipZcOfdyXYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=M8zcFcbECkIFno2R6il1bCZ6JpSkw9SRmsq5BylO9EVyqfUzKFTeeXHJZuCueDhYn 7aoZLD9wbn9KOV3+wS0B7X7erVJSwEU3CjZ1/RQ+pByox2LHxQkd7zvCBdSUKIO8Nr Wk3ZROXKLDM6zYsE8MoSRnEOueHhElSJnc3Wbyz9I6BLsWCmfV+Bo7oUCGyjCc6XC3 Zt2MlIdEO6GOFJn7lc/O3pICKWH6fHEFkytjOXG2t+lulxUWcDgo4Y+UAXHVKNc6ox s1kT//1+B9lTnVbt74Cyp8BGZlKoFfspwMUGiNfyjpXcdrh+pccHW0LWSJwGn9gtDq h82Nh8pccoosA== 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=1624115240; h=from:from:sender:sender: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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=9fPKxbDGsBGp3i29YCYtxFWs2CsPI2hNipZcOfdyXYU=; b=pb4Yl5j+/DFr28G+tF3/wcT6vt35awgdeJNIYg/CKmOUFOz9wjcqElJ7kssmfMOdKi32AN shb9h6aed0lVIVlXW8oe+OwUx61T76cEli6kH18hTPck72SUYMA+/W3gMPb5TSVMJ31/5H ap4VAktBeJxhOCSvGOnjQsdFL/5TC80Tef3Z7IV4f84dEiBELZA6h/hYmpRaXFM1r+DsQp GTstjJIqifRetQicHaLPrDbGM6hKNlrjvTWD0F3j/H13QBwYQDuaGIHC2fy/HRjzedC60q S/S657WrKyrLtR8ZOUGmN/AvZaMDIeav8+lzH+dxPt/84dqcET6nRzU4bO1i0Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624115240; a=rsa-sha256; cv=none; b=ktfAceFIEot2weYJPwe8x/ezNcQwNbOTGURVQPyMOBOJxogVKhhXWVkNLJRdIqBoyoTZUE PFDHd+I0eun1rXgwefAsFQiD5MsasMWLfMArNjBXn5Dh891GdHg2mH+S59bdNIJih9RmDB pJCYNnezsXve6a7XXLFpDU+p208pBG+98Z3zyLf+zlJocRcBumzclrpyYRw9kBh7i84Bib BL56Y1K2bqUM9yvCnP4xcA5k0dDB8FgHnLrl2C3dDrZnGRHcOhQiupGXYunQEhupSwqAik vbk0DCw41I7l6GABBja44w8TgQQ/S+pP8tC1u7tmNyvVW/0xwGoiPZzOyF5y3w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=M8zcFcbE; 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: -0.32 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=M8zcFcbE; 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: 9886C21E9C X-Spam-Score: -0.32 X-Migadu-Scanner: scn1.migadu.com X-TUID: uScZRMR4swER 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(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 926b00ccdf..b037edcc24 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." -- 2.32.0