From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 6G9HBlxwV2ewZwEAe85BDQ:P1 (envelope-from ) for ; Mon, 09 Dec 2024 22:34:04 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 6G9HBlxwV2ewZwEAe85BDQ (envelope-from ) for ; Mon, 09 Dec 2024 23:34:04 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=uj5svh0e; dkim=fail ("headers rsa verify failed") header.d=kubisiak.com header.s=s1 header.b=QvRl3jhn; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1733783643; a=rsa-sha256; cv=none; b=Ia2a2FHakps9bgmR53Z7y4tSD43Pq5R+3E4/j9fZ+kUEewZevnRrb1/U4fpi/tehclei3D EsPjrlDEG05dNxfhG7dr7mpEFncpAW+UzL7vcSMbEp47bJlffZgI4huEuPcTiPzoXl6gcP ad5oTEOoihSAF/WBegIx2GDV4CgG+8USxYts+wcTKr5KAKYuZW1NZkti/XnhwwxdqYWke4 +8KS81L1AbxEPKh+bcbr9vanEiprAmMoDg4VO+I4SukL4381zDs5t0PKMLLm4AuWwFm4Kn 2jivy75/GsW+dE+qTVN+h6QW6tKIpsnkwORP5+Bo3Ji5q4NE6Vg9RUlhCxF1aw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=uj5svh0e; dkim=fail ("headers rsa verify failed") header.d=kubisiak.com header.s=s1 header.b=QvRl3jhn; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1733783643; 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:list-id:list-help:list-unsubscribe:list-subscribe: list-post:dkim-signature; bh=7bxTQjKIQe4i043Mev73d2xcxhQCe8MzMt7H+SmVXV8=; b=fjTDSYK1KhaXCMbvOqtW++rfxuboXWqwpDBO5E5SVm36U7VavmBFF+fCkSnavzpDBcHxSq jVllM9sMvHdRMpJC+TlDyerJ2nZzNE4b6fmhBUOchWAVY/AiTX0wtT+x7yz7CQ3bz2rR1z /FURak07vvWzakkU85AvYcXZ6XDVUJ1LkjARoe5shrAdPVD6BDO6c481rmD2dkBpVPEAs/ wUkONcVAK2lePQkWIjbwJ/04JKb/jDw28rhd3xg51R27WYymh6voJkNz99SoGkVrw0oj8F zImCI4d+dJ67VrA+Oigh6oQpd1qzFZT1flOPHTxUr/o4RMY9NzKrD9TvnAUs0w== 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 C94951B4D4 for ; Mon, 09 Dec 2024 23:34:03 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKm3u-00015L-5r; Mon, 09 Dec 2024 17:17:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tKm3s-000156-EE for guix-patches@gnu.org; Mon, 09 Dec 2024 17:17:04 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKm3q-0006qL-IP for guix-patches@gnu.org; Mon, 09 Dec 2024 17:17:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:From:Date:To:Subject; bh=WrsHxaMkI5qLf7vRBnK2wE0FlgQgLbgikWoRa3hPlag=; b=uj5svh0ecO/Zsw7wO7lQeKbzW+dbBChRD8Pt7HQe0RpSz1hw5KvyFg5dGLkx5V3V25ScRsu67PZzEBdkUzCsYe5SGEYUM0Cflggk/6UufEjhiI7WtkE5z128WyP/7rbJqfBeqwkg2WpL5h4knKj4udR1b9RRpZa1inOMgudmbUeHl5m9hrCuji3cWr0+wnDHkCGSObNxNRdcnZfKiev7/0I1NIaeCCsWo+XTSc1D9GgmAvwtuqqTuQw6JEmQCDQlF6p4rveyryPpl6YB3UgrAgpus8pdGAHvJ+sS2FRb4WJhOg9carPwjLlvHq9Uf6ihwl/8z6/pe6PllSFXYAr+gA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tKm3q-0004kO-D6 for guix-patches@gnu.org; Mon, 09 Dec 2024 17:17:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74758] [PATCH] pack: Allow cross-compiling with '--relocatable'. Resent-From: Brian Kubisiak Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 09 Dec 2024 22:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74758 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74758@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.173378257418155 (code B ref -1); Mon, 09 Dec 2024 22:17:02 +0000 Received: (at submit) by debbugs.gnu.org; 9 Dec 2024 22:16:14 +0000 Received: from localhost ([127.0.0.1]:56056 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKm33-0004il-GQ for submit@debbugs.gnu.org; Mon, 09 Dec 2024 17:16:13 -0500 Received: from lists.gnu.org ([209.51.188.17]:45046) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKm30-0004iY-Ki for submit@debbugs.gnu.org; Mon, 09 Dec 2024 17:16:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tKm0s-0000F3-Rs for guix-patches@gnu.org; Mon, 09 Dec 2024 17:13:58 -0500 Received: from [75.171.110.13] (helo=mail.kubisiak.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKm0r-0006Q8-Ax for guix-patches@gnu.org; Mon, 09 Dec 2024 17:13:58 -0500 dkim-signature: v=1; a=rsa-sha256; d=kubisiak.com; s=s1; c=relaxed/relaxed; q=dns/txt; h=From:Subject:Date:Message-ID:To:MIME-Version:Content-Type; bh=7bxTQjKIQe4i043Mev73d2xcxhQCe8MzMt7H+SmVXV8=; b=QvRl3jhnQQickuj+i4RofxNcJWoGQJQbJGc+QxKsuEcJw0QFKg7QRC+JCQ/0cX7CwoJnQFuv04IqFeWXHA5y5HEjxCMwdwfN7E6RXNJHm6LhQMFu+He0m9rtCx6Bq2ttc3gDeD0Q3F/IbFeE361K8ZTIFgDVYZBbHMy2okptU46hsLnJ4psJhKtZObUravywm1gtc5smVj+Ldt8422xG8f5u2ILLv9Vd55/QaYgKa0xD+iK5Wnhnwam0SL wXg4YQn1pE1rIFPs3QLSuX2E/79lhm6SdEpZoMFQNMPHXRPPer5/v1RSB1R6E1ZHXeXBBvB92L+cSZzlOOVuC7J21/uA== Received: from peregrine (135-180-130-213.dsl.dynamic.sonic.net [135.180.130.213]) (envelope-sender ) by mail.kubisiak.com with ESMTPSA id for (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256) ; Mon, 9 Dec 2024 16:13:53 -0600 Date: Mon, 9 Dec 2024 14:13:51 -0800 From: Brian Kubisiak Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Host-Lookup-Failed: Reverse DNS lookup failed for 75.171.110.13 (failed) Received-SPF: pass client-ip=75.171.110.13; envelope-from=brian@kubisiak.com; helo=mail.kubisiak.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: 2.34 X-Spam-Score: 2.34 X-Migadu-Queue-Id: C94951B4D4 X-Migadu-Scanner: mx12.migadu.com X-TUID: uKHju377q+eH * guix/scripts/pack.scm (c-compiler-compiler): Remove exception when cross-compiling and always build gexp->script for the host. [toolchain]: Use standard-cross-packages when cross-compiling. [search-paths]: Use package-search-paths instead of package-native-search-paths when cross-compiling. [run]: Use cc-for-target and strip-for-target. Change-Id: I5503e48b3394fdfee06999f8d1ad82f5f0d9af96 --- guix/scripts/pack.scm | 47 ++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 58cd55b129..d0e66c3013 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -1105,12 +1105,30 @@ (define-gexp-compiler (c-compiler-compiler (compiler ) system target "Lower COMPILER to a single script that does the right thing." (define toolchain (or (c-compiler-toolchain compiler) - (list (first (assoc-ref (standard-packages) "gcc")) - (first (assoc-ref (standard-packages) "ld-wrapper")) - (first (assoc-ref (standard-packages) "binutils")) - (first (assoc-ref (standard-packages) "libc")) - (gexp-input (first (assoc-ref (standard-packages) "libc")) - "static")))) + (if target + (let* ((cross-packages-host + (standard-cross-packages target 'host)) + (cross-packages-target + (standard-cross-packages target 'target)) + (xgcc + (first (assoc-ref cross-packages-host "cross-gcc")))) + (list xgcc + ;; ld-wrapper-cross isn't included with + ;; STANDARD-CROSS-PACKAGES, pull it from the inputs of + ;; cross-gcc instead + (first (assoc-ref (package-native-inputs xgcc) + "ld-wrapper-cross")) + (first (assoc-ref cross-packages-host "cross-binutils")) + (first (assoc-ref cross-packages-target "cross-libc")) + (gexp-input (first (assoc-ref cross-packages-target + "cross-libc:static")) + "static"))) + (list (first (assoc-ref (standard-packages) "gcc")) + (first (assoc-ref (standard-packages) "ld-wrapper")) + (first (assoc-ref (standard-packages) "binutils")) + (first (assoc-ref (standard-packages) "libc")) + (gexp-input (first (assoc-ref (standard-packages) "libc")) + "static"))))) (define inputs (match (append-map package-propagated-inputs @@ -1120,7 +1138,9 @@ (define-gexp-compiler (c-compiler-compiler (compiler ) system target (define search-paths (cons $PATH - (append-map package-native-search-paths + (append-map (if target + package-search-paths + package-native-search-paths) (filter package? inputs)))) (define run @@ -1144,17 +1164,12 @@ (define-gexp-compiler (c-compiler-compiler (compiler ) system target '#$inputs) (let ((output (output-file (command-line)))) - (apply invoke "gcc" (cdr (command-line))) - (invoke "strip" output))))) - - (when target - ;; TODO: Yep, we'll have to do it someday! - (leave (G_ "cross-compilation not implemented here; -please email '~a'~%") - (@ (guix config) %guix-bug-report-address))) + (apply invoke #$(cc-for-target target) (cdr (command-line))) + (invoke #$(strip-for-target target) output))))) (gexp->script "c-compiler" run - #:guile (c-compiler-guile compiler))) + #:guile (c-compiler-guile compiler) + #:target #f)) ;;; base-commit: 9001514e242ad15c190588439930b0fa4f6782e3 -- 2.46.0