From: Danny Milosavljevic <dannym@scratchpost.org>
To: 28433@debbugs.gnu.org
Subject: [bug#28433] [WIP] v2 Rust update
Date: Mon, 30 Oct 2017 20:18:20 +0100 [thread overview]
Message-ID: <20171030201820.6e2aa96d@scratchpost.org> (raw)
In-Reply-To: <20170912185023.7de883ff@scratchpost.org>
[-- 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))))
prev parent reply other threads:[~2017-10-30 19:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Danny Milosavljevic [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171030201820.6e2aa96d@scratchpost.org \
--to=dannym@scratchpost.org \
--cc=28433@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.