From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id kMsuNMnGzGBqOQAAgWs5BA (envelope-from ) for ; Fri, 18 Jun 2021 18:16:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 4Fz8L8nGzGDgXgAAB5/wlQ (envelope-from ) for ; Fri, 18 Jun 2021 16:16:09 +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 00805123BC for ; Fri, 18 Jun 2021 18:16:09 +0200 (CEST) Received: from localhost ([::1]:52574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1luHA7-0002Qc-Vu for larch@yhetil.org; Fri, 18 Jun 2021 12:16:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1luH5O-0000aj-Iy for guix-patches@gnu.org; Fri, 18 Jun 2021 12:11:15 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46312) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1luH5O-0002Cx-C2 for guix-patches@gnu.org; Fri, 18 Jun 2021 12:11:14 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1luH5O-000313-86 for guix-patches@gnu.org; Fri, 18 Jun 2021 12:11:14 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49025] [[PATCH v2 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: Fri, 18 Jun 2021 16:11:14 +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.162403265311335 (code B ref 49025); Fri, 18 Jun 2021 16:11:14 +0000 Received: (at 49025) by debbugs.gnu.org; 18 Jun 2021 16:10:53 +0000 Received: from localhost ([127.0.0.1]:57823 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1luH4z-0002wZ-1P for submit@debbugs.gnu.org; Fri, 18 Jun 2021 12:10:53 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:50154) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1luH4e-0002sb-Dm for 49025@debbugs.gnu.org; Fri, 18 Jun 2021 12:10:30 -0400 Received: from localhost.localdomain ([188.188.242.184]) by baptiste.telenet-ops.be with bizsmtp id Jg9t250053zRM2s01gATQY; Fri, 18 Jun 2021 18:10:27 +0200 From: Maxime Devos Date: Fri, 18 Jun 2021 18:09:35 +0200 Message-Id: <20210618160936.18972-36-maximedevos@telenet.be> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618160936.18972-1-maximedevos@telenet.be> References: <20210618160936.18972-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=1624032627; bh=cL6/X82yxoqwh+DYMtBl3NVxy2HSHe9g4hdvR4Kv7Bw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To; b=oStZdjsV/koIY6SvderK1Z0ux8lc9OdnnE9oMDocAgiFfn7ulcQSL6mAapyiyWhbQ dHqzFjw317c5S1qhTfFfM/vLbcPW/iyHSULZr4mdYDl8IXiao5374QG2P4fWbJKlhx veZdgstvgzmhT5PJPV6beN8v09I53oTw9iY4hsYEuLaCkrv7plcwgrTq0LR55GNFQy ljfhZH2o0GJ+CHdNGq6KoLXXdXG1JqrgCqkFsXvMb+fO7NSQaeJ0PAo+C3GSdrj4SH qFz0EQ02ou0aMCEauw70T76Ga3PipsC20RtNjqHNz8FPL9FjUlwaRFlbV9ibrd1GqA jcz18Jniqlghg== 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: , Reply-To: 49025@debbugs.gnu.org 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=1624032969; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=cL6/X82yxoqwh+DYMtBl3NVxy2HSHe9g4hdvR4Kv7Bw=; b=gIM7x8m7Wy4lLdzyMvgx0PnfZWBKp+19GVV/lwC/Ko4NtFLo4nSPSI4jRKsYBTpa2mU/lQ MAwJ5eTEgjIzoDZVb62vNxPqm4/0xAwzLo1aY86AOPYvZBGK2fBJtzqpEV/Vd8RMZZhYMD 2NGibVQkxEVaXEbrNAMxHBKVbnd5sgP1kqlro1pXRx0J/+bHVfcLKyU22y26VZNo4i023H 0Y3BcWB5qgIrbkRA49LAULuokRKMY1TdtnoXhX49Z/FTNU8KaDcKwwbuqQeJTGeuEGgnN8 Tep/DWq2H8sK+5rNG5mWncA8HkpdFrnR2MF12DUowHaP1ti0ixOzygfUqfxLgA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624032969; a=rsa-sha256; cv=none; b=RdDeIemkkGUK3Ui2dqtbX9NJbny4t2KwSMu7dtcmRQaVlQ2qHjwVXBq39Miknz+NQigvKI 4p5onz+hA6gwdzq66gMgHRNqFBDnSufQhvDANChLdxmQTjEaGaS6K0A7o0TDfGX/8IPs+g /ViUjkvmn/Pk3FOPdB+yt7ZD40ciy6acd+LpqzxfzAfi2xsb84jkIiOcDETVKNLgL8ehVH 3Pt8WmG8AXcUduCnH80W7oLyyEVdJTCs9lClM3swWlYeiotb8A4IhtH7dxe5sfPj4AEie2 oTuXnVkOuerlEMKCljbac709/hcKVXMSbB87rwh0wxQJ2WDW78VXF6g1Xrpigw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=oStZdjsV; 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.17 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=oStZdjsV; 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: 00805123BC X-Spam-Score: 1.17 X-Migadu-Scanner: scn0.migadu.com X-TUID: tJBTsylt/oB9 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 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." -- 2.32.0