From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: Desktops on non-x86_64 systems
Date: Tue, 30 Nov 2021 23:56:21 -0500 [thread overview]
Message-ID: <87pmqghqiy.fsf@gmail.com> (raw)
In-Reply-To: <874k7w9nm9.fsf@gnu.org> ("Ludovic Courtès"'s message of "Sun, 28 Nov 2021 18:49:34 +0100")
Hello!
I've updated the branch wip-cross-built-rust; it seems to build and run
OK (although running the binary produced by compiling hello.rs with the
cross-built i686-linux rustc in a 32 bit VM took 47 sec (!?)),
apparently hanging on something before outputting correctly the message
and exiting with 0.
I'd now like to figure out the top-level plumbing required to get this
rust-i686-linux x86-64 package accepted in the real of i686-linux
packages (cross the architecture boundary). Is this even possible in
Guix?
In other words, I'd like the i686 architecture to be able to use this
rust-i686-linux cross built from x86_64 as if it was a *native* package.
Following what was done for polkit-mozjs/polkit-duktape, I've laid the
basic blocks:
--8<---------------cut here---------------start------------->8---
2 files changed, 25 insertions(+), 8 deletions(-)
gnu/packages/rust.scm | 26 ++++++++++++++++++++------
guix/build-system/cargo.scm | 7 +++++--
modified gnu/packages/rust.scm
@@ -54,11 +54,13 @@ (define-module (gnu packages rust)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix memoization)
#:use-module (guix packages)
#:use-module ((guix build utils) #:select (alist-replace))
#:use-module (guix utils)
#:use-module (ice-9 match)
- #:use-module (srfi srfi-26))
+ #:use-module (srfi srfi-26)
+ #:export (rust))
;; This is the hash for the empty file, and the reason it's relevant is not
;; the most obvious.
@@ -780,10 +782,22 @@ (define rust-1.54
(package-native-inputs base-rust))))))
;;; Note: Only the latest versions of Rust are supported and tested. The
-;;; intermediate rusts are built for bootstrapping purposes and should not
-;;; be relied upon. This is to ease maintenance and reduce the time
-;;; required to build the full Rust bootstrap chain.
-(define-public rust rust-1.54)
+;;; intermediate rusts are built for bootstrapping purposes and should not be
+;;; relied upon. This is to ease maintenance and reduce the time required to
+;;; build the full Rust bootstrap chain.
+(define-public rust-x86-64-linux rust-1.54)
+
+(define rust-for-system
+ (mlambda (system)
+ "Return a rust package that can be built for SYSTEM."
+ (if (string-prefix? "i686" system)
+ rust-i686-linux
+ rust-x86-64-linux)))
+
+(define-syntax rust
+ (identifier-syntax (rust-for-system
+ (or (%current-target-system)
+ (%current-system)))))
(define (force-system p system)
(package/inherit p
@@ -796,7 +810,7 @@ (define force-i686 (cut force-system <> "i686-linux"))
;;; Rust cross-built for i686-linux.
;;; TODO: Make a procedure of it that returns a cross-built rust package.
(define-public rust-i686-linux
- (let* ((base-rust (rust-bootstrapped-package rust))
+ (let* ((base-rust (rust-bootstrapped-package rust-x86-64-linux))
(base-source (package-source base-rust)))
(package/inherit base-rust
(source (origin
modified guix/build-system/cargo.scm
@@ -58,8 +58,11 @@ (define (crate-uri name version)
(define (default-rust)
"Return the default Rust package."
;; Lazily resolve the binding to avoid a circular dependency.
- (let ((rust (resolve-interface '(gnu packages rust))))
- (module-ref rust 'rust)))
+ (let-system (system target)
+ (let ((rust (resolve-interface '(gnu packages rust))))
+ (if (string-prefix? "i686" (or target system))
+ (module-ref rust 'rust-i686-linux)
+ (module-ref rust 'rust-x86-64-linux)))))
(define %cargo-utils-modules
;; Build-side modules imported by default.
--8<---------------cut here---------------end--------------->8---
But this doesn't take care of switching the x86_64-associated
rust-i686-linux package to become known as a i686 one.
How to proceed? I need a wizard :-).
Thanks!
Maxim
next prev parent reply other threads:[~2021-12-01 4:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-27 22:36 Desktops on non-x86_64 systems Ludovic Courtès
2021-11-27 22:43 ` Ricardo Wurmus
2021-11-28 3:05 ` Maxim Cournoyer
2021-11-28 3:28 ` Maxim Cournoyer
2021-11-28 3:43 ` John Soo
2021-11-28 7:29 ` Tobias Platen
2021-11-28 8:57 ` Ricardo Wurmus
2021-11-28 17:49 ` Ludovic Courtès
2021-11-28 18:15 ` Ricardo Wurmus
2021-11-30 15:36 ` Maxim Cournoyer
2021-12-06 12:38 ` Ludovic Courtès
2021-12-01 4:56 ` Maxim Cournoyer [this message]
2021-12-01 17:49 ` Ludovic Courtès
2021-12-01 19:37 ` Maxim Cournoyer
2021-12-02 3:26 ` Maxim Cournoyer
2021-12-06 2:18 ` Maxim Cournoyer
2021-12-06 12:30 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pmqghqiy.fsf@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=guix-devel@gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.