From unknown Sun Jun 22 04:30:30 2025 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-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * 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 From unknown Sun Jun 22 04:30:30 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Brian Kubisiak Subject: bug#74758: closed (Re: [bug#74758] [PATCH] pack: Allow cross-compiling with '--relocatable'.) Message-ID: References: <87wmg0fsgd.fsf@gnu.org> X-Gnu-PR-Message: they-closed 74758 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 74758@debbugs.gnu.org Date: Sun, 15 Dec 2024 23:17:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1734304622-4491-1" This is a multi-part message in MIME format... ------------=_1734304622-4491-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #74758: [PATCH] pack: Allow cross-compiling with '--relocatable'. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 74758@debbugs.gnu.org. --=20 74758: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D74758 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1734304622-4491-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 74758-done) by debbugs.gnu.org; 15 Dec 2024 23:16:17 +0000 Received: from localhost ([127.0.0.1]:52599 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tMxqT-000192-Fn for submit@debbugs.gnu.org; Sun, 15 Dec 2024 18:16:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54436) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tMxqQ-00018m-Sp for 74758-done@debbugs.gnu.org; Sun, 15 Dec 2024 18:16:15 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tMxqH-0004qZ-TK; Sun, 15 Dec 2024 18:16:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=Ox+KXOlvnSYhEcJLKFwIWEYTDIw/+ioFnVyfop2UB6Q=; b=GmyPILk/+zR8s4yT+dcn kquaxMTwJOgwwJ+C+1JXMG+CS7VdFSAZyraxL3H7bD6GBHXlAq8pj4YYNVnWCIe5m5NWbClS8XGqH vsdCKanL8y0o2UVtDjcvv2ML2r0KHpxmzmLKV2syWdlQXG5TNMs/1gfxwb+VApBsbrbE4OkzNTfly pbuZE4IWobtkjQvfroii10qCFN1NpFYjNWpxxk0etbkir17dn3hHtUSHb3i/kCf7jURejeyz81OHY MsLnZxw3eZ2D2pMDGH53YomZGWOG0NyccWicICVrgqzQYP3xFhIR0SZ+drU/MuS9ahFLFLoi40JjW tZZffP9cSE5XRQ==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Brian Kubisiak Subject: Re: [bug#74758] [PATCH] pack: Allow cross-compiling with '--relocatable'. In-Reply-To: (Brian Kubisiak's message of "Mon, 9 Dec 2024 14:13:51 -0800") References: Date: Mon, 16 Dec 2024 00:16:02 +0100 Message-ID: <87wmg0fsgd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74758-done Cc: 74758-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Brian Kubisiak skribis: > * 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 Excellent. Applied, thanks! > guix/scripts/pack.scm | 47 ++++++++++++++++++++++++++++--------------- > 1 file changed, 31 insertions(+), 16 deletions(-) I=E2=80=99m glad the implementation turned out to be quite small! Ludo=E2=80=99. ------------=_1734304622-4491-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit 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 To: guix-patches@gnu.org Subject: [PATCH] pack: Allow cross-compiling with '--relocatable'. 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-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * 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 ------------=_1734304622-4491-1--