* [bug#28433] [WIP] Rust update
@ 2017-09-12 16:50 Danny Milosavljevic
2017-10-25 14:19 ` Ricardo Wurmus
2017-10-30 19:18 ` [bug#28433] [WIP] v2 " Danny Milosavljevic
0 siblings, 2 replies; 16+ messages in thread
From: Danny Milosavljevic @ 2017-09-12 16:50 UTC (permalink / raw)
To: 28433
I'm trying to update our Rust. I've got it to work further than the text "package bootstrap" once, but I can't find how I did it anymore. See below.
Help?
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 652686e06..a0d4554d6 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -25,6 +25,7 @@
#:use-module (gnu packages bootstrap)
#:use-module (gnu packages cmake)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages cross-base)
#:use-module (gnu packages curl)
#:use-module (gnu packages elf)
#:use-module (gnu packages flex)
@@ -47,7 +48,7 @@
#:use-module (srfi srfi-26))
;; Should be one less than the current released version.
-(define %rust-bootstrap-binaries-version "1.15.0")
+(define %rust-bootstrap-binaries-version "1.17.0")
(define %rust-bootstrap-binaries
(origin
@@ -58,7 +59,7 @@
"-i686-unknown-linux-gnu.tar.gz"))
(sha256
(base32
- "0wmkfx8pxmkkw021mrq9s3xhra8f0daqdl6j56pxyn4w39i0rzrw"))))
+ "1svbg96gjkfk40hgyhgkm5mqxlx24943xf1423p3gfhqyvh6rl9r"))))
(define (increment-rust-version rust-version major patch)
(match (string-split rust-version #\.)
@@ -208,7 +209,7 @@ rustc-bootstrap and cargo-bootstrap packages.")
"rustc-" version "-src.tar.gz"))
(sha256
(base32
- "1d78jq7mc34n265by68amr9r4nzbiqrilfbwh7gx56ydn4gb6rpr"))
+ "04b1qd4zy9x0hax0rxzd0gg6nki37kjdvk9bid46j8lykglkdp6j"))
(modules '((guix build utils)))
(snippet
`(begin
@@ -222,16 +223,26 @@ rustc-bootstrap and cargo-bootstrap packages.")
("git" ,git)
("procps" ,procps) ; For the tests
("python-2" ,python-2)
+ ("cargo-bootstrap" ,cargo-bootstrap)
("rust-bootstrap" ,rust-bootstrap)
- ("which" ,which)))
+ ("which" ,which)
+ ("strace" ,strace)
+ ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
+ #:xbinutils (cross-binutils "i686-linux-gnu")
+ #:libc (cross-libc "i686-linux-gnu")))
+ ("cross-libc" ,(cross-libc "i686-linux-gnu"))))
(inputs
`(("jemalloc" ,jemalloc)
("llvm" ,llvm-3.9.1)))
(arguments
`(#:phases
(modify-phases %standard-phases
+ ;; Avoid cargo complaining about mismatched checksums.
+ (delete 'patch-source-shebangs)
+ (delete 'patch-generated-file-shebangs)
+ (delete 'patch-usr-bin-file)
(add-after 'unpack 'patch-configure
- (lambda _
+ (lambda* (#:key inputs #:allow-other-keys)
(substitute* "configure"
(("/usr/bin/env") (which "env")) ; Detect target CPU correctly.
(("probe_need CFG_CURL curl") "") ; Avoid curl build dependency.
@@ -247,14 +258,46 @@ rustc-bootstrap and cargo-bootstrap packages.")
(substitute* "src/tools/compiletest/src/util.rs"
(("(\"amd64\", \"x86_64\"),") "(\"amd64\", \"x86_64\"),
(\"nvptx\", \"nvptx\"),")) ; Make LLVM >= 3.8.1 work.
- (substitute* "mk/main.mk"
- (("LLVM_OPTIONAL_COMPONENTS=")
- "LLVM_OPTIONAL_COMPONENTS=nvptx ")) ; Make LLVM >= 3.8.1 work.
+ ;(system* "mv" "src/bootstrap/config.toml.example"
+ ; "src/bootstrap/config.toml")
+ (mkdir-p "src/bootstrap/.cargo")
+ (call-with-output-file "src/bootstrap/.cargo/config"
+ (lambda (p)
+ (format p "
+[source.crates-io]
+registry = 'https://github.com/rust-lang/crates.io-index'
+replace-with = 'vendored-sources'
+
+[source.vendored-sources]
+directory = 'src/vendor'
+
+[target.i686-linux-gnu]
+linker = \"~a/bin/i686-linux-gnu-gcc\"
+
+" (assoc-ref inputs "cross-gcc"))))
+
#t))
(add-after 'unpack 'set-env
(lambda _
+ (define (cross? x)
+ (string-contains x "cross-"))
(setenv "SHELL" (which "sh"))
(setenv "CONFIG_SHELL" (which "sh"))
+ (setenv "VERBOSE" "1")
+ (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
+ (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
+ (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
+ (for-each
+ (lambda (env-name)
+ (let* ((env-value (getenv env-name))
+ (search-path (search-path-as-string->list env-value))
+ (new-search-path (filter (lambda (e) (not (cross? e)))
+ search-path))
+ (new-env-value (list->search-path-as-string
+ new-search-path ":")))
+ (setenv env-name new-env-value)))
+ '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH" "LIBRARY_PATH"))
+
#t))
(add-after 'unpack 'patch-tests
(lambda* (#:key inputs #:allow-other-keys)
@@ -284,6 +327,7 @@ fn test_process_mask"))
(rustc (assoc-ref inputs "rustc-bootstrap"))
(llvm (assoc-ref inputs "llvm"))
(jemalloc (assoc-ref inputs "jemalloc"))
+ ;; TODO make bootstrapper use i686 libraries! (-lutil, -ldl, ...).
(flags (list
(string-append "--prefix=" out)
(string-append "--datadir=" out "/share")
@@ -291,16 +335,43 @@ fn test_process_mask"))
(string-append "--default-linker=" gcc "/bin/gcc")
(string-append "--default-ar=" binutils "/bin/ar")
(string-append "--python=" python "/bin/python2")
+ ; FIXME /gnu/store/6rri0kxb9q1gz6lv1dgdwjh41aa9ijdl-rustc-bootstrap-1.17.0/bin/cargo is wrong.
(string-append "--local-rust-root=" rustc)
(string-append "--llvm-root=" llvm)
(string-append "--jemalloc-root=" jemalloc "/lib")
"--release-channel=stable"
"--enable-rpath"
"--enable-local-rust"
- "--disable-rustbuild" ; rustbuild doesn't work yet.
"--disable-manage-submodules")))
+ (mkdir "Xcargo")
+ (call-with-output-file "Xcargo/config"
+ (lambda (p)
+ (format p "
+[source.crates-io]
+registry = 'https://github.com/rust-lang/crates.io-index'
+replace-with = 'vendored-sources'
+
+[source.vendored-sources]
+directory = 'src/vendor'
+
+[target.i686-linux-gnu]
+linker = \"~a/bin/i686-linux-gnu-gcc\"
+
+" (assoc-ref inputs "cross-gcc"))))
+ (setenv "CARGO_HOME" (string-append (getcwd) "/Xcargo"))
+ (substitute* "src/bootstrap/bootstrap.py"
+ (("/etc/NIXOS")
+ (getcwd))
+ (("config [+] '/bin/cargo'")
+ (string-append "'" (assoc-ref inputs "cargo-bootstrap")
+ "/bin/cargo'"))
+ (("cargo[(][)], \"build\"") "cargo(), \"build\", \"--verbose\""))
;; Rust uses a custom configure script (no autoconf).
- (zero? (apply system* "./configure" flags)))))
+ (let ((status (zero? (apply system* (which "sh") "./configure" flags))))
+ (substitute* "Makefile"
+ (("[$][(]Q[)][$][(]BOOTSTRAP[)] build [$][(]BOOTSTRAP_ARGS[)]")
+ "$(Q)$(BOOTSTRAP) build $(BOOTSTRAP_ARGS)"))
+ status))))
(add-after 'install 'wrap-rustc
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] Rust update
2017-09-12 16:50 [bug#28433] [WIP] Rust update Danny Milosavljevic
@ 2017-10-25 14:19 ` Ricardo Wurmus
2017-10-26 8:17 ` Danny Milosavljevic
2017-10-30 19:18 ` [bug#28433] [WIP] v2 " Danny Milosavljevic
1 sibling, 1 reply; 16+ messages in thread
From: Ricardo Wurmus @ 2017-10-25 14:19 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: 28433
Danny Milosavljevic <dannym@scratchpost.org> writes:
> I'm trying to update our Rust. I've got it to work further than the
> text "package bootstrap" once, but I can't find how I did it anymore.
> See below.
>
> Help?
Could you tell us what you’ve tried and what the error means?
--
Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] Rust update
2017-10-25 14:19 ` Ricardo Wurmus
@ 2017-10-26 8:17 ` Danny Milosavljevic
2017-10-28 10:42 ` Danny Milosavljevic
2017-10-28 15:36 ` ng0
0 siblings, 2 replies; 16+ messages in thread
From: Danny Milosavljevic @ 2017-10-26 8:17 UTC (permalink / raw)
To: Ricardo Wurmus; +Cc: 28433
Hi,
Rust as I posted it fails with the text below. It tries to compile and link rustc via bootstrap rustc and gcc, via a i686 compiler (also on x86_64). What the error message means is that it is only picking up the x86_64 glibc - and not the i686 glibc - even though the "cc" command line contains "-m32". I've even added a custom linker command to the rust config (also in the patch) but that doesn't help either - apparently that setting is not even picked up. Maybe that's the reason...
Rust has support for Nix somewhat, and I've enabled it in the bootstrapper. I've also added cross-libc for i686 and fixed up environment variables (in a hacky way - maybe that's the reason).
So I guess my actual question is how to do this cross compilation correctly. Note that the rust bootstrap compiler are binaries from upstream. (There's a project "mrust" <https://github.com/thepowersgang/mrustc> that is a reimplementation of Rust in C++ that we could use in the long term in order to remove this binary)
----------------------------------------------------------
Running `/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/bin/rustc --crate-name rustdoc src/bootstrap/bin/rustdoc.rs --crate-type bin --emit=dep-info,link -C
debug-assertions=off -C metadata=83218ce7652a40a2 -C extra-filename=-83218ce7652a40a2 --out-dir /tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps -L depe
ndency=/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps --extern rustc_serialize=/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/deb
ug/deps/librustc_serialize-5c8c719f8cb442df.rlib --extern getopts=/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libgetopts-781edef4d7eacd14.rlib --ex
tern gcc=/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libgcc-3c79a13fa356000a.rlib --extern libc=/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src
/build/bootstrap/debug/deps/liblibc-1ece201356dd0812.rlib --extern toml=/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libtoml-3495572d91ba2dfe.rlib -
-extern num_cpus=/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libnum_cpus-d81d39a56ecc4645.rlib --extern build_helper=/tmp/guix-build-rustc-1.18.0.d
rv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libbuild_helper-d1189496287db707.rlib --extern filetime=/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libfiletime-1fba24aeada37bf3.rlib --extern cmake=/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libcmake-4feacbf6844c5e86.rlib --extern bootstrap=/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libbootstrap-3ebfecab87ea2884.rlib`
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m32" "-L" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/rustdoc-83218ce7652a40a2.0.o" "-o" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/rustdoc-83218ce7652a40a2" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps" "-L" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libbootstrap-3ebfecab87ea2884.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libtoml-3495572d91ba2dfe.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/librustc_serialize-5c8
c719f8cb442df.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libnum_cpus-d81d39a56ecc4645.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libcmake-4feacbf6844c5e86.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libgcc-3c79a13fa356000a.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libbuild_helper-d1189496287db707.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libfiletime-1fba24aeada37bf3.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/liblibc-1ece201356dd0812.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libgetopts-781edef4d7eacd14.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/libstd-f4594d3e53dcb114.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq
-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/libpanic_unwind-a0157c0ca919c364.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/libunwind-488b4ab4bd53a138.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/librand-1efbcfd8938372b6.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/libcollections-532a3dbf317eff86.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/liballoc-ca07b617414dd0fa.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/liballoc_jemalloc-492d8ea7fa3384ff.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/liblibc-88c194c15fdb6521.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-ru
stc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/libstd_unicode-cfbd6648f7db2ee5.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/libcore-687e6a964d22cbb4.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/libcompiler_builtins-987729be881d4d32.rlib" "-l" "util" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util"
= note: ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/libutil.so when searching for -lutil
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/libutil.a when searching for -lutil
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/libutil.so when searching for -lutil
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/libutil.a when searching for -lutil
ld: cannot find -lutil
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/libdl.so when searching for -ldl
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/libdl.a when searching for -ldl
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/libdl.so when searching for -ldl
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/libdl.a when searching for -ldl
ld: cannot find -ldl
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/librt.so when searching for -lrt
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/librt.a when searching for -lrt
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/librt.so when searching for -lrt
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/librt.a when searching for -lrt
ld: cannot find -lrt
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/libpthread.so when searching for -lpthread
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/libpthread.a when searching for -lpthread
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/libpthread.so when searching for -lpthread
ld: skipping incompatible /gnu/store/n6nvxlk2j8ysffjh3jphn1k5silnakh6-glibc-2.25/lib/libpthread.a when searching for -lpthread
ld: cannot find -lpthread
ld: skipping incompatible /gnu/store/3x53yv4v144c9xp02rs64z7j597kkqax-gcc-5.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.4.0/../../../libgcc_s.so when searching for -lgcc_s
ld: cannot find -lgcc_s
----------------------------------------------------------
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] Rust update
2017-10-26 8:17 ` Danny Milosavljevic
@ 2017-10-28 10:42 ` Danny Milosavljevic
2017-10-28 11:31 ` Danny Milosavljevic
2017-10-28 15:36 ` ng0
1 sibling, 1 reply; 16+ messages in thread
From: Danny Milosavljevic @ 2017-10-28 10:42 UTC (permalink / raw)
To: Ricardo Wurmus; +Cc: 28433
Aha! I digged some more and found that rust-bootstrap doesn't specify #:system "i686-linux", while rustc-bootstrap does.
Symptom:
$ guix environment --pure rustc
[env]$ ls -l /gnu/store/15hcgm941wgxfk08w0wrwpd9p7wjbq87-profile/bin/cc
lrwxrwxrwx 2 root root 72 Jan 1 1970 /gnu/store/15hcgm941wgxfk08w0wrwpd9p7wjbq87-profile/bin/cc -> /gnu/store/a3gr3imzn6nqzs9q1ql0pilr0dnbpps4-rust-bootstrap-1.15.0/bin/cc
[env]$ file /gnu/store/a3gr3imzn6nqzs9q1ql0pilr0dnbpps4-rust-bootstrap-1.15.0/bin/cc
/gnu/store/a3gr3imzn6nqzs9q1ql0pilr0dnbpps4-rust-bootstrap-1.15.0/bin/cc: symbolic link to /gnu/store/8yxpqz65fgvcab60ypih009xv777ni66-gcc-5.4.0/bin/gcc
[env]$ file /gnu/store/8yxpqz65fgvcab60ypih009xv777ni66-gcc-5.4.0/bin/gcc
/gnu/store/8yxpqz65fgvcab60ypih009xv777ni66-gcc-5.4.0/bin/gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /gnu/store/3h31zsqxjjg52da5gp3qmhkh4x8klhah-glibc-2.25/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped, with debug_info
Note "x86-64".
On the other hand:
[env]$ file -L /gnu/store/15hcgm941wgxfk08w0wrwpd9p7wjbq87-profile/bin/rustc
/gnu/store/15hcgm941wgxfk08w0wrwpd9p7wjbq87-profile/bin/rustc: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /gnu/store/kzkgc8avgnanrv3ab2g3g8yj7l4bcavj-glibc-2.25/lib/ld-linux.so.2, for GNU/Linux 2.6.9, not stripped, with debug_info
[env]$ file -L /gnu/store/kzkgc8avgnanrv3ab2g3g8yj7l4bcavj-glibc-2.25/lib/ld-linux.so.2
/gnu/store/kzkgc8avgnanrv3ab2g3g8yj7l4bcavj-glibc-2.25/lib/ld-linux.so.2: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped, with debug_info
Note "32-bit", "80386".
But when I change rust-bootstrap to specify #:system "i686-linux", then I get:
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m32" "-L" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/rustc-f53d5ba9fb00bcc2.0.o" "-o" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/rustc-f53d5ba9fb00bcc2" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps" "-L" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libbootstrap-3ebfecab87ea2884.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libtoml-3495572d91ba2dfe.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/librustc_serialize-5c8c719
f8cb442df.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libnum_cpus-d81d39a56ecc4645.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libcmake-4feacbf6844c5e86.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libgcc-3c79a13fa356000a.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libbuild_helper-d1189496287db707.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libfiletime-1fba24aeada37bf3.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/liblibc-1ece201356dd0812.rlib" "/tmp/guix-build-rustc-1.18.0.drv-0/rustc-1.18.0-src/build/bootstrap/debug/deps/libgetopts-781edef4d7eacd14.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/libstd-f4594d3e53dcb114.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rus
tc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/libpanic_unwind-a0157c0ca919c364.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/libunwind-488b4ab4bd53a138.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/librand-1efbcfd8938372b6.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/libcollections-532a3dbf317eff86.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/liballoc-ca07b617414dd0fa.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/liballoc_jemalloc-492d8ea7fa3384ff.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/liblibc-88c194c15fdb6521.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-
bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/libstd_unicode-cfbd6648f7db2ee5.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/libcore-687e6a964d22cbb4.rlib" "/gnu/store/zmcc9gizicl91qvpcnl7ric2klnqhsdq-rustc-bootstrap-1.17.0/lib/rustlib/i686-unknown-linux-gnu/lib/libcompiler_builtins-987729be881d4d32.rlib" "-l" "util" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util"
= note: ld: /gnu/store/w8swvn15kqzzl3q5d0d9zjnhg5pk9ksw-gcc-5.4.0/libexec/gcc/i686-unknown-linux-gnu/5.4.0/liblto_plugin.so: error loading plugin: /gnu/store/w8swvn15kqzzl3q5d0d9zjnhg5pk9ksw-gcc-5.4.0/libexec/gcc/i686-unknown-linux-gnu/5.4.0/liblto_plugin.so: wrong ELF class: ELFCLASS32
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] Rust update
2017-10-28 10:42 ` Danny Milosavljevic
@ 2017-10-28 11:31 ` Danny Milosavljevic
2017-10-28 11:57 ` Danny Milosavljevic
0 siblings, 1 reply; 16+ messages in thread
From: Danny Milosavljevic @ 2017-10-28 11:31 UTC (permalink / raw)
To: Ricardo Wurmus; +Cc: 28433
And gcc picks up ld from PATH, which is a x86_64 ld. Bad.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] Rust update
2017-10-28 11:31 ` Danny Milosavljevic
@ 2017-10-28 11:57 ` Danny Milosavljevic
2017-10-28 18:26 ` Ludovic Courtès
0 siblings, 1 reply; 16+ messages in thread
From: Danny Milosavljevic @ 2017-10-28 11:57 UTC (permalink / raw)
To: Ricardo Wurmus; +Cc: 28433
Do we support lib32 a la "gcc -m32" ? How can we provide a working glibc for that? It seems that rustc bootstrap is trying to use that option.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] Rust update
2017-10-26 8:17 ` Danny Milosavljevic
2017-10-28 10:42 ` Danny Milosavljevic
@ 2017-10-28 15:36 ` ng0
2017-10-28 18:32 ` Ludovic Courtès
1 sibling, 1 reply; 16+ messages in thread
From: ng0 @ 2017-10-28 15:36 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: Ricardo Wurmus, 28433
[-- Attachment #1: Type: text/plain, Size: 777 bytes --]
Danny Milosavljevic transcribed 8.7K bytes:
> Hi,
…
> So I guess my actual question is how to do this cross compilation correctly.
Note that the rust bootstrap compiler are binaries from upstream.
(There's a project "mrust" <https://github.com/thepowersgang/mrustc>
that is a reimplementation of Rust in C++ that we could use in the long
term in order to remove this binary)
In the long term this would be nice. It was my first idea when
I learned about this project, but as you can read in the
bug I opened in the last 2(?) months in the mrustc bugtracker
it still requires rustc to work.
--
ng0
GnuPG: A88C8ADD129828D7EAC02E52E22F9BBFEE348588
GnuPG: https://dist.ng0.infotropique.org/dist/keys/
https://www.infotropique.org https://ng0.infotropique.org
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] Rust update
2017-10-28 11:57 ` Danny Milosavljevic
@ 2017-10-28 18:26 ` Ludovic Courtès
2017-10-30 11:35 ` Danny Milosavljevic
0 siblings, 1 reply; 16+ messages in thread
From: Ludovic Courtès @ 2017-10-28 18:26 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: Ricardo Wurmus, 28433
Hi,
Danny Milosavljevic <dannym@scratchpost.org> skribis:
> Do we support lib32 a la "gcc -m32" ? How can we provide a working glibc for that? It seems that rustc bootstrap is trying to use that option.
We don’t support multilib, so glibc provides only 64-bit headers on
x86_64 (if you try -m32 there you’ll get an error about missing
<gnu/stubs-32.h> or something like that.)
Ludo’.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] Rust update
2017-10-28 15:36 ` ng0
@ 2017-10-28 18:32 ` Ludovic Courtès
0 siblings, 0 replies; 16+ messages in thread
From: Ludovic Courtès @ 2017-10-28 18:32 UTC (permalink / raw)
To: ng0; +Cc: Ricardo Wurmus, 28433
ng0 <ng0@infotropique.org> skribis:
> (There's a project "mrust" <https://github.com/thepowersgang/mrustc>
> that is a reimplementation of Rust in C++ that we could use in the long
> term in order to remove this binary)
At GPCE I also talked with someone who implements a compiler for a
Rust-like language (Rust with some extensions, minus a few features, so
not directly usable but might be worth keeping in mind):
https://github.com/AnyDSL/traversal
Ludo’.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] Rust update
2017-10-28 18:26 ` Ludovic Courtès
@ 2017-10-30 11:35 ` Danny Milosavljevic
2017-10-30 15:38 ` Ludovic Courtès
0 siblings, 1 reply; 16+ messages in thread
From: Danny Milosavljevic @ 2017-10-30 11:35 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: Ricardo Wurmus, 28433
On Sat, 28 Oct 2017 20:26:39 +0200
ludo@gnu.org (Ludovic Courtès) wrote:
> Danny Milosavljevic <dannym@scratchpost.org> skribis:
>
> > Do we support lib32 a la "gcc -m32" ? How can we provide a working glibc for that? It seems that rustc bootstrap is trying to use that option.
>
> We don’t support multilib, so glibc provides only 64-bit headers on
> x86_64 (if you try -m32 there you’ll get an error about missing
> <gnu/stubs-32.h> or something like that.)
Yeah.
What happens when I use an i686 host/target gcc and use "-m32" (rustbuild does that)? Will it just ignore the option?
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] Rust update
2017-10-30 11:35 ` Danny Milosavljevic
@ 2017-10-30 15:38 ` Ludovic Courtès
2017-10-30 16:14 ` Danny Milosavljevic
0 siblings, 1 reply; 16+ messages in thread
From: Ludovic Courtès @ 2017-10-30 15:38 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: Ricardo Wurmus, 28433
Danny Milosavljevic <dannym@scratchpost.org> skribis:
> On Sat, 28 Oct 2017 20:26:39 +0200
> ludo@gnu.org (Ludovic Courtès) wrote:
>
>> Danny Milosavljevic <dannym@scratchpost.org> skribis:
>>
>> > Do we support lib32 a la "gcc -m32" ? How can we provide a working glibc for that? It seems that rustc bootstrap is trying to use that option.
>>
>> We don’t support multilib, so glibc provides only 64-bit headers on
>> x86_64 (if you try -m32 there you’ll get an error about missing
>> <gnu/stubs-32.h> or something like that.)
>
> Yeah.
>
> What happens when I use an i686 host/target gcc and use "-m32" (rustbuild does that)? Will it just ignore the option?
Yes, I think -m32 is a no-op in this case.
Ludo’.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] Rust update
2017-10-30 15:38 ` Ludovic Courtès
@ 2017-10-30 16:14 ` Danny Milosavljevic
2017-11-28 6:35 ` ng0
0 siblings, 1 reply; 16+ messages in thread
From: Danny Milosavljevic @ 2017-10-30 16:14 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: Ricardo Wurmus, 28433
Hi Ludo,
> Yes, I think -m32 is a no-op in this case.
Yep. I just got rustc to build a bootstrap executable (which fails when executing it [*], but hey, progress) by making a union-build with all the i686 libs.
Feels kinda icky, but it seems that propagated-inputs don't remember the #:system it was for, so for example if A propagates B and A specifies system i686, and X specifies system x86_64 and X depends on A, then X's B will be x86_64. Weird but understandable I guess...
Details:
A:
propagated-inputs
B
arguments system i686
X:
native-inputs
A
arguments system x86_64
Now X's B is x86_64...
The workaround is this:
A:
arguments system i686
native-inputs
B
union-build out/lib from B (etc)
X:
native-inputs
A
arguments system x86_64
That works.
In our specific case A = "rust-bootstrap", X = "rustc", B = "glibc", "gcc:lib" etc.
[*] Tries to load libgcc_s.so.1 from the glibc store directory. WTF?
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] v2 Rust update
2017-09-12 16:50 [bug#28433] [WIP] Rust update Danny Milosavljevic
2017-10-25 14:19 ` Ricardo Wurmus
@ 2017-10-30 19:18 ` Danny Milosavljevic
1 sibling, 0 replies; 16+ messages in thread
From: Danny Milosavljevic @ 2017-10-30 19:18 UTC (permalink / raw)
To: 28433
[-- Attachment #1: Type: text/plain, Size: 3454 bytes --]
New patch (relative to master) attached. Result:
...
Compiling bootstrap v0.0.0 (file:///tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/src/bootstrap)
...
Running `/gnu/store/vqqyfd20cci8ngffx8ip30xj1zghj3d3-rustc-bootstrap-1.20.0/bin/rustc --crate-name rustdoc src/bootstrap/bin/rustdoc.rs --crate-type bin --emit=dep-info,link -C debug-assertions=off -C overflow-checks=on -C metadata=be82d62669cb1c84 -C extra-filename=-be82d62669cb1c84 --out-dir /tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/deps -L dependency=/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/deps --extern serde=/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/deps/libserde-632d9b22ceaaf392.rlib --extern getopts=/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/deps/libgetopts-3bd92ee3d46aec42.rlib --extern filetime=/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/deps/libfiletime-c92abda52111c8f6.rlib --extern lazy_static=/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/deps/liblazy_static-2aedc8916caa605d.rlib --ex
tern cmake=/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/deps/libcmake-cb4e4459aab5227f.rlib --extern build_helper=/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/deps/libbuild_helper-a3d8a479aaa255b5.rlib --extern toml=/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/deps/libtoml-9a87f4f0395599e4.rlib --extern gcc=/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/deps/libgcc-f472059c4232400f.rlib --extern serde_derive=/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/deps/libserde_derive-46fcba9d518ff59d.so --extern serde_json=/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/deps/libserde_json-d578450b81b0fe32.rlib --extern num_cpus=/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/deps/libnum_cpus-c524032e97e252a3.rlib --extern libc=/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/de
ps/liblibc-785194da5730896d.rlib --extern bootstrap=/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/deps/libbootstrap-5489136beef8bcf0.rlib`
Finished dev [unoptimized] target(s) in 95.84 secs
running: /tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/bootstrap build -v
/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/bootstrap: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/src/bootstrap/bootstrap.py", line 816, in <module>
main()
File "/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/src/bootstrap/bootstrap.py", line 799, in main
bootstrap()
File "/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/src/bootstrap/bootstrap.py", line 790, in bootstrap
run(args, env=env, verbose=build.verbose)
File "/tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/src/bootstrap/bootstrap.py", line 148, in run
raise RuntimeError(err)
RuntimeError: failed to run: /tmp/guix-build-rustc-1.21.0.drv-0/rustc-1.21.0-src/build/bootstrap/debug/bootstrap build -v
make: *** [Makefile:24: all] Error 1
phase `build' failed after 96.3 seconds
[-- Attachment #2: RUST --]
[-- Type: application/octet-stream, Size: 11931 bytes --]
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 652686e06..5bbb34ba5 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -25,6 +25,7 @@
#:use-module (gnu packages bootstrap)
#:use-module (gnu packages cmake)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages cross-base)
#:use-module (gnu packages curl)
#:use-module (gnu packages elf)
#:use-module (gnu packages flex)
@@ -47,7 +48,7 @@
#:use-module (srfi srfi-26))
;; Should be one less than the current released version.
-(define %rust-bootstrap-binaries-version "1.15.0")
+(define %rust-bootstrap-binaries-version "1.20.0")
(define %rust-bootstrap-binaries
(origin
@@ -58,7 +59,7 @@
"-i686-unknown-linux-gnu.tar.gz"))
(sha256
(base32
- "0wmkfx8pxmkkw021mrq9s3xhra8f0daqdl6j56pxyn4w39i0rzrw"))))
+ "0s26n5pgwr0w0fpy4dfszahlkpah414bxpanrbyc5k8ncvh95rdb"))))
(define (increment-rust-version rust-version major patch)
(match (string-split rust-version #\.)
@@ -78,7 +79,7 @@
;; a stability or security fix. 1.11.0 -> 1.12.1 -> 1.13.0
(increment-rust-version bootstrap-version 1 patch))
-(define rustc-bootstrap
+(define-public rustc-bootstrap
(package
(name "rustc-bootstrap")
(version %rust-bootstrap-binaries-version)
@@ -168,7 +169,7 @@ which can in turn be used to build the final Rust compiler.")
manager, which is required to build itself.")
(license license:asl2.0)))
-(define rust-bootstrap
+(define-public rust-bootstrap
(package
(name "rust-bootstrap")
(version %rust-bootstrap-binaries-version)
@@ -177,20 +178,39 @@ manager, which is required to build itself.")
(propagated-inputs
`(("rustc-bootstrap" ,rustc-bootstrap)
("cargo-bootstrap" ,cargo-bootstrap)
- ("gcc" ,(canonical-package gcc))))
+ ("gcc" ,(canonical-package gcc))
+ ("gcc:lib" ,(canonical-package gcc) "lib")
+ ("binutils" ,binutils))) ; for ld.
+ (native-inputs
+ `(("glibc" ,glibc)))
(arguments
- `(#:modules ((guix build utils))
+ `(#:modules ((guix build utils) (guix build union))
+ #:system "i686-linux"
+ ;#:implicit-inputs? #f
#:builder
(begin
(use-modules (guix build utils))
+ (use-modules (guix build union))
(let ((out (assoc-ref %outputs "out"))
- (gcc (assoc-ref %build-inputs "gcc")))
+ (gcc (assoc-ref %build-inputs "gcc"))
+ (gcc:lib (assoc-ref %build-inputs "gcc:lib"))
+ (glibc (assoc-ref %build-inputs "glibc"))
+ (binutils (assoc-ref %build-inputs "binutils")))
(mkdir-p (string-append out "/bin"))
+ ;(mkdir-p (string-append out "/lib"))
;; Rust requires a C toolchain for linking. The prebuilt
;; binaries expect a compiler called cc. Thus symlink gcc
;; to cc.
(symlink (string-append gcc "/bin/gcc")
- (string-append out "/bin/cc"))))))
+ (string-append out "/bin/cc"))
+ ;; cc invokes "ld". Provide it.
+ (symlink (string-append binutils "/bin/ld")
+ (string-append out "/bin/ld"))
+ (union-build (string-append out "/lib")
+ (list (string-append glibc "/lib")
+ (string-append gcc:lib "/lib")))
+ ;(system "chmod" "+x" (string-append out "/lib/libgcc_s.so.1"))
+ ))))
(home-page "https://www.rust-lang.org")
(synopsis "Rust bootstrapping meta package")
(description "Meta package for a rust environment. Provides pre-compiled
@@ -208,7 +228,7 @@ rustc-bootstrap and cargo-bootstrap packages.")
"rustc-" version "-src.tar.gz"))
(sha256
(base32
- "1d78jq7mc34n265by68amr9r4nzbiqrilfbwh7gx56ydn4gb6rpr"))
+ "1yj8lnxybjrybp00fqhxw8fpr641dh8wcn9mk44xjnsb4i1c21qp"))
(modules '((guix build utils)))
(snippet
`(begin
@@ -217,21 +237,35 @@ rustc-bootstrap and cargo-bootstrap packages.")
(build-system gnu-build-system)
(native-inputs
`(("bison" ,bison) ; For the tests
+ ("tar" ,tar) ; used to be implicit
+ ("xz" ,xz) ; used to be implicit
("cmake" ,cmake)
("flex" ,flex) ; For the tests
("git" ,git)
("procps" ,procps) ; For the tests
("python-2" ,python-2)
+ ("cargo-bootstrap" ,cargo-bootstrap)
("rust-bootstrap" ,rust-bootstrap)
- ("which" ,which)))
+ ("which" ,which)
+ ("strace" ,strace)
+ ;("cross-gcc" ,(cross-gcc "i686-linux-gnu"
+ ; #:xbinutils (cross-binutils "i686-linux-gnu")
+ ; #:libc (cross-libc "i686-linux-gnu")))
+ ;("cross-libc" ,(cross-libc "i686-linux-gnu"))
+ ))
(inputs
`(("jemalloc" ,jemalloc)
("llvm" ,llvm-3.9.1)))
(arguments
- `(#:phases
+ `( ;#:implicit-inputs? #f
+ #:phases
(modify-phases %standard-phases
+ ;; Avoid cargo complaining about mismatched checksums.
+ (delete 'patch-source-shebangs)
+ (delete 'patch-generated-file-shebangs)
+ (delete 'patch-usr-bin-file)
(add-after 'unpack 'patch-configure
- (lambda _
+ (lambda* (#:key inputs #:allow-other-keys)
(substitute* "configure"
(("/usr/bin/env") (which "env")) ; Detect target CPU correctly.
(("probe_need CFG_CURL curl") "") ; Avoid curl build dependency.
@@ -247,14 +281,47 @@ rustc-bootstrap and cargo-bootstrap packages.")
(substitute* "src/tools/compiletest/src/util.rs"
(("(\"amd64\", \"x86_64\"),") "(\"amd64\", \"x86_64\"),
(\"nvptx\", \"nvptx\"),")) ; Make LLVM >= 3.8.1 work.
- (substitute* "mk/main.mk"
- (("LLVM_OPTIONAL_COMPONENTS=")
- "LLVM_OPTIONAL_COMPONENTS=nvptx ")) ; Make LLVM >= 3.8.1 work.
+ ;(system* "mv" "src/bootstrap/config.toml.example"
+ ; "src/bootstrap/config.toml")
+ (mkdir-p "src/bootstrap/.cargo")
+ (call-with-output-file "src/bootstrap/.cargo/config"
+ (lambda (p)
+ (format p "
+[source.crates-io]
+registry = 'https://github.com/rust-lang/crates.io-index'
+replace-with = 'vendored-sources'
+
+[source.vendored-sources]
+directory = 'src/vendor'
+
+[target.i686-linux-gnu]
+linker = \"~a/bin/i686-linux-gnu-gcc\"
+
+" (assoc-ref inputs "cross-gcc"))))
+
#t))
(add-after 'unpack 'set-env
- (lambda _
+ (lambda* (#:key inputs #:allow-other-keys)
+ (define (cross? x)
+ (string-contains x "cross-"))
(setenv "SHELL" (which "sh"))
(setenv "CONFIG_SHELL" (which "sh"))
+ (setenv "VERBOSE" "1")
+ (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
+ (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
+ (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
+ ;(setenv "PATH" (string-append (assoc-ref inputs "rust-bootstrap") "/bin:" (getenv "PATH")))
+ (for-each
+ (lambda (env-name)
+ (let* ((env-value (getenv env-name))
+ (search-path (search-path-as-string->list env-value))
+ (new-search-path (filter (lambda (e) (not (cross? e)))
+ search-path))
+ (new-env-value (list->search-path-as-string
+ new-search-path ":")))
+ (setenv env-name new-env-value)))
+ '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH" "LIBRARY_PATH"))
+
#t))
(add-after 'unpack 'patch-tests
(lambda* (#:key inputs #:allow-other-keys)
@@ -284,6 +351,7 @@ fn test_process_mask"))
(rustc (assoc-ref inputs "rustc-bootstrap"))
(llvm (assoc-ref inputs "llvm"))
(jemalloc (assoc-ref inputs "jemalloc"))
+ ;; TODO make bootstrapper use i686 libraries! (-lutil, -ldl, ...).
(flags (list
(string-append "--prefix=" out)
(string-append "--datadir=" out "/share")
@@ -291,16 +359,48 @@ fn test_process_mask"))
(string-append "--default-linker=" gcc "/bin/gcc")
(string-append "--default-ar=" binutils "/bin/ar")
(string-append "--python=" python "/bin/python2")
+ ; FIXME /gnu/store/6rri0kxb9q1gz6lv1dgdwjh41aa9ijdl-rustc-bootstrap-1.17.0/bin/cargo is wrong.
(string-append "--local-rust-root=" rustc)
(string-append "--llvm-root=" llvm)
(string-append "--jemalloc-root=" jemalloc "/lib")
"--release-channel=stable"
"--enable-rpath"
"--enable-local-rust"
- "--disable-rustbuild" ; rustbuild doesn't work yet.
- "--disable-manage-submodules")))
+ "--disable-manage-submodules"
+ ; "--enable-extended" ; FIXME
+ "--disable-sanitizers" ; FIXME re-enable
+ "--build=x86_64-unknown-linux-gnu"
+ ;"--enable-full-bootstrap"
+ )))
+ (mkdir "Xcargo")
+ (call-with-output-file "Xcargo/config"
+ (lambda (p)
+ (format p "
+[source.crates-io]
+registry = 'https://github.com/rust-lang/crates.io-index'
+replace-with = 'vendored-sources'
+
+[source.vendored-sources]
+directory = 'src/vendor'
+
+[target.i686-linux-gnu]
+linker = \"~a/bin/i686-linux-gnu-gcc\"
+
+" (assoc-ref inputs "cross-gcc"))))
+ (setenv "CARGO_HOME" (string-append (getcwd) "/Xcargo"))
+ (substitute* "src/bootstrap/bootstrap.py"
+ (("/etc/NIXOS")
+ (getcwd))
+ (("self[.]program_config[(]'cargo'[)]")
+ (string-append "'" (assoc-ref inputs "cargo-bootstrap")
+ "/bin/cargo'"))
+ (("cargo[(][)], \"build\"") "cargo(), \"build\", \"--verbose\""))
;; Rust uses a custom configure script (no autoconf).
- (zero? (apply system* "./configure" flags)))))
+ (let ((status (zero? (apply system* (which "sh") "./configure" flags))))
+ (substitute* "Makefile"
+ (("[$][(]Q[)][$][(]BOOTSTRAP[)] build [$][(]BOOTSTRAP_ARGS[)]")
+ "$(Q)$(BOOTSTRAP) build $(BOOTSTRAP_ARGS)"))
+ status))))
(add-after 'install 'wrap-rustc
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
@@ -333,7 +433,7 @@ safety and thread safety guarantees.")
(file-name (string-append name "-" version ".tar.gz"))
(sha256
(base32
- "1y0zy8gk1ly0wh57y78fisk7cdd92qk0x7z664f6l7lzl2krqs7w"))))
+ "1y1zy8gk1ly0wh57y78fisk7cdd92qk0x7z664f6l7lzl2krqs7w"))))
(build-system cargo-build-system)
(propagated-inputs
`(("cmake" ,cmake)
@@ -899,6 +999,7 @@ replace-with = 'vendored-sources'
directory = 'vendor'
")))
(setenv "CMAKE_C_COMPILER" cc)
+ ;; TODO CC_i686_unknown_linux_gnu=gcc
(setenv "CC" cc))
#t))
(delete 'configure))))
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] Rust update
2017-10-30 16:14 ` Danny Milosavljevic
@ 2017-11-28 6:35 ` ng0
2017-11-28 10:12 ` Danny Milosavljevic
2017-11-29 8:04 ` Danny Milosavljevic
0 siblings, 2 replies; 16+ messages in thread
From: ng0 @ 2017-11-28 6:35 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: Ricardo Wurmus, 28433
[-- Attachment #1: Type: text/plain, Size: 1580 bytes --]
Hey Danny,
what's missing here? rustc has been released as 1.22.1 since this thread
started. I hope to introduce some people in January at our GNUnet
workshop to the open tasks on the Guix rust-build-system and - depending
on how they judge their own abilities - get them to work on this throughout
the year.
Danny Milosavljevic transcribed 0.9K bytes:
> Hi Ludo,
>
> > Yes, I think -m32 is a no-op in this case.
>
> Yep. I just got rustc to build a bootstrap executable (which fails when executing it [*], but hey, progress) by making a union-build with all the i686 libs.
>
> Feels kinda icky, but it seems that propagated-inputs don't remember the #:system it was for, so for example if A propagates B and A specifies system i686, and X specifies system x86_64 and X depends on A, then X's B will be x86_64. Weird but understandable I guess...
>
> Details:
>
> A:
> propagated-inputs
> B
> arguments system i686
>
> X:
> native-inputs
> A
> arguments system x86_64
>
> Now X's B is x86_64...
>
> The workaround is this:
>
> A:
> arguments system i686
> native-inputs
> B
> union-build out/lib from B (etc)
>
> X:
> native-inputs
> A
> arguments system x86_64
>
> That works.
>
> In our specific case A = "rust-bootstrap", X = "rustc", B = "glibc", "gcc:lib" etc.
>
> [*] Tries to load libgcc_s.so.1 from the glibc store directory. WTF?
>
>
>
>
--
GnuPG: A88C8ADD129828D7EAC02E52E22F9BBFEE348588
GnuPG: https://c.n0.is/ng0_pubkeys/tree/keys
WWW: https://n0.is
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] Rust update
2017-11-28 6:35 ` ng0
@ 2017-11-28 10:12 ` Danny Milosavljevic
2017-11-29 8:04 ` Danny Milosavljevic
1 sibling, 0 replies; 16+ messages in thread
From: Danny Milosavljevic @ 2017-11-28 10:12 UTC (permalink / raw)
To: ng0; +Cc: Ricardo Wurmus, 28433
[-- Attachment #1: Type: text/plain, Size: 2101 bytes --]
Hi ng0,
I've attached the current version of gnu/packages/rust.scm .
For some reason, Rust bootstrap ignores the environment variable AR_x86_64_unknown_linux_gnu even though it doesn't ignore other similar variables (CC_x86_64_unknown_linux_gnu etc). It also ignored config.toml's [target.x86_64-unknown-linux-gnu]. Therefore, the bootstrapping fails when trying to compile the x86_64 version (the i686 version works).
To try it, copy the attached file to gnu/packages/rust.scm , overwriting the latter file.
Then just invoke
$ ./pre-inst-env guix build rustc
It will fail like explained above, with the log message:
------------------------------------------------------------------------------------------------------
running: /tmp/guix-build-rustc-1.22.0.drv-0/rustc-1.22.0-src/build/bootstrap/debug/bootstrap build -v
finding compilers
CC_x86_64-unknown-linux-gnu = "/gnu/store/5sv5zy2kgg6iaqyv8zw49w4243j0xkd0-gcc-5.4.0/bin/gcc"
AR_x86_64-unknown-linux-gnu = "/gnu/store/5sv5zy2kgg6iaqyv8zw49w4243j0xkd0-gcc-5.4.0/bin/ar"
CC_x86_64-unknown-linux-gnu = "/gnu/store/5sv5zy2kgg6iaqyv8zw49w4243j0xkd0-gcc-5.4.0/bin/gcc"
AR_x86_64-unknown-linux-gnu = "/gnu/store/5sv5zy2kgg6iaqyv8zw49w4243j0xkd0-gcc-5.4.0/bin/ar"
CC_x86_64-unknown-linux-gnu = "/gnu/store/5sv5zy2kgg6iaqyv8zw49w4243j0xkd0-gcc-5.4.0/bin/gcc"
AR_x86_64-unknown-linux-gnu = "/gnu/store/5sv5zy2kgg6iaqyv8zw49w4243j0xkd0-gcc-5.4.0/bin/ar"
CXX_x86_64-unknown-linux-gnu = "/gnu/store/5sv5zy2kgg6iaqyv8zw49w4243j0xkd0-gcc-5.4.0/bin/g++"
CXX_x86_64-unknown-linux-gnu = "/gnu/store/5sv5zy2kgg6iaqyv8zw49w4243j0xkd0-gcc-5.4.0/bin/g++"
running sanity check
thread 'main' panicked at '
couldn't find required command: "/gnu/store/5sv5zy2kgg6iaqyv8zw49w4243j0xkd0-gcc-5.4.0/bin/ar"
------------------------------------------------------------------------------------------------------
I've had something similar before - see CFG_LOCAL_RUST_ROOT substitution in rust.scm - but I thought I fixed it.
So the next step would have someone find out why it doesn't pick up the value from the environment variable "AR_x86_64_unknown_linux_gnu".
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: rust.scm --]
[-- Type: text/x-scheme, Size: 41747 bytes --]
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2016 Eric Le Bihan <eric.le.bihan.dev@free.fr>
;;; Copyright © 2016 ng0 <ng0@libertad.pw>
;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages rust)
#:use-module (gnu packages base)
#:use-module (gnu packages bison)
#:use-module (gnu packages bootstrap)
#:use-module (gnu packages cmake)
#:use-module (gnu packages compression)
#:use-module (gnu packages cross-base)
#:use-module (gnu packages curl)
#:use-module (gnu packages elf)
#:use-module (gnu packages flex)
#:use-module (gnu packages gcc)
#:use-module (gnu packages jemalloc)
#:use-module (gnu packages linux)
#:use-module (gnu packages llvm)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
#:use-module (gnu packages ssh)
#:use-module (gnu packages tls)
#:use-module (gnu packages version-control)
#:use-module (guix build-system cargo)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
#:use-module (guix download)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (ice-9 match)
#:use-module (srfi srfi-26))
;; Should be one less than the current released version.
(define %rust-bootstrap-binaries-version "1.21.0")
(define %rust-bootstrap-binaries
(origin
(method url-fetch)
(uri (string-append
"https://static.rust-lang.org/dist/"
"rust-" %rust-bootstrap-binaries-version
"-i686-unknown-linux-gnu.tar.gz"))
(sha256
(base32
"1vnvqwz30hvyjcfr1f602lg43v2vlqjr3yhb5vr8xnrcc07yvjmp"))))
(define (increment-rust-version rust-version major patch)
(match (string-split rust-version #\.)
(("1" minor _)
(string-append (number->string major) "."
(number->string (+ (string->number minor) 1)) "."
(number->string patch)))))
(define* (cargo-version rustc-version #:optional (patch 0))
;; Computes the cargo version that matches the rustc version.
;; https://github.com/rust-lang/cargo#Releases
(increment-rust-version rustc-version 0 patch))
(define* (rustc-version bootstrap-version #:optional (patch 0))
;; Computes the rustc version that can be compiled from a given
;; other rustc version. The patch argument is for selecting
;; a stability or security fix. 1.11.0 -> 1.12.1 -> 1.13.0
(increment-rust-version bootstrap-version 1 patch))
(define-public rustc-bootstrap
(package
(name "rustc-bootstrap")
(version %rust-bootstrap-binaries-version)
(source %rust-bootstrap-binaries)
(build-system gnu-build-system)
(native-inputs
`(("patchelf" ,patchelf)))
(inputs
`(("gcc:lib" ,(canonical-package gcc) "lib")
("zlib" ,zlib)))
(arguments
`(#:tests? #f
#:strip-binaries? #f
#:system "i686-linux"
#:phases
(modify-phases %standard-phases
(delete 'configure)
(delete 'build)
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(gcc:lib (assoc-ref inputs "gcc:lib"))
(libc (assoc-ref inputs "libc"))
(zlib (assoc-ref inputs "zlib"))
(ld-so (string-append libc
,(glibc-dynamic-linker "i686-linux")))
(rpath (string-append out "/lib:" zlib "/lib:"
libc "/lib:" gcc:lib "/lib"))
(rustc (string-append out "/bin/rustc"))
(rustdoc (string-append out "/bin/rustdoc")))
(system* "bash" "install.sh"
(string-append "--prefix=" out)
(string-append "--components=rustc,"
"rust-std-i686-unknown-linux-gnu"))
(for-each (lambda (file)
(system* "patchelf" "--set-rpath" rpath file))
(cons* rustc rustdoc (find-files out "\\.so$")))
(for-each (lambda (file)
(system* "patchelf" "--set-interpreter" ld-so file))
(list rustc rustdoc))))))))
(supported-systems '("i686-linux" "x86_64-linux"))
(home-page "https://www.rust-lang.org")
(synopsis "Prebuilt rust compiler")
(description "This package provides a pre-built @command{rustc} compiler,
which can in turn be used to build the final Rust compiler.")
(license license:asl2.0)))
(define cargo-bootstrap
(package
(name "cargo-bootstrap")
(version (cargo-version %rust-bootstrap-binaries-version))
(source %rust-bootstrap-binaries)
(build-system gnu-build-system)
(native-inputs
`(("patchelf" ,patchelf)))
(inputs
`(("gcc:lib" ,(canonical-package gcc) "lib")))
(arguments
`(#:tests? #f
#:strip-binaries? #f
#:system "i686-linux"
#:phases
(modify-phases %standard-phases
(delete 'configure)
(delete 'build)
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(gcc:lib (assoc-ref inputs "gcc:lib"))
(libc (assoc-ref inputs "libc"))
(ld-so (string-append libc
,(glibc-dynamic-linker "i686-linux")))
(rpath (string-append out "/lib:" libc "/lib:"
gcc:lib "/lib"))
(cargo (string-append out "/bin/cargo")))
(system* "bash" "install.sh"
(string-append "--prefix=" out)
"--components=cargo")
(system* "patchelf"
"--set-interpreter" ld-so
"--set-rpath" rpath
cargo)))))))
(supported-systems '("i686-linux" "x86_64-linux"))
(home-page "https://www.rust-lang.org")
(synopsis "Prebuilt cargo package manager")
(description "This package provides a pre-built @command{cargo} package
manager, which is required to build itself.")
(license license:asl2.0)))
(define-public rust-bootstrap
(package
(name "rust-bootstrap")
(version %rust-bootstrap-binaries-version)
(source #f)
(build-system trivial-build-system)
(propagated-inputs
`(("rustc-bootstrap" ,rustc-bootstrap)
("cargo-bootstrap" ,cargo-bootstrap)
("gcc" ,(canonical-package gcc))
("gcc:lib" ,(canonical-package gcc) "lib")
("binutils" ,binutils))) ; for ld.
(native-inputs
`(("glibc" ,glibc)))
(native-search-paths
(list (search-path-specification
(variable "LD_LIBRARY_PATH")
(files '("lib")))))
(arguments
`(#:modules ((guix build utils) (guix build union))
#:system "i686-linux"
;#:implicit-inputs? #f
#:builder
(begin
(use-modules (guix build utils))
(use-modules (guix build union))
(let ((out (assoc-ref %outputs "out"))
(gcc (assoc-ref %build-inputs "gcc"))
(gcc:lib (assoc-ref %build-inputs "gcc:lib"))
(glibc (assoc-ref %build-inputs "glibc"))
(binutils (assoc-ref %build-inputs "binutils")))
(mkdir-p (string-append out "/bin"))
;(mkdir-p (string-append out "/lib"))
;; Rust requires a C toolchain for linking. The prebuilt
;; binaries expect a compiler called cc. Thus symlink gcc
;; to cc.
(symlink (string-append gcc "/bin/gcc")
(string-append out "/bin/cc"))
;; cc invokes "ld". Provide it.
(symlink (string-append binutils "/bin/ld")
(string-append out "/bin/ld"))
(union-build (string-append out "/lib")
(list (string-append glibc "/lib")
(string-append gcc:lib "/lib")))
;(system "chmod" "+x" (string-append out "/lib/libgcc_s.so.1"))
))))
(home-page "https://www.rust-lang.org")
(synopsis "Rust bootstrapping meta package")
(description "Meta package for a rust environment. Provides pre-compiled
rustc-bootstrap and cargo-bootstrap packages.")
(license license:asl2.0)))
(define-public rustc
(package
(name "rustc")
(version (rustc-version %rust-bootstrap-binaries-version))
(source (origin
(method url-fetch)
(uri (string-append
"https://static.rust-lang.org/dist/"
"rustc-" version "-src.tar.gz"))
(sha256
(base32
"0saaprfb01z95gxlqqki28a3rq7p5a7labxdn3w1d9n49yy6zj8a"))
(modules '((guix build utils)))
(snippet
`(begin
(delete-file-recursively "src/llvm")
#t))))
(build-system gnu-build-system)
(native-inputs
`(("bison" ,bison) ; For the tests
("tar" ,tar) ; used to be implicit
("xz" ,xz) ; used to be implicit
("cmake" ,cmake)
("flex" ,flex) ; For the tests
("git" ,git)
("procps" ,procps) ; For the tests
("python-2" ,python-2)
("cargo-bootstrap" ,cargo-bootstrap)
("rust-bootstrap" ,rust-bootstrap)
("which" ,which)
("strace" ,strace)
;("cross-gcc" ,(cross-gcc "i686-linux-gnu"
; #:xbinutils (cross-binutils "i686-linux-gnu")
; #:libc (cross-libc "i686-linux-gnu")))
;("cross-libc" ,(cross-libc "i686-linux-gnu"))
))
(inputs
`(("jemalloc" ,jemalloc)
("llvm" ,llvm-3.9.1)))
(arguments
`( ;#:implicit-inputs? #f
#:phases
(modify-phases %standard-phases
;; Avoid cargo complaining about mismatched checksums.
(delete 'patch-source-shebangs)
(delete 'patch-generated-file-shebangs)
(delete 'patch-usr-bin-file)
(add-after 'unpack 'patch-configure
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "configure"
(("/usr/bin/env") (which "env")) ; Detect target CPU correctly.
(("probe_need CFG_CURL curl") "") ; Avoid curl build dependency.
;; Newer LLVM has a NVPTX (NVIDIA) backend which the Rust
;; Makefiles don't know about, causing a linker failure
;; if we don't intervene.
;; Therefore, we add NVPTX here.
;; See <https://github.com/rust-lang/rust/issues/40698>.
;; For the next release, we will have to use rustbuild.
;; Right now, rustbuild doesn't work yet.
(("-DLLVM_TARGETS_TO_BUILD='")
"-DLLVM_TARGETS_TO_BUILD='NVPTX;")) ; Make LLVM >= 3.8.1 work.
(substitute* "src/tools/compiletest/src/util.rs"
(("(\"amd64\", \"x86_64\"),") "(\"amd64\", \"x86_64\"),
(\"nvptx\", \"nvptx\"),")) ; Make LLVM >= 3.8.1 work.
;(system* "mv" "src/bootstrap/config.toml.example"
; "src/bootstrap/config.toml")
(mkdir-p "src/bootstrap/.cargo")
(call-with-output-file "src/bootstrap/.cargo/config"
(lambda (p)
(format p "
[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'vendored-sources'
[source.vendored-sources]
directory = 'src/vendor'
[target.i686-linux-gnu]
linker = \"~a/bin/i686-linux-gnu-gcc\"
" (assoc-ref inputs "cross-gcc"))))
#t))
(add-after 'unpack 'set-env
(lambda* (#:key inputs #:allow-other-keys)
(define (cross? x)
(string-contains x "cross-"))
(setenv "SHELL" (which "sh"))
(setenv "CONFIG_SHELL" (which "sh"))
(setenv "VERBOSE" "1")
(setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
(setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
(setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
;(setenv "PATH" (string-append (assoc-ref inputs "rust-bootstrap") "/bin:" (getenv "PATH")))
(for-each
(lambda (env-name)
(let* ((env-value (getenv env-name))
(search-path (search-path-as-string->list env-value))
(new-search-path (filter (lambda (e) (not (cross? e)))
search-path))
(new-env-value (list->search-path-as-string
new-search-path ":")))
(setenv env-name new-env-value)))
'("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH" "LIBRARY_PATH"))
#t))
(add-after 'unpack 'patch-tests
(lambda* (#:key inputs #:allow-other-keys)
(let ((bash (assoc-ref inputs "bash")))
(substitute* "src/tools/tidy/src/main.rs"
(("^.*cargo.*::check.*$") ""))
(substitute* "src/libstd/process.rs"
;; The newline is intentional.
;; There's a line length "tidy" check in Rust which would
;; fail otherwise.
(("\"/bin/sh\"") (string-append "
\"" bash "/bin/sh\"")))
;; See <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00222.html>.
(substitute* "src/libstd/sys/unix/process/process_common.rs"
(("fn test_process_mask") "#[cfg_attr(target_os = \"linux\", ignore)]
fn test_process_mask"))
;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH.
;; See <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00193.html>.
(delete-file-recursively "src/test/run-make/linker-output-non-utf8")
#t)))
(replace 'configure
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(gcc (assoc-ref inputs "gcc"))
(binutils (assoc-ref inputs "binutils"))
(python (assoc-ref inputs "python-2"))
(rustc (assoc-ref inputs "rustc-bootstrap"))
(llvm (assoc-ref inputs "llvm"))
(jemalloc (assoc-ref inputs "jemalloc"))
;; TODO make bootstrapper use i686 libraries! (-lutil, -ldl, ...).
(flags (list
(string-append "--prefix=" out)
; FIXME (string-append "--datadir=" out "/share")
; FIXME (string-append "--infodir=" out "/share/info")
(string-append "--default-linker=" gcc "/bin/gcc")
(string-append "--default-ar=" binutils "/bin/ar")
(string-append "--python=" python "/bin/python2")
; FIXME /gnu/store/6rri0kxb9q1gz6lv1dgdwjh41aa9ijdl-rustc-bootstrap-1.17.0/bin/cargo is wrong.
;(string-append "--local-rust-root=" rustc)
(string-append "--llvm-root=" llvm)
(string-append "--jemalloc-root=" jemalloc "/lib")
"--release-channel=stable"
"--enable-rpath"
"--enable-local-rust"
"--disable-manage-submodules"
; "--enable-extended" ; FIXME
"--disable-sanitizers" ; FIXME re-enable
;"--build=x86_64-unknown-linux-gnu"
;"--enable-full-bootstrap"
)))
(mkdir "Xcargo")
(call-with-output-file "Xcargo/config"
(lambda (p)
(format p "
[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'vendored-sources'
[source.vendored-sources]
directory = 'src/vendor'
[target.i686-linux-gnu]
linker = \"~a/bin/i686-linux-gnu-gcc\"
" (assoc-ref inputs "cross-gcc"))))
(setenv "CARGO_HOME" (string-append (getcwd) "/Xcargo"))
(setenv "CC_x86_64_unknown_linux_gnu"
(string-append (assoc-ref inputs "gcc") "/bin/gcc"))
(setenv "CXX_x86_64_unknown_linux_gnu"
(string-append (assoc-ref inputs "gcc") "/bin/g++"))
(setenv "AR_x86_64_unknown_linux_gnu"
(string-append (assoc-ref inputs "binutils") "/bin/ar"))
;(mkdir-p (string-append (getcwd) "/build/bootstrap"))
(call-with-output-file
(string-append (getcwd) "/config.toml")
(lambda (port)
(format port "[build]
rustc = \"~a/bin/rustc\"
cargo = \"~a/bin/cargo\"
verbose = 2
[rust]
#default-linker = \"cc\"
#default-ar = \"~a/bin/ar\"
[target.x86_64-unknown-linux-gnu]
ar = \"~a/bin/ar\"
cc = \"~a/bin/gcc\"
cxx = \"~a/bin/gcc\"
linker = \"~a/bin/gcc\"
"
(assoc-ref inputs "rustc-bootstrap")
(assoc-ref inputs "cargo-bootstrap")
(assoc-ref inputs "binutils")
(assoc-ref inputs "binutils")
(assoc-ref inputs "gcc")
(assoc-ref inputs "gcc")
(assoc-ref inputs "gcc")
)))
(substitute* "src/bootstrap/bootstrap.py"
(("build[.]config_toml = config.read[(][)]")
"build.config_toml = config.read() ; import os ; print(\"XXXX\", os.getcwd())")
(("/etc/NIXOS")
(getcwd))
;; FIXME remove
(("self[.]program_config[(]'cargo'[)]")
(string-append "'" (assoc-ref inputs "cargo-bootstrap")
"/bin/cargo'"))
(("cargo[(][)], \"build\"") "cargo(), \"build\", \"--verbose\""))
;; Rust uses a custom configure script (no autoconf).
(let ((status (zero? (apply system* (which "sh") "./configure" flags))))
(substitute* "src/bootstrap/config.rs"
;; This would override build.cargo and we don't want that. Alternative: patch config.mk
(("CFG_LOCAL_RUST_ROOT") "CFG_LOCAL_RUST_ROOTx"))
status))))
(add-after 'install 'wrap-rustc
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(libc (assoc-ref inputs "libc"))
(ld-wrapper (assoc-ref inputs "ld-wrapper")))
;; Let gcc find ld and libc startup files.
(wrap-program (string-append out "/bin/rustc")
`("PATH" ":" prefix (,(string-append ld-wrapper "/bin")))
`("LIBRARY_PATH" ":" suffix (,(string-append libc "/lib"))))
#t))))))
;; rustc invokes gcc, so we need to set its search paths accordingly.
(native-search-paths (package-native-search-paths gcc))
(synopsis "Compiler for the Rust progamming language")
(description "Rust is a systems programming language that provides memory
safety and thread safety guarantees.")
(home-page "https://www.rust-lang.org")
;; Dual licensed.
(license (list license:asl2.0 license:expat))))
;; This tries very hard not to get into a cyclic dependency like this:
;; cargo <- cargo-build-system <- cargo.
(define-public cargo
(package
(name "cargo")
(version (cargo-version (rustc-version %rust-bootstrap-binaries-version)))
(source (origin
(method url-fetch)
(uri (string-append "https://github.com/rust-lang/cargo/archive/"
version ".tar.gz"))
(file-name (string-append name "-" version ".tar.gz"))
(sha256
(base32
"1y1zy9gk1ly0wh57y78fisk7cdd92qk0x7z664f6l7lzl2krqs7w"))))
(build-system cargo-build-system)
(propagated-inputs
`(("cmake" ,cmake)
("pkg-config" ,pkg-config)))
(inputs
`(("curl" ,curl)
("libgit2" ,libgit2)
("libssh2" ,libssh2)
("openssl" ,openssl)
("python-2" ,python-2)
("zlib" ,zlib)))
(native-inputs
`(("rust-openssl"
,(origin
(method url-fetch)
(uri (crate-uri "openssl" "0.9.6"))
(sha256
(base32
"0g28g692gby6izp9qmnwnyxyhf9b0870yhd500p18j9l69lxl00c"))))
("rust-strsim"
,(origin
(method url-fetch)
(uri (crate-uri "strsim" "0.5.1"))
(sha256
(base32
"0bj4fsm1l2yqbfpspyvjf9m3m50pskapcddzm0ji9c74jbgnkh2h"))))
("rust-libc"
,(origin
(method url-fetch)
(uri (crate-uri "libc" "0.2.18"))
(sha256
(base32
"0w5cghr0wx3hi2sclk8r9iyzlbxsakil87ada40q2ykyhky24655"))))
("rust-bitflags"
,(origin
(method url-fetch)
(uri (crate-uri "bitflags" "0.7.0"))
(sha256
(base32
"0v8hh6wdkpk9my8z8442g4hqrqf05h0qj53dsay6mv18lqvqklda"))))
("rust-unicode-normalization"
,(origin
(method url-fetch)
(uri (crate-uri "unicode-normalization" "0.1.2"))
(sha256
(base32
"0whi4xxqcjfsz6ywyrfd5lhgk1a44c86qwgvfqcmzidshcpklr16"))))
("rust-rand"
,(origin
(method url-fetch)
(uri (crate-uri "rand" "0.3.14"))
(sha256
(base32
"1984zvj8572ig28fz6idc4r96fx39h4lzmr07yf7kb7gdn6di497"))))
("rust-gcc"
,(origin
(method url-fetch)
(uri (crate-uri "gcc" "0.3.39"))
(sha256
(base32
"1q0idjvmhp6shkb9hqabh51rgfr8dqpi1xfmyzq7q8vgzybll7kp"))))
("rust-tempdir"
,(origin
(method url-fetch)
(uri (crate-uri "tempdir" "0.3.5"))
(sha256
(base32
"1mij45kgzflkja0h8q9avrik76h5a0b60m9hfd6k9yqxbiplm5w7"))))
("rust-memchr"
,(origin
(method url-fetch)
(uri (crate-uri "memchr" "0.1.11"))
(sha256
(base32
"084d85hjfa3xf5kwdms2mhbkh78m1gl2254cp5swcxj3a7xjkdnq"))))
("rust-rustc-serialize"
,(origin
(method url-fetch)
(uri (crate-uri "rustc-serialize" "0.3.21"))
(sha256
(base32
"064qmyr2508qf78dwcpiv25rfjp9h9vd0wrj4mmwgppjg4fgrydz"))))
("rust-cmake"
,(origin
(method url-fetch)
(uri (crate-uri "cmake" "0.1.19"))
(sha256
(base32
"0am8c8ns1h6b1a5x9z2r1m3rszvya5nccl2pzszzjv5aiiaydgcf"))))
("rust-matches"
,(origin
(method url-fetch)
(uri (crate-uri "matches" "0.1.4"))
(sha256
(base32
"1c8190j84hbicy8jwscw5icfam12j6lcxi02lvmadq9260p65mzg"))))
("rust-winapi"
,(origin
(method url-fetch)
(uri (crate-uri "winapi" "0.2.8"))
(sha256
(base32
"0yh816lh6lf56dpsgxy189c2ai1z3j8mw9si6izqb6wsjkbcjz8n"))))
("rust-pkg-config"
,(origin
(method url-fetch)
(uri (crate-uri "pkg-config" "0.3.8"))
(sha256
(base32
"1ypj4nj2z9z27qg06v3g40jyhw685i3l2wi098d21bvyri781vlc"))))
("rust-libssh2-sys"
,(origin
(method url-fetch)
(uri (crate-uri "libssh2-sys" "0.2.5"))
(sha256
(base32
"0d2r36hrh9vc1821r0v4kywv30svpf37d31calwql69fbij3bqci"))))
("rust-libz-sys"
,(origin
(method url-fetch)
(uri (crate-uri "libz-sys" "1.0.13"))
(sha256
(base32
"034pgvxzgsv37iafgs0lmvd1ifm0bg0zm1xcsn9x71nn8lm93vp5"))))
("rust-curl-sys"
,(origin
(method url-fetch)
(uri (crate-uri "curl-sys" "0.3.6"))
(sha256
(base32
"0fi8kjz3f8m8vfazycs3ddm0h6j3x78hw78gwbvybx71129192i1"))))
("rust-error-chain"
,(origin
(method url-fetch)
(uri (crate-uri "error-chain" "0.7.2"))
(sha256
(base32
"03qjh6l2a9fkiyg0428p7q3dcpi47cbmrqf9zmlymkg43v3v731i"))))
("rust-metadeps"
,(origin
(method url-fetch)
(uri (crate-uri "metadeps" "1.1.1"))
(sha256
(base32
"0l818461bslb7nrs7r1amkqv45n53fcp5sabyqipwx0xxbkzz7w2"))))
("rust-openssl-sys"
,(origin
(method url-fetch)
(uri (crate-uri "openssl-sys" "0.9.6"))
(sha256
(base32
"1hzpyf9z8xg1yn5r9g17bl5j20nifd6s2zp10xh90v7m0sd2yj5i"))))
("rust-fs2"
,(origin
(method url-fetch)
(uri (crate-uri "fs2" "0.3.0"))
(sha256
(base32
"0lg57mgcm1r0m8jm4nqpcrl6lmxg8lj854k2h0r7qp46pphh2034"))))
("rust-log"
,(origin
(method url-fetch)
(uri (crate-uri "log" "0.3.6"))
(sha256
(base32
"0m40hgs3cg57dd5kk1mabfk6gk8z6l1cihar8akx4kmzz1xlk0xb"))))
("rust-filetime"
,(origin
(method url-fetch)
(uri (crate-uri "filetime" "0.1.10"))
(sha256
(base32
"08p9scgv30i1141cnp5xi4pqlnkfci455nrpca55df1r867anqsk"))))
("rust-tar"
,(origin
(method url-fetch)
(uri (crate-uri "tar" "0.4.9"))
(sha256
(base32
"1vi3nl8s3jjf5l20ni47gmh1p4bdjfh7q50fbg7izzqrf7i4i40c"))))
("rust-glob"
,(origin
(method url-fetch)
(uri (crate-uri "glob" "0.2.11"))
(sha256
(base32
"1ysvi72slkw784fcsymgj4308c3y03gwjjzqxp80xdjnkbh8vqcb"))))
("rust-cfg-if"
,(origin
(method url-fetch)
(uri (crate-uri "cfg-if" "0.1.0"))
(sha256
(base32
"137qikjcal4h75frzcn6mknygqk8vy5bva7w851aydb5gc6pc7ny"))))
("rust-winapi-build"
,(origin
(method url-fetch)
(uri (crate-uri "winapi-build" "0.1.1"))
(sha256
(base32
"1g4rqsgjky0a7530qajn2bbfcrl2v0zb39idgdws9b1l7gp5wc9d"))))
("rust-advapi32-sys"
,(origin
(method url-fetch)
(uri (crate-uri "advapi32-sys" "0.2.0"))
(sha256
(base32
"16largvlrd1800vvdchml0ngnszjlnpqm01rcz5hm7di1h48hrg0"))))
("rust-gdi32-sys"
,(origin
(method url-fetch)
(uri (crate-uri "gdi32-sys" "0.2.0"))
(sha256
(base32
"0605d4ngjsspghwjv4jicajich1gnl0aik9f880ajjzjixd524h9"))))
("rust-ws2_32-sys"
,(origin
(method url-fetch)
(uri (crate-uri "ws2_32-sys" "0.2.1"))
(sha256
(base32
"0ppscg5qfqaw0gzwv2a4nhn5bn01ff9iwn6ysqnzm4n8s3myz76m"))))
("rust-user32-sys"
,(origin
(method url-fetch)
(uri (crate-uri "user32-sys" "0.2.0"))
(sha256
(base32
"0ivxc7hmsxax9crdhxdd1nqwik4s9lhb2x59lc8b88bv20fp3x2f"))))
("rust-unicode-bidi"
,(origin
(method url-fetch)
(uri (crate-uri "unicode-bidi" "0.2.3"))
(sha256
(base32
"0gqbyf6slkgzr14nf6v8dw8a19l5snh6bpms8bpfvzpxdawwxxy1"))))
("rust-net2"
,(origin
(method url-fetch)
(uri (crate-uri "net2" "0.2.26"))
(sha256
(base32
"1qp3q6xynb481rsp3ig1nmqb6qlxfba3shfrmqij88cppsv9rpsy"))))
("rust-utf8-ranges"
,(origin
(method url-fetch)
(uri (crate-uri "utf8-ranges" "0.1.3"))
(sha256
(base32
"03xf604b2v51ag3jgzw92l97xnb10kw9zv948bhc7ja1ik017jm1"))))
("rust-crossbeam"
,(origin
(method url-fetch)
(uri (crate-uri "crossbeam" "0.2.10"))
(sha256
(base32
"15wga0kvk3iqf3l077957j931brf1pl3p74xibd698jccqas4phc"))))
("rust-toml"
,(origin
(method url-fetch)
(uri (crate-uri "toml" "0.2.1"))
(sha256
(base32
"1d1cz43bxrx4fd6j2p6myckf81f72bp47akg36y3flxjkhj60svk"))))
("rust-aho-corasick"
,(origin
(method url-fetch)
(uri (crate-uri "aho-corasick" "0.5.3"))
(sha256
(base32
"0rnvdmlajikq0i4zdy1p3pv699q6apvsxfc7av7byhppllp2r5ya"))))
("rust-psapi-sys"
,(origin
(method url-fetch)
(uri (crate-uri "psapi-sys" "0.1.0"))
(sha256
(base32
"0y14g8qshsfnmb7nk2gs1rpbrs1wrggajmzp4yby4q6k0wd5vkdb"))))
("rust-idna"
,(origin
(method url-fetch)
(uri (crate-uri "idna" "0.1.0"))
(sha256
(base32
"049c2rmlydrrrgrxdaq2v21adx9vkfh6k9x4xj56ckyf01p26lqh"))))
("rust-url"
,(origin
(method url-fetch)
(uri (crate-uri "url" "1.2.3"))
(sha256
(base32
"1myr1i8djbl2bhvvrm6n3h7bj7sl6kh5dmaaz2f7c6x8hyyzgk28"))))
("rust-regex-syntax"
,(origin
(method url-fetch)
(uri (crate-uri "regex-syntax" "0.3.9"))
(sha256
(base32
"0ms9hgdhhsxw9w920i7gipydvagf100bb56jbs192rz86ln01v7r"))))
("rust-kernel32-sys"
,(origin
(method url-fetch)
(uri (crate-uri "kernel32-sys" "0.2.2"))
(sha256
(base32
"1389av0601a9yz8dvx5zha9vmkd6ik7ax0idpb032d28555n41vm"))))
("rust-term"
,(origin
(method url-fetch)
(uri (crate-uri "term" "0.4.4"))
(sha256
(base32
"0jpr7jb1xidadh0arklwr99r8w1k1dfc4an3ginpsq5nnfigivrx"))))
("rust-thread-id"
,(origin
(method url-fetch)
(uri (crate-uri "thread-id" "2.0.0"))
(sha256
(base32
"00zzs2bx1xw8aqm5plqqgr7bc2zz6zkqrdxq8vpiqb8hc2srslx9"))))
("rust-thread_local"
,(origin
(method url-fetch)
(uri (crate-uri "thread_local" "0.2.7"))
(sha256
(base32
"1mgxikqvhpsic6xk7pan95lvgsky1sdxzw2w5m2l35pgrazxnxl5"))))
("rust-miow"
,(origin
(method url-fetch)
(uri (crate-uri "miow" "0.1.3"))
(sha256
(base32
"16jvfjsp6fr4mbd2sw5hcdmi4dsa0m0aa45gjz78mb1h4mwcdgym"))))
("rust-regex"
,(origin
(method url-fetch)
(uri (crate-uri "regex" "0.1.80"))
(sha256
(base32
"0bs036h3vzc6pj5jj4vc909s9rppq7b808ic99qn0y6gm3karm2g"))))
("rust-num_cpus"
,(origin
(method url-fetch)
(uri (crate-uri "num_cpus" "1.1.0"))
(sha256
(base32
"1bfwcn3yhwa31rinjw9yr7b6gvn6c06hnwnjz06pvm938w4fd448"))))
("rust-libgit2-sys"
,(origin
(method url-fetch)
(uri (crate-uri "libgit2-sys" "0.6.6"))
(sha256
(base32
"074h9q4p60xh6canb0sj4vrc801wqv6p53l9lp0q724bkwzf7967"))))
("rust-env_logger"
,(origin
(method url-fetch)
(uri (crate-uri "env_logger" "0.3.5"))
(sha256
(base32
"0bvcjgkw4s3k1rd7glpflgc8s9a393zjd6jfdgvs8gjvwj0dgaqm"))))
("rust-openssl-probe"
,(origin
(method url-fetch)
(uri (crate-uri "openssl-probe" "0.1.0"))
(sha256
(base32
"0689h6rhzy6dypqr90lsxnf108nsnh952wsx7ggs70s48b44jvbm"))))
("rust-lazy_static"
,(origin
(method url-fetch)
(uri (crate-uri "lazy_static" "0.2.2"))
(sha256
(base32
"16z1h7w702sxnscak38jykxlhxq0b5ip4mndlb46pkaqwzi0xgka"))))
("rust-semver-parser"
,(origin
(method url-fetch)
(uri (crate-uri "semver-parser" "0.6.1"))
(sha256
(base32
"1s8s7a7yg8xhgci17y0xhyyncg229byivhpr0wbs3ljdlyjl73p8"))))
("rust-semver"
,(origin
(method url-fetch)
(uri (crate-uri "semver" "0.5.1"))
(sha256
(base32
"1xbiv8l72rmngb3lgbmk3vd4lalcbzxcnrn085c2b75irl7gcbxf"))))
("rust-docopt"
,(origin
(method url-fetch)
(uri (crate-uri "docopt" "0.6.86"))
(sha256
(base32
"1nf4f4zf5yk0d0l4kl7hkii4na22fhn0l2hgfb46yzv08l2g6zja"))))
("rust-miniz-sys"
,(origin
(method url-fetch)
(uri (crate-uri "miniz-sys" "0.1.7"))
(sha256
(base32
"0m7dlggsxash0k5jkx576p556g9r8vnhyl9244gjxhq1g8rls7wx"))))
("rust-curl"
,(origin
(method url-fetch)
(uri (crate-uri "curl" "0.4.1"))
(sha256
(base32
"1b0y27b6vpqffgzm2kxc1s2i6bgdzxk3wn65g2asbcdxrvys3mcg"))))
("rust-flate2"
,(origin
(method url-fetch)
(uri (crate-uri "flate2" "0.2.14"))
(sha256
(base32
"1fx3zsls5bb1zfx87s5sxkgk853z4nhjsbvq5s6if13kjlg4isry"))))
("rust-git2"
,(origin
(method url-fetch)
(uri (crate-uri "git2" "0.6.3"))
(sha256
(base32
"06b1bw3pwszs8617xn8js6h0j983qjgfwsychw33lshccj3cld05"))))
("rust-crates-io"
,(origin
(method url-fetch)
(uri (crate-uri "crates-io" "0.4.0"))
(sha256
(base32
"0kk6abp1qbpv44hkq1yjp7xgpzjzafs83i1l26ycr0aph1gbwig9"))))
("rust-git2-curl"
,(origin
(method url-fetch)
(uri (crate-uri "git2-curl" "0.7.0"))
(sha256
(base32
"13mzqp4rd81zp78261rlq23iw9aaysdr56484y1yy2xzhk3nnrv8"))))
("rust-bufstream"
,(origin
(method url-fetch)
(uri (crate-uri "bufstream" "0.1.2"))
(sha256
(base32
"0x6h27md1fwabbhbycfldj0wklrpjr520z9p0cpzm60fzzidnj3v"))))
("rust-hamcrest"
,(origin
(method url-fetch)
(uri (crate-uri "hamcrest" "0.1.1"))
(sha256
(base32
"1m49rf7bnkx0qxja56slrjh44zi4z5bjz5x4pblqjw265828y25z"))))
("rust-num"
,(origin
(method url-fetch)
(uri (crate-uri "num" "0.1.36"))
(sha256
(base32
"081i1r3mdz6jasqd7qwraqqfqa3sdpvdvxl1xq0s7ip714xw1rxx"))))
("rust-num-traits"
,(origin
(method url-fetch)
(uri (crate-uri "num-traits" "0.1.36"))
(sha256
(base32
"07688sp4z40p14lh5ywvrpm4zq8kcxzhjks8sg33jsr5da2l4sm1"))))
("rust-num-integer"
,(origin
(method url-fetch)
(uri (crate-uri "num-integer" "0.1.32"))
(sha256
(base32
"14pvaaawl0pgdcgh4dfdd67lz58yxlfl95bry86h28pjnfzxj97v"))))
("rust-num-bigint"
,(origin
(method url-fetch)
(uri (crate-uri "num-bigint" "0.1.35"))
(sha256
(base32
"0jayfkdm33p4zvcahlv46zdfhlzg053mpw32abf2lz0z8xw47cc8"))))
("rust-num-rational"
,(origin
(method url-fetch)
(uri (crate-uri "num-rational" "0.1.35"))
(sha256
(base32
"1bwaygv64qg7i78yqg0v4d0amfhamj598rpy4yxjz9rlhcxn1zsl"))))
("rust-num-iter"
,(origin
(method url-fetch)
(uri (crate-uri "num-iter" "0.1.32"))
(sha256
(base32
"0p74nj5c1mc33h9lx4wpmlmggmn5lnkhxv1225g0aix8d6ciqyi8"))))
("rust-num-complex"
,(origin
(method url-fetch)
(uri (crate-uri "num-complex" "0.1.35"))
(sha256
(base32
"0bzrjfppnnzf9vmkpklhp2dw9sb1lqzydb8r6k83z76i9l2qxizh"))))
("rust-shell-escape"
,(origin
(method url-fetch)
(uri (crate-uri "shell-escape" "0.1.3"))
(sha256
(base32
"1y2fp2brv639icv4a0fdqs1zhlrxq8qbz27ygfa86ifmh5jcjp6x"))))))
(arguments
`(#:cargo ,cargo-bootstrap
#:tests? #f ; FIXME
#:modules
((ice-9 match)
(srfi srfi-1) ; 'every
(guix build utils)
(guix build cargo-build-system))
#:phases
(modify-phases %standard-phases
;; Avoid cargo complaining about missmatched checksums.
(delete 'patch-source-shebangs)
(delete 'patch-generated-file-shebangs)
(delete 'patch-usr-bin-file)
(add-after 'unpack 'unpack-submodule-sources
(lambda* (#:key inputs #:allow-other-keys)
(define (unpack source target)
(mkdir-p target)
(with-directory-excursion target
(zero? (system* "tar" "xf"
source
"--strip-components=1"))))
(define (touch file-name)
(call-with-output-file file-name (const #t)))
(define (install-rust-library entry)
(match entry
((name . src)
(if (string-prefix? "rust-" name)
(let* ((rust-length (string-length "rust-"))
(rust-name (string-drop name
rust-length))
(rsrc (string-append "vendor/"
rust-name))
(unpack-status (unpack src rsrc)))
(touch (string-append rsrc "/.cargo-ok"))
(generate-checksums rsrc src)
unpack-status)))
(_ #t)))
(mkdir "vendor")
(every install-rust-library inputs)))
(add-after 'unpack 'set-environment-up
(lambda* (#:key inputs #:allow-other-keys)
(let* ((gcc (assoc-ref inputs "gcc"))
(cc (string-append gcc "/bin/gcc")))
(mkdir ".cargo")
(call-with-output-file ".cargo/config"
(lambda (p)
(format p "
[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'vendored-sources'
[source.vendored-sources]
directory = 'vendor'
")))
(setenv "CMAKE_C_COMPILER" cc)
;; TODO CC_i686_unknown_linux_gnu=gcc
(setenv "CC" cc))
#t))
(delete 'configure))))
(home-page "https://github.com/rust-lang/cargo")
(synopsis "Build tool and package manager for Rust")
(description "Cargo is a tool that allows Rust projects to declare their
dependencies and ensures a reproducible build.")
;; Cargo is dual licensed Apache and MIT. Also contains
;; code from openssl which is GPL2 with linking exception.
(license (list license:asl2.0 license:expat license:gpl2))))
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#28433] [WIP] Rust update
2017-11-28 6:35 ` ng0
2017-11-28 10:12 ` Danny Milosavljevic
@ 2017-11-29 8:04 ` Danny Milosavljevic
1 sibling, 0 replies; 16+ messages in thread
From: Danny Milosavljevic @ 2017-11-29 8:04 UTC (permalink / raw)
To: ng0; +Cc: Ricardo Wurmus, 28433
[-- Attachment #1: Type: text/plain, Size: 105 bytes --]
New version attached...
Rust's libbacktrace now picks up the x86_64 gcc but then that uses the i686 ld.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: rust.scm --]
[-- Type: text/x-scheme, Size: 42917 bytes --]
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2016 Eric Le Bihan <eric.le.bihan.dev@free.fr>
;;; Copyright © 2016 ng0 <ng0@libertad.pw>
;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages rust)
#:use-module (gnu packages base)
#:use-module (gnu packages bison)
#:use-module (gnu packages bootstrap)
#:use-module (gnu packages cmake)
#:use-module (gnu packages compression)
#:use-module (gnu packages cross-base)
#:use-module (gnu packages curl)
#:use-module (gnu packages elf)
#:use-module (gnu packages flex)
#:use-module (gnu packages gcc)
#:use-module (gnu packages jemalloc)
#:use-module (gnu packages linux)
#:use-module (gnu packages llvm)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
#:use-module (gnu packages ssh)
#:use-module (gnu packages tls)
#:use-module (gnu packages version-control)
#:use-module (guix build-system cargo)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
#:use-module (guix download)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (ice-9 match)
#:use-module (srfi srfi-26))
;; Should be one less than the current released version.
(define %rust-bootstrap-binaries-version "1.21.0")
(define %rust-bootstrap-binaries
(origin
(method url-fetch)
(uri (string-append
"https://static.rust-lang.org/dist/"
"rust-" %rust-bootstrap-binaries-version
"-i686-unknown-linux-gnu.tar.gz"))
(sha256
(base32
"1vnvqwz30hvyjcfr1f602lg43v2vlqjr3yhb5vr8xnrcc07yvjmp"))))
(define (increment-rust-version rust-version major patch)
(match (string-split rust-version #\.)
(("1" minor _)
(string-append (number->string major) "."
(number->string (+ (string->number minor) 1)) "."
(number->string patch)))))
(define* (cargo-version rustc-version #:optional (patch 0))
;; Computes the cargo version that matches the rustc version.
;; https://github.com/rust-lang/cargo#Releases
(increment-rust-version rustc-version 0 patch))
(define* (rustc-version bootstrap-version #:optional (patch 0))
;; Computes the rustc version that can be compiled from a given
;; other rustc version. The patch argument is for selecting
;; a stability or security fix. 1.11.0 -> 1.12.1 -> 1.13.0
(increment-rust-version bootstrap-version 1 patch))
(define-public rustc-bootstrap
(package
(name "rustc-bootstrap")
(version %rust-bootstrap-binaries-version)
(source %rust-bootstrap-binaries)
(build-system gnu-build-system)
(native-inputs
`(("patchelf" ,patchelf)))
(inputs
`(("gcc:lib" ,(canonical-package gcc) "lib")
("zlib" ,zlib)))
(arguments
`(#:tests? #f
#:strip-binaries? #f
#:system "i686-linux"
#:phases
(modify-phases %standard-phases
(delete 'configure)
(delete 'build)
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(gcc:lib (assoc-ref inputs "gcc:lib"))
(libc (assoc-ref inputs "libc"))
(zlib (assoc-ref inputs "zlib"))
(ld-so (string-append libc
,(glibc-dynamic-linker "i686-linux")))
(rpath (string-append out "/lib:" zlib "/lib:"
libc "/lib:" gcc:lib "/lib"))
(rustc (string-append out "/bin/rustc"))
(rustdoc (string-append out "/bin/rustdoc")))
(system* "bash" "install.sh"
(string-append "--prefix=" out)
(string-append "--components=rustc,"
"rust-std-i686-unknown-linux-gnu"))
(for-each (lambda (file)
(system* "patchelf" "--set-rpath" rpath file))
(cons* rustc rustdoc (find-files out "\\.so$")))
(for-each (lambda (file)
(system* "patchelf" "--set-interpreter" ld-so file))
(list rustc rustdoc))))))))
(supported-systems '("i686-linux" "x86_64-linux"))
(home-page "https://www.rust-lang.org")
(synopsis "Prebuilt rust compiler")
(description "This package provides a pre-built @command{rustc} compiler,
which can in turn be used to build the final Rust compiler.")
(license license:asl2.0)))
(define cargo-bootstrap
(package
(name "cargo-bootstrap")
(version (cargo-version %rust-bootstrap-binaries-version))
(source %rust-bootstrap-binaries)
(build-system gnu-build-system)
(native-inputs
`(("patchelf" ,patchelf)))
(inputs
`(("gcc:lib" ,(canonical-package gcc) "lib")))
(arguments
`(#:tests? #f
#:strip-binaries? #f
#:system "i686-linux"
#:phases
(modify-phases %standard-phases
(delete 'configure)
(delete 'build)
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(gcc:lib (assoc-ref inputs "gcc:lib"))
(libc (assoc-ref inputs "libc"))
(ld-so (string-append libc
,(glibc-dynamic-linker "i686-linux")))
(rpath (string-append out "/lib:" libc "/lib:"
gcc:lib "/lib"))
(cargo (string-append out "/bin/cargo")))
(system* "bash" "install.sh"
(string-append "--prefix=" out)
"--components=cargo")
(system* "patchelf"
"--set-interpreter" ld-so
"--set-rpath" rpath
cargo)))))))
(supported-systems '("i686-linux" "x86_64-linux"))
(home-page "https://www.rust-lang.org")
(synopsis "Prebuilt cargo package manager")
(description "This package provides a pre-built @command{cargo} package
manager, which is required to build itself.")
(license license:asl2.0)))
(define-public rust-bootstrap
(package
(name "rust-bootstrap")
(version %rust-bootstrap-binaries-version)
(source #f)
(build-system trivial-build-system)
(propagated-inputs
`(("rustc-bootstrap" ,rustc-bootstrap)
("cargo-bootstrap" ,cargo-bootstrap)
("gcc" ,(canonical-package gcc))
("gcc:lib" ,(canonical-package gcc) "lib")
("binutils" ,binutils))) ; for ld.
(native-inputs
`(("glibc" ,glibc)))
(native-search-paths
(list (search-path-specification
(variable "LD_LIBRARY_PATH")
(files '("lib")))))
(arguments
`(#:modules ((guix build utils) (guix build union))
#:system "i686-linux"
;#:implicit-inputs? #f
#:builder
(begin
(use-modules (guix build utils))
(use-modules (guix build union))
(let ((out (assoc-ref %outputs "out"))
(gcc (assoc-ref %build-inputs "gcc"))
(gcc:lib (assoc-ref %build-inputs "gcc:lib"))
(glibc (assoc-ref %build-inputs "glibc"))
(binutils (assoc-ref %build-inputs "binutils")))
(mkdir-p (string-append out "/bin"))
;(mkdir-p (string-append out "/lib"))
;; Rust requires a C toolchain for linking. The prebuilt
;; binaries expect a compiler called cc. Thus symlink gcc
;; to cc.
(symlink (string-append gcc "/bin/gcc")
(string-append out "/bin/cc"))
;; cc invokes "ld". Provide it.
(symlink (string-append binutils "/bin/ld")
(string-append out "/bin/ld"))
(union-build (string-append out "/lib")
(list (string-append glibc "/lib")
(string-append gcc:lib "/lib")))
;(system "chmod" "+x" (string-append out "/lib/libgcc_s.so.1"))
))))
(home-page "https://www.rust-lang.org")
(synopsis "Rust bootstrapping meta package")
(description "Meta package for a rust environment. Provides pre-compiled
rustc-bootstrap and cargo-bootstrap packages.")
(license license:asl2.0)))
(define-public rustc
(package
(name "rustc")
(version (rustc-version %rust-bootstrap-binaries-version))
(source (origin
(method url-fetch)
(uri (string-append
"https://static.rust-lang.org/dist/"
"rustc-" version "-src.tar.gz"))
(sha256
(base32
"0saaprfb01z95gxlqqki28a3rq7p5a7labxdn3w1d9n49yy6zj8a"))
(modules '((guix build utils)))
(snippet
`(begin
(delete-file-recursively "src/llvm")
#t))))
(build-system gnu-build-system)
(native-inputs
`(("bison" ,bison) ; For the tests
("tar" ,tar) ; used to be implicit
("xz" ,xz) ; used to be implicit
("cmake" ,cmake)
("flex" ,flex) ; For the tests
("git" ,git)
("procps" ,procps) ; For the tests
("python-2" ,python-2)
("cargo-bootstrap" ,cargo-bootstrap)
("rust-bootstrap" ,rust-bootstrap)
("which" ,which)
("strace" ,strace)
;("cross-gcc" ,(cross-gcc "i686-linux-gnu"
; #:xbinutils (cross-binutils "i686-linux-gnu")
; #:libc (cross-libc "i686-linux-gnu")))
;("cross-libc" ,(cross-libc "i686-linux-gnu"))
))
(inputs
`(("jemalloc" ,jemalloc)
("llvm" ,llvm-3.9.1)))
(arguments
`( ;#:implicit-inputs? #f
#:phases
(modify-phases %standard-phases
;; Avoid cargo complaining about mismatched checksums.
(delete 'patch-source-shebangs)
(delete 'patch-generated-file-shebangs)
(delete 'patch-usr-bin-file)
(add-after 'unpack 'patch-configure
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "configure"
(("/usr/bin/env") (which "env")) ; Detect target CPU correctly.
(("probe_need CFG_CURL curl") "") ; Avoid curl build dependency.
;; Newer LLVM has a NVPTX (NVIDIA) backend which the Rust
;; Makefiles don't know about, causing a linker failure
;; if we don't intervene.
;; Therefore, we add NVPTX here.
;; See <https://github.com/rust-lang/rust/issues/40698>.
;; For the next release, we will have to use rustbuild.
;; Right now, rustbuild doesn't work yet.
(("-DLLVM_TARGETS_TO_BUILD='")
"-DLLVM_TARGETS_TO_BUILD='NVPTX;")) ; Make LLVM >= 3.8.1 work.
(substitute* "src/tools/compiletest/src/util.rs"
(("(\"amd64\", \"x86_64\"),") "(\"amd64\", \"x86_64\"),
(\"nvptx\", \"nvptx\"),")) ; Make LLVM >= 3.8.1 work.
;(system* "mv" "src/bootstrap/config.toml.example"
; "src/bootstrap/config.toml")
(mkdir-p "src/bootstrap/.cargo")
(call-with-output-file "src/bootstrap/.cargo/config"
(lambda (p)
(format p "
[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'vendored-sources'
[source.vendored-sources]
directory = 'src/vendor'
[target.i686-linux-gnu]
linker = \"~a/bin/i686-linux-gnu-gcc\"
" (assoc-ref inputs "cross-gcc"))))
#t))
(add-after 'unpack 'set-env
(lambda* (#:key inputs #:allow-other-keys)
(define (cross? x)
(string-contains x "cross-"))
(setenv "SHELL" (which "sh"))
(setenv "CONFIG_SHELL" (which "sh"))
(setenv "VERBOSE" "1")
(setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
(setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
(setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
;(setenv "PATH" (string-append (assoc-ref inputs "rust-bootstrap") "/bin:" (getenv "PATH")))
(for-each
(lambda (env-name)
(let* ((env-value (getenv env-name))
(search-path (search-path-as-string->list env-value))
(new-search-path (filter (lambda (e) (not (cross? e)))
search-path))
(new-env-value (list->search-path-as-string
new-search-path ":")))
(setenv env-name new-env-value)))
'("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH" "LIBRARY_PATH"))
#t))
(add-after 'unpack 'patch-tests
(lambda* (#:key inputs #:allow-other-keys)
(let ((bash (assoc-ref inputs "bash")))
(substitute* "src/tools/tidy/src/main.rs"
(("^.*cargo.*::check.*$") ""))
(substitute* "src/libbacktrace/configure"
(("sh -c") (string-append bash "/bin/sh -c"))
(("'sh") (string-append "'" bash "/bin/sh")))
(substitute* "src/build_helper/lib.rs"
(("return Some[(]parent[.]join[(][&]file[)][)];") "
let target_u = target.replace(\"-\", \"_\");
return match env::var(&format!(\"AR_{}\", target_u)).ok() {
Some(s) => Some(PathBuf::from(s)),
None => Some(PathBuf::from(\"arx\")),
};
"))
(substitute* '("src/liballoc_jemalloc/build.rs"
"src/vendor/lzma-sys/build.rs"
"src/vendor/libz-sys/build.rs"
"src/vendor/curl-sys/build.rs"
"src/vendor/git2/src/cred.rs" ; FIXME retained?
"src/vendor/backtrace-sys/build.rs"
"src/bootstrap/install.rs"
"src/test/run-pass/process-sigpipe.rs"
"src/libstd/build.rs")
(("\"sh\"") (string-append "\"" bash "/bin/sh\"")))
(substitute* "src/libstd/process.rs"
;; The newline is intentional.
;; There's a line length "tidy" check in Rust which would
;; fail otherwise.
(("\"/bin/sh\"") (string-append "
\"" bash "/bin/sh\"")))
;; See <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00222.html>.
(substitute* "src/libstd/sys/unix/process/process_common.rs"
(("fn test_process_mask") "#[cfg_attr(target_os = \"linux\", ignore)]
fn test_process_mask"))
;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH.
;; See <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00193.html>.
(delete-file-recursively "src/test/run-make/linker-output-non-utf8")
#t)))
(replace 'configure
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(gcc (assoc-ref inputs "gcc"))
(binutils (assoc-ref inputs "binutils"))
(python (assoc-ref inputs "python-2"))
(rustc (assoc-ref inputs "rustc-bootstrap"))
(llvm (assoc-ref inputs "llvm"))
(jemalloc (assoc-ref inputs "jemalloc"))
;; TODO make bootstrapper use i686 libraries! (-lutil, -ldl, ...).
(flags (list
(string-append "--prefix=" out)
; FIXME (string-append "--datadir=" out "/share")
; FIXME (string-append "--infodir=" out "/share/info")
(string-append "--default-linker=" gcc "/bin/gcc")
(string-append "--default-ar=" binutils "/bin/ar")
(string-append "--python=" python "/bin/python2")
; FIXME /gnu/store/6rri0kxb9q1gz6lv1dgdwjh41aa9ijdl-rustc-bootstrap-1.17.0/bin/cargo is wrong.
;(string-append "--local-rust-root=" rustc)
(string-append "--llvm-root=" llvm)
(string-append "--jemalloc-root=" jemalloc "/lib")
"--release-channel=stable"
"--enable-rpath"
"--enable-local-rust"
"--disable-manage-submodules"
; "--enable-extended" ; FIXME
"--disable-sanitizers" ; FIXME re-enable
;"--build=x86_64-unknown-linux-gnu"
;"--enable-full-bootstrap"
)))
(mkdir "Xcargo")
(call-with-output-file "Xcargo/config"
(lambda (p)
(format p "
[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'vendored-sources'
[source.vendored-sources]
directory = 'src/vendor'
[target.i686-linux-gnu]
linker = \"~a/bin/i686-linux-gnu-gcc\"
" (assoc-ref inputs "cross-gcc"))))
(setenv "CARGO_HOME" (string-append (getcwd) "/Xcargo"))
(setenv "CC_x86_64_unknown_linux_gnu"
(string-append (assoc-ref inputs "gcc") "/bin/gcc"))
(setenv "CXX_x86_64_unknown_linux_gnu"
(string-append (assoc-ref inputs "gcc") "/bin/g++"))
(setenv "AR_x86_64_unknown_linux_gnu"
(string-append (assoc-ref inputs "binutils") "/bin/ar"))
;(mkdir-p (string-append (getcwd) "/build/bootstrap"))
(call-with-output-file
(string-append (getcwd) "/config.toml")
(lambda (port)
(format port "[build]
rustc = \"~a/bin/rustc\"
cargo = \"~a/bin/cargo\"
verbose = 2
[rust]
#default-linker = \"cc\"
#default-ar = \"~a/bin/ar\"
[target.x86_64-unknown-linux-gnu]
ar = \"~a/bin/ar\"
cc = \"~a/bin/gcc\"
cxx = \"~a/bin/gcc\"
linker = \"~a/bin/gcc\"
"
(assoc-ref inputs "rustc-bootstrap")
(assoc-ref inputs "cargo-bootstrap")
(assoc-ref inputs "binutils")
(assoc-ref inputs "binutils")
(assoc-ref inputs "gcc")
(assoc-ref inputs "gcc")
(assoc-ref inputs "gcc")
)))
(substitute* "src/bootstrap/bootstrap.py"
(("build[.]config_toml = config.read[(][)]")
"build.config_toml = config.read() ; import os ; print(\"XXXX\", os.getcwd())")
(("/etc/NIXOS")
(getcwd))
;; FIXME remove
(("self[.]program_config[(]'cargo'[)]")
(string-append "'" (assoc-ref inputs "cargo-bootstrap")
"/bin/cargo'"))
(("cargo[(][)], \"build\"") "cargo(), \"build\", \"--verbose\""))
;; Rust uses a custom configure script (no autoconf).
(let ((status (zero? (apply system* (which "sh") "./configure" flags))))
(substitute* "src/bootstrap/config.rs"
;; This would override build.cargo and we don't want that. Alternative: patch config.mk
(("CFG_LOCAL_RUST_ROOT") "CFG_LOCAL_RUST_ROOTx"))
status))))
(add-after 'install 'wrap-rustc
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(libc (assoc-ref inputs "libc"))
(ld-wrapper (assoc-ref inputs "ld-wrapper")))
;; Let gcc find ld and libc startup files.
(wrap-program (string-append out "/bin/rustc")
`("PATH" ":" prefix (,(string-append ld-wrapper "/bin")))
`("LIBRARY_PATH" ":" suffix (,(string-append libc "/lib"))))
#t))))))
;; rustc invokes gcc, so we need to set its search paths accordingly.
(native-search-paths (package-native-search-paths gcc))
(synopsis "Compiler for the Rust progamming language")
(description "Rust is a systems programming language that provides memory
safety and thread safety guarantees.")
(home-page "https://www.rust-lang.org")
;; Dual licensed.
(license (list license:asl2.0 license:expat))))
;; This tries very hard not to get into a cyclic dependency like this:
;; cargo <- cargo-build-system <- cargo.
(define-public cargo
(package
(name "cargo")
(version (cargo-version (rustc-version %rust-bootstrap-binaries-version)))
(source (origin
(method url-fetch)
(uri (string-append "https://github.com/rust-lang/cargo/archive/"
version ".tar.gz"))
(file-name (string-append name "-" version ".tar.gz"))
(sha256
(base32
"1y1zy9gk1ly0wh57y78fisk7cdd92qk0x7z664f6l7lzl2krqs7w"))))
(build-system cargo-build-system)
(propagated-inputs
`(("cmake" ,cmake)
("pkg-config" ,pkg-config)))
(inputs
`(("curl" ,curl)
("libgit2" ,libgit2)
("libssh2" ,libssh2)
("openssl" ,openssl)
("python-2" ,python-2)
("zlib" ,zlib)))
(native-inputs
`(("rust-openssl"
,(origin
(method url-fetch)
(uri (crate-uri "openssl" "0.9.6"))
(sha256
(base32
"0g28g692gby6izp9qmnwnyxyhf9b0870yhd500p18j9l69lxl00c"))))
("rust-strsim"
,(origin
(method url-fetch)
(uri (crate-uri "strsim" "0.5.1"))
(sha256
(base32
"0bj4fsm1l2yqbfpspyvjf9m3m50pskapcddzm0ji9c74jbgnkh2h"))))
("rust-libc"
,(origin
(method url-fetch)
(uri (crate-uri "libc" "0.2.18"))
(sha256
(base32
"0w5cghr0wx3hi2sclk8r9iyzlbxsakil87ada40q2ykyhky24655"))))
("rust-bitflags"
,(origin
(method url-fetch)
(uri (crate-uri "bitflags" "0.7.0"))
(sha256
(base32
"0v8hh6wdkpk9my8z8442g4hqrqf05h0qj53dsay6mv18lqvqklda"))))
("rust-unicode-normalization"
,(origin
(method url-fetch)
(uri (crate-uri "unicode-normalization" "0.1.2"))
(sha256
(base32
"0whi4xxqcjfsz6ywyrfd5lhgk1a44c86qwgvfqcmzidshcpklr16"))))
("rust-rand"
,(origin
(method url-fetch)
(uri (crate-uri "rand" "0.3.14"))
(sha256
(base32
"1984zvj8572ig28fz6idc4r96fx39h4lzmr07yf7kb7gdn6di497"))))
("rust-gcc"
,(origin
(method url-fetch)
(uri (crate-uri "gcc" "0.3.39"))
(sha256
(base32
"1q0idjvmhp6shkb9hqabh51rgfr8dqpi1xfmyzq7q8vgzybll7kp"))))
("rust-tempdir"
,(origin
(method url-fetch)
(uri (crate-uri "tempdir" "0.3.5"))
(sha256
(base32
"1mij45kgzflkja0h8q9avrik76h5a0b60m9hfd6k9yqxbiplm5w7"))))
("rust-memchr"
,(origin
(method url-fetch)
(uri (crate-uri "memchr" "0.1.11"))
(sha256
(base32
"084d85hjfa3xf5kwdms2mhbkh78m1gl2254cp5swcxj3a7xjkdnq"))))
("rust-rustc-serialize"
,(origin
(method url-fetch)
(uri (crate-uri "rustc-serialize" "0.3.21"))
(sha256
(base32
"064qmyr2508qf78dwcpiv25rfjp9h9vd0wrj4mmwgppjg4fgrydz"))))
("rust-cmake"
,(origin
(method url-fetch)
(uri (crate-uri "cmake" "0.1.19"))
(sha256
(base32
"0am8c8ns1h6b1a5x9z2r1m3rszvya5nccl2pzszzjv5aiiaydgcf"))))
("rust-matches"
,(origin
(method url-fetch)
(uri (crate-uri "matches" "0.1.4"))
(sha256
(base32
"1c8190j84hbicy8jwscw5icfam12j6lcxi02lvmadq9260p65mzg"))))
("rust-winapi"
,(origin
(method url-fetch)
(uri (crate-uri "winapi" "0.2.8"))
(sha256
(base32
"0yh816lh6lf56dpsgxy189c2ai1z3j8mw9si6izqb6wsjkbcjz8n"))))
("rust-pkg-config"
,(origin
(method url-fetch)
(uri (crate-uri "pkg-config" "0.3.8"))
(sha256
(base32
"1ypj4nj2z9z27qg06v3g40jyhw685i3l2wi098d21bvyri781vlc"))))
("rust-libssh2-sys"
,(origin
(method url-fetch)
(uri (crate-uri "libssh2-sys" "0.2.5"))
(sha256
(base32
"0d2r36hrh9vc1821r0v4kywv30svpf37d31calwql69fbij3bqci"))))
("rust-libz-sys"
,(origin
(method url-fetch)
(uri (crate-uri "libz-sys" "1.0.13"))
(sha256
(base32
"034pgvxzgsv37iafgs0lmvd1ifm0bg0zm1xcsn9x71nn8lm93vp5"))))
("rust-curl-sys"
,(origin
(method url-fetch)
(uri (crate-uri "curl-sys" "0.3.6"))
(sha256
(base32
"0fi8kjz3f8m8vfazycs3ddm0h6j3x78hw78gwbvybx71129192i1"))))
("rust-error-chain"
,(origin
(method url-fetch)
(uri (crate-uri "error-chain" "0.7.2"))
(sha256
(base32
"03qjh6l2a9fkiyg0428p7q3dcpi47cbmrqf9zmlymkg43v3v731i"))))
("rust-metadeps"
,(origin
(method url-fetch)
(uri (crate-uri "metadeps" "1.1.1"))
(sha256
(base32
"0l818461bslb7nrs7r1amkqv45n53fcp5sabyqipwx0xxbkzz7w2"))))
("rust-openssl-sys"
,(origin
(method url-fetch)
(uri (crate-uri "openssl-sys" "0.9.6"))
(sha256
(base32
"1hzpyf9z8xg1yn5r9g17bl5j20nifd6s2zp10xh90v7m0sd2yj5i"))))
("rust-fs2"
,(origin
(method url-fetch)
(uri (crate-uri "fs2" "0.3.0"))
(sha256
(base32
"0lg57mgcm1r0m8jm4nqpcrl6lmxg8lj854k2h0r7qp46pphh2034"))))
("rust-log"
,(origin
(method url-fetch)
(uri (crate-uri "log" "0.3.6"))
(sha256
(base32
"0m40hgs3cg57dd5kk1mabfk6gk8z6l1cihar8akx4kmzz1xlk0xb"))))
("rust-filetime"
,(origin
(method url-fetch)
(uri (crate-uri "filetime" "0.1.10"))
(sha256
(base32
"08p9scgv30i1141cnp5xi4pqlnkfci455nrpca55df1r867anqsk"))))
("rust-tar"
,(origin
(method url-fetch)
(uri (crate-uri "tar" "0.4.9"))
(sha256
(base32
"1vi3nl8s3jjf5l20ni47gmh1p4bdjfh7q50fbg7izzqrf7i4i40c"))))
("rust-glob"
,(origin
(method url-fetch)
(uri (crate-uri "glob" "0.2.11"))
(sha256
(base32
"1ysvi72slkw784fcsymgj4308c3y03gwjjzqxp80xdjnkbh8vqcb"))))
("rust-cfg-if"
,(origin
(method url-fetch)
(uri (crate-uri "cfg-if" "0.1.0"))
(sha256
(base32
"137qikjcal4h75frzcn6mknygqk8vy5bva7w851aydb5gc6pc7ny"))))
("rust-winapi-build"
,(origin
(method url-fetch)
(uri (crate-uri "winapi-build" "0.1.1"))
(sha256
(base32
"1g4rqsgjky0a7530qajn2bbfcrl2v0zb39idgdws9b1l7gp5wc9d"))))
("rust-advapi32-sys"
,(origin
(method url-fetch)
(uri (crate-uri "advapi32-sys" "0.2.0"))
(sha256
(base32
"16largvlrd1800vvdchml0ngnszjlnpqm01rcz5hm7di1h48hrg0"))))
("rust-gdi32-sys"
,(origin
(method url-fetch)
(uri (crate-uri "gdi32-sys" "0.2.0"))
(sha256
(base32
"0605d4ngjsspghwjv4jicajich1gnl0aik9f880ajjzjixd524h9"))))
("rust-ws2_32-sys"
,(origin
(method url-fetch)
(uri (crate-uri "ws2_32-sys" "0.2.1"))
(sha256
(base32
"0ppscg5qfqaw0gzwv2a4nhn5bn01ff9iwn6ysqnzm4n8s3myz76m"))))
("rust-user32-sys"
,(origin
(method url-fetch)
(uri (crate-uri "user32-sys" "0.2.0"))
(sha256
(base32
"0ivxc7hmsxax9crdhxdd1nqwik4s9lhb2x59lc8b88bv20fp3x2f"))))
("rust-unicode-bidi"
,(origin
(method url-fetch)
(uri (crate-uri "unicode-bidi" "0.2.3"))
(sha256
(base32
"0gqbyf6slkgzr14nf6v8dw8a19l5snh6bpms8bpfvzpxdawwxxy1"))))
("rust-net2"
,(origin
(method url-fetch)
(uri (crate-uri "net2" "0.2.26"))
(sha256
(base32
"1qp3q6xynb481rsp3ig1nmqb6qlxfba3shfrmqij88cppsv9rpsy"))))
("rust-utf8-ranges"
,(origin
(method url-fetch)
(uri (crate-uri "utf8-ranges" "0.1.3"))
(sha256
(base32
"03xf604b2v51ag3jgzw92l97xnb10kw9zv948bhc7ja1ik017jm1"))))
("rust-crossbeam"
,(origin
(method url-fetch)
(uri (crate-uri "crossbeam" "0.2.10"))
(sha256
(base32
"15wga0kvk3iqf3l077957j931brf1pl3p74xibd698jccqas4phc"))))
("rust-toml"
,(origin
(method url-fetch)
(uri (crate-uri "toml" "0.2.1"))
(sha256
(base32
"1d1cz43bxrx4fd6j2p6myckf81f72bp47akg36y3flxjkhj60svk"))))
("rust-aho-corasick"
,(origin
(method url-fetch)
(uri (crate-uri "aho-corasick" "0.5.3"))
(sha256
(base32
"0rnvdmlajikq0i4zdy1p3pv699q6apvsxfc7av7byhppllp2r5ya"))))
("rust-psapi-sys"
,(origin
(method url-fetch)
(uri (crate-uri "psapi-sys" "0.1.0"))
(sha256
(base32
"0y14g8qshsfnmb7nk2gs1rpbrs1wrggajmzp4yby4q6k0wd5vkdb"))))
("rust-idna"
,(origin
(method url-fetch)
(uri (crate-uri "idna" "0.1.0"))
(sha256
(base32
"049c2rmlydrrrgrxdaq2v21adx9vkfh6k9x4xj56ckyf01p26lqh"))))
("rust-url"
,(origin
(method url-fetch)
(uri (crate-uri "url" "1.2.3"))
(sha256
(base32
"1myr1i8djbl2bhvvrm6n3h7bj7sl6kh5dmaaz2f7c6x8hyyzgk28"))))
("rust-regex-syntax"
,(origin
(method url-fetch)
(uri (crate-uri "regex-syntax" "0.3.9"))
(sha256
(base32
"0ms9hgdhhsxw9w920i7gipydvagf100bb56jbs192rz86ln01v7r"))))
("rust-kernel32-sys"
,(origin
(method url-fetch)
(uri (crate-uri "kernel32-sys" "0.2.2"))
(sha256
(base32
"1389av0601a9yz8dvx5zha9vmkd6ik7ax0idpb032d28555n41vm"))))
("rust-term"
,(origin
(method url-fetch)
(uri (crate-uri "term" "0.4.4"))
(sha256
(base32
"0jpr7jb1xidadh0arklwr99r8w1k1dfc4an3ginpsq5nnfigivrx"))))
("rust-thread-id"
,(origin
(method url-fetch)
(uri (crate-uri "thread-id" "2.0.0"))
(sha256
(base32
"00zzs2bx1xw8aqm5plqqgr7bc2zz6zkqrdxq8vpiqb8hc2srslx9"))))
("rust-thread_local"
,(origin
(method url-fetch)
(uri (crate-uri "thread_local" "0.2.7"))
(sha256
(base32
"1mgxikqvhpsic6xk7pan95lvgsky1sdxzw2w5m2l35pgrazxnxl5"))))
("rust-miow"
,(origin
(method url-fetch)
(uri (crate-uri "miow" "0.1.3"))
(sha256
(base32
"16jvfjsp6fr4mbd2sw5hcdmi4dsa0m0aa45gjz78mb1h4mwcdgym"))))
("rust-regex"
,(origin
(method url-fetch)
(uri (crate-uri "regex" "0.1.80"))
(sha256
(base32
"0bs036h3vzc6pj5jj4vc909s9rppq7b808ic99qn0y6gm3karm2g"))))
("rust-num_cpus"
,(origin
(method url-fetch)
(uri (crate-uri "num_cpus" "1.1.0"))
(sha256
(base32
"1bfwcn3yhwa31rinjw9yr7b6gvn6c06hnwnjz06pvm938w4fd448"))))
("rust-libgit2-sys"
,(origin
(method url-fetch)
(uri (crate-uri "libgit2-sys" "0.6.6"))
(sha256
(base32
"074h9q4p60xh6canb0sj4vrc801wqv6p53l9lp0q724bkwzf7967"))))
("rust-env_logger"
,(origin
(method url-fetch)
(uri (crate-uri "env_logger" "0.3.5"))
(sha256
(base32
"0bvcjgkw4s3k1rd7glpflgc8s9a393zjd6jfdgvs8gjvwj0dgaqm"))))
("rust-openssl-probe"
,(origin
(method url-fetch)
(uri (crate-uri "openssl-probe" "0.1.0"))
(sha256
(base32
"0689h6rhzy6dypqr90lsxnf108nsnh952wsx7ggs70s48b44jvbm"))))
("rust-lazy_static"
,(origin
(method url-fetch)
(uri (crate-uri "lazy_static" "0.2.2"))
(sha256
(base32
"16z1h7w702sxnscak38jykxlhxq0b5ip4mndlb46pkaqwzi0xgka"))))
("rust-semver-parser"
,(origin
(method url-fetch)
(uri (crate-uri "semver-parser" "0.6.1"))
(sha256
(base32
"1s8s7a7yg8xhgci17y0xhyyncg229byivhpr0wbs3ljdlyjl73p8"))))
("rust-semver"
,(origin
(method url-fetch)
(uri (crate-uri "semver" "0.5.1"))
(sha256
(base32
"1xbiv8l72rmngb3lgbmk3vd4lalcbzxcnrn085c2b75irl7gcbxf"))))
("rust-docopt"
,(origin
(method url-fetch)
(uri (crate-uri "docopt" "0.6.86"))
(sha256
(base32
"1nf4f4zf5yk0d0l4kl7hkii4na22fhn0l2hgfb46yzv08l2g6zja"))))
("rust-miniz-sys"
,(origin
(method url-fetch)
(uri (crate-uri "miniz-sys" "0.1.7"))
(sha256
(base32
"0m7dlggsxash0k5jkx576p556g9r8vnhyl9244gjxhq1g8rls7wx"))))
("rust-curl"
,(origin
(method url-fetch)
(uri (crate-uri "curl" "0.4.1"))
(sha256
(base32
"1b0y27b6vpqffgzm2kxc1s2i6bgdzxk3wn65g2asbcdxrvys3mcg"))))
("rust-flate2"
,(origin
(method url-fetch)
(uri (crate-uri "flate2" "0.2.14"))
(sha256
(base32
"1fx3zsls5bb1zfx87s5sxkgk853z4nhjsbvq5s6if13kjlg4isry"))))
("rust-git2"
,(origin
(method url-fetch)
(uri (crate-uri "git2" "0.6.3"))
(sha256
(base32
"06b1bw3pwszs8617xn8js6h0j983qjgfwsychw33lshccj3cld05"))))
("rust-crates-io"
,(origin
(method url-fetch)
(uri (crate-uri "crates-io" "0.4.0"))
(sha256
(base32
"0kk6abp1qbpv44hkq1yjp7xgpzjzafs83i1l26ycr0aph1gbwig9"))))
("rust-git2-curl"
,(origin
(method url-fetch)
(uri (crate-uri "git2-curl" "0.7.0"))
(sha256
(base32
"13mzqp4rd81zp78261rlq23iw9aaysdr56484y1yy2xzhk3nnrv8"))))
("rust-bufstream"
,(origin
(method url-fetch)
(uri (crate-uri "bufstream" "0.1.2"))
(sha256
(base32
"0x6h27md1fwabbhbycfldj0wklrpjr520z9p0cpzm60fzzidnj3v"))))
("rust-hamcrest"
,(origin
(method url-fetch)
(uri (crate-uri "hamcrest" "0.1.1"))
(sha256
(base32
"1m49rf7bnkx0qxja56slrjh44zi4z5bjz5x4pblqjw265828y25z"))))
("rust-num"
,(origin
(method url-fetch)
(uri (crate-uri "num" "0.1.36"))
(sha256
(base32
"081i1r3mdz6jasqd7qwraqqfqa3sdpvdvxl1xq0s7ip714xw1rxx"))))
("rust-num-traits"
,(origin
(method url-fetch)
(uri (crate-uri "num-traits" "0.1.36"))
(sha256
(base32
"07688sp4z40p14lh5ywvrpm4zq8kcxzhjks8sg33jsr5da2l4sm1"))))
("rust-num-integer"
,(origin
(method url-fetch)
(uri (crate-uri "num-integer" "0.1.32"))
(sha256
(base32
"14pvaaawl0pgdcgh4dfdd67lz58yxlfl95bry86h28pjnfzxj97v"))))
("rust-num-bigint"
,(origin
(method url-fetch)
(uri (crate-uri "num-bigint" "0.1.35"))
(sha256
(base32
"0jayfkdm33p4zvcahlv46zdfhlzg053mpw32abf2lz0z8xw47cc8"))))
("rust-num-rational"
,(origin
(method url-fetch)
(uri (crate-uri "num-rational" "0.1.35"))
(sha256
(base32
"1bwaygv64qg7i78yqg0v4d0amfhamj598rpy4yxjz9rlhcxn1zsl"))))
("rust-num-iter"
,(origin
(method url-fetch)
(uri (crate-uri "num-iter" "0.1.32"))
(sha256
(base32
"0p74nj5c1mc33h9lx4wpmlmggmn5lnkhxv1225g0aix8d6ciqyi8"))))
("rust-num-complex"
,(origin
(method url-fetch)
(uri (crate-uri "num-complex" "0.1.35"))
(sha256
(base32
"0bzrjfppnnzf9vmkpklhp2dw9sb1lqzydb8r6k83z76i9l2qxizh"))))
("rust-shell-escape"
,(origin
(method url-fetch)
(uri (crate-uri "shell-escape" "0.1.3"))
(sha256
(base32
"1y2fp2brv639icv4a0fdqs1zhlrxq8qbz27ygfa86ifmh5jcjp6x"))))))
(arguments
`(#:cargo ,cargo-bootstrap
#:tests? #f ; FIXME
#:modules
((ice-9 match)
(srfi srfi-1) ; 'every
(guix build utils)
(guix build cargo-build-system))
#:phases
(modify-phases %standard-phases
;; Avoid cargo complaining about missmatched checksums.
(delete 'patch-source-shebangs)
(delete 'patch-generated-file-shebangs)
(delete 'patch-usr-bin-file)
(add-after 'unpack 'unpack-submodule-sources
(lambda* (#:key inputs #:allow-other-keys)
(define (unpack source target)
(mkdir-p target)
(with-directory-excursion target
(zero? (system* "tar" "xf"
source
"--strip-components=1"))))
(define (touch file-name)
(call-with-output-file file-name (const #t)))
(define (install-rust-library entry)
(match entry
((name . src)
(if (string-prefix? "rust-" name)
(let* ((rust-length (string-length "rust-"))
(rust-name (string-drop name
rust-length))
(rsrc (string-append "vendor/"
rust-name))
(unpack-status (unpack src rsrc)))
(touch (string-append rsrc "/.cargo-ok"))
(generate-checksums rsrc src)
unpack-status)))
(_ #t)))
(mkdir "vendor")
(every install-rust-library inputs)))
(add-after 'unpack 'set-environment-up
(lambda* (#:key inputs #:allow-other-keys)
(let* ((gcc (assoc-ref inputs "gcc"))
(cc (string-append gcc "/bin/gcc")))
(mkdir ".cargo")
(call-with-output-file ".cargo/config"
(lambda (p)
(format p "
[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'vendored-sources'
[source.vendored-sources]
directory = 'vendor'
")))
(setenv "CMAKE_C_COMPILER" cc)
;; TODO CC_i686_unknown_linux_gnu=gcc
(setenv "CC" cc))
#t))
(delete 'configure))))
(home-page "https://github.com/rust-lang/cargo")
(synopsis "Build tool and package manager for Rust")
(description "Cargo is a tool that allows Rust projects to declare their
dependencies and ensures a reproducible build.")
;; Cargo is dual licensed Apache and MIT. Also contains
;; code from openssl which is GPL2 with linking exception.
(license (list license:asl2.0 license:expat license:gpl2))))
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2017-11-29 8:05 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-12 16:50 [bug#28433] [WIP] Rust update Danny Milosavljevic
2017-10-25 14:19 ` Ricardo Wurmus
2017-10-26 8:17 ` Danny Milosavljevic
2017-10-28 10:42 ` Danny Milosavljevic
2017-10-28 11:31 ` Danny Milosavljevic
2017-10-28 11:57 ` Danny Milosavljevic
2017-10-28 18:26 ` Ludovic Courtès
2017-10-30 11:35 ` Danny Milosavljevic
2017-10-30 15:38 ` Ludovic Courtès
2017-10-30 16:14 ` Danny Milosavljevic
2017-11-28 6:35 ` ng0
2017-11-28 10:12 ` Danny Milosavljevic
2017-11-29 8:04 ` Danny Milosavljevic
2017-10-28 15:36 ` ng0
2017-10-28 18:32 ` Ludovic Courtès
2017-10-30 19:18 ` [bug#28433] [WIP] v2 " Danny Milosavljevic
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).