On Sat, May 10, 2025 at 10:52:08AM +0200, Rutherther wrote: > > > > > The reason why 32-bit is not supported in our Rust and natively in Zig > > upstream is simple: memory requirement to bootstrap the compiler. > > I would still be interested in the details, is it known how much memory > is necessary, and what processes are taking this much memory, is it > reported somewhere upstream that they should be considering changes to > not consume as much memory?
I've done some work on getting rust-bootstrap@1.54 to build in i686, and in the years since that comment was first added I don't believe it is memory constrained anymore. I've attached a diff of where I was, I think the failure with my patch had to do with 128-bit somethings. -- Efraim Flashner <efr...@flashner.co.il> אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted
diff --git a/gnu/packages/patches/mrustc-patches.patch b/gnu/packages/patches/mrustc-patches.patch index 626945e2a12..ae0e9e280d9 100644 --- a/gnu/packages/patches/mrustc-patches.patch +++ b/gnu/packages/patches/mrustc-patches.patch @@ -17,3 +17,38 @@ index 088c723a..d322fd0d 100644 - #include <string> - - namespace llvm { +diff --git a/src/trans/target.cpp b/src/trans/target.cpp +index a5137a77..44ce01a5 100644 +--- a/src/trans/target.cpp ++++ b/src/trans/target.cpp +@@ -460,6 +460,13 @@ namespace + ARCH_M68K + }; + } ++ else if(target_name == "powerpc-linux-gnu" || target_name == "powerpc-unknown-linux-gnu") ++ { ++ return TargetSpec { ++ "unix", "linux", "gnu", {CodegenMode::Gnu11, false, "powerpc-unknown-linux-gnu", BACKEND_C_OPTS_GNU}, ++ ARCH_POWERPC32 ++ }; ++ } + else if(target_name == "powerpc64-unknown-linux-gnu") + { + return TargetSpec { +diff --git a/tools/common/target_detect.h b/tools/common/target_detect.h +index 2a5eafbd..e86e3041 100644 +--- a/tools/common/target_detect.h ++++ b/tools/common/target_detect.h +@@ -52,6 +52,12 @@ + # else + # define DEFAULT_TARGET_NAME "m68k-unknown-linux-musl" + # endif ++# elif defined(__powerpc__) ++# if defined(__USE_GNU) ++# define DEFAULT_TARGET_NAME "powerpc-unknown-linux-gnu" ++# else ++# define DEFAULT_TARGET_NAME "powerpc-unknown-linux-musl" ++# endif + # elif defined(__powerpc64__) && defined(__BIG_ENDIAN__) + # if defined(__USE_GNU) + # define DEFAULT_TARGET_NAME "powerpc64-unknown-linux-gnu" diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index abaf7166fd5..a1ca9b542d7 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -128,7 +128,7 @@ (define* (rust-bootstrapped-package base-rust version checksum) ;;; Note: mrustc's only purpose is to be able to bootstap Rust; it's designed ;;; to be used in source form. -(define %mrustc-commit "5e01a76097265f4bb27b18885b9af3f2778180f9") +(define %mrustc-commit "d3ecf5468e8266ab6059762b96c6413bc680ed20") (define %mrustc-source (let* ((version "0.11.0") (commit %mrustc-commit) @@ -141,7 +141,7 @@ (define %mrustc-source (commit %mrustc-commit))) (file-name (git-file-name name (git-version version revision commit))) (sha256 - (base32 "1yyjfl1z6d5r9sv7zl90kqyjw1lqd2cqzwh2syi7yvrpslhihrhy")) + (base32 "10dlnk2cy4k569m68lrfj50dxlrip3vzc0gx9w4jfzmcc8b65lip")) (patches (search-patches "mrustc-patches.patch")) (modules '((guix build utils))) (snippet @@ -181,6 +181,36 @@ (define-public rust-bootstrap ;; find vendor -not -type d -exec file {} \+ | grep PE32 (for-each delete-file (find-files "vendor" "\\.(a|dll|exe|lib)$")) + ;; Remove the need for some atomics to help with the bootstrap. + #; + (substitute* '("vendor/crossbeam-utils/no_atomic.rs" + "vendor/crossbeam-epoch/no_atomic.rs") + ((" \"msp430-none-elf\"," all) + (string-append " \"i586-unknown-linux-gnu\",\n" + " \"i686-unknown-linux-gnu\",\n" + " \"armv7-unknown-linux-gnueabihf\",\n" + all))) + ;; Use the older included version of crossbeam-utils without + ;; atomics to help with bootstrapping on some architectures. + (substitute* "vendor/crossbeam-epoch/Cargo.toml" + (("0\\.8\\.5") "0.8")) + (substitute* "vendor/serde/build.rs" + ((".*i686.*") "")) + (delete-file-recursively "vendor/crossbeam-utils") + ;; Try using an older hex for security-framework. + ;; Triggered an integer overflow on 32-bit hardware. + #; + (substitute* "vendor/security-framework/Cargo.toml" + (("0\\.4\\.2") "0.3")) + #; + (substitute* '("src/tools/build-manifest/Cargo.toml" + "src/tools/cargo/Cargo.toml" + "src/tools/cargo/crates/cargo-util/Cargo.toml" + "src/tools/miri/Cargo.toml" + ) + (("hex = \"0\\.4(\\.[02])?") "hex = \"0.3")) + ;(delete-file-recursively "vendor/hex") + ;; Adjust some sources for llvm-13, see llvm commit ;; acce401068e78a8c5dc9e06802111ffad3da763f (substitute* (find-files "." "powerpc64le_unknown_linux_gnu.rs") @@ -200,10 +230,10 @@ (define-public rust-bootstrap `(("pkg-config" ,pkg-config) ("mrustc-source" ,%mrustc-source))) (arguments - `(#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums' - #:modules ((guix build cargo-utils) - (guix build utils) - (guix build gnu-build-system)) + `(;#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums' + ;#:modules ((guix build cargo-utils) + ; (guix build utils) + ; (guix build gnu-build-system)) #:test-target "test" ;; Rust's own .so library files are not found in any RUNPATH, but ;; that doesn't seem to cause issues.
signature.asc
Description: PGP signature