From b47b2d32084ae689ff73ebb6403f1cc145131ea3 Mon Sep 17 00:00:00 2001 From: Nikolai Merinov Date: Wed, 4 Jul 2018 16:27:11 +0200 Subject: gnu: rust: Support build with glibc-2.27; update to 1.26.2. * gnu/packages/rust.scm (rust-source): Add "patches" argument. (rust-bootstrapped-package): Add "patches" argument. (rust-1.19)[arguments]<#:phases>[patch-tests]: Modify. [arguments]<#:phases>[patch-aarch64-test]: New phase. [arguments]<#:phases>[use-readelf-for-tests]: New phase. [arguments]<#:phases>[remove-unsupported-tests]: New phase. (rust-1.23): Disable "run-pass/out-of-stack.rs" test. (rust-1.24)[arguments]<#:phases>[patch-aarch64-test]: Replace. (rust-1.25)[inputs]: Switch to LLVM 6.0. (rust-1.25)[arguments]<#:phases>[enable-codegen-tests]: New variable. (rust): New variable. * gnu/packages/patches/rust-coresimd-doctest.patch: New file. --- gnu/packages/rust.scm | 168 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 109 insertions(+), 59 deletions(-) (limited to 'gnu/packages/rust.scm') diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 7fcc795b6f1..6d3554a3a70 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -157,14 +157,15 @@ in turn be used to build the final Rust.") (license license:asl2.0))) -(define (rust-source version hash) +(define* (rust-source version hash #:key (patches '())) (origin (method url-fetch) (uri (string-append "https://static.rust-lang.org/dist/" "rustc-" version "-src.tar.gz")) (sha256 (base32 hash)) (modules '((guix build utils))) - (snippet '(begin (delete-file-recursively "src/llvm") #t)))) + (snippet '(begin (delete-file-recursively "src/llvm") #t)) + (patches (map search-patch patches)))) (define-public rust-1.19 (package @@ -203,20 +204,29 @@ in turn be used to build the final Rust.") (("fn test_process_mask") "#[allow(unused_attributes)] #[ignore] fn test_process_mask")) - ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH. - ;; - (delete-file-recursively "src/test/run-make/linker-output-non-utf8") - (substitute* "src/librustc_back/dynamic_lib.rs" - ;; This test is known to fail on aarch64 and powerpc64le: - ;; https://github.com/rust-lang/rust/issues/45410 - (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine")) - ;; nm doesn't recognize the file format because of the - ;; nonstandard sections used by the Rust compiler, but readelf - ;; ignores them. - (substitute* "src/test/run-make/atomic-lock-free/Makefile" - (("\tnm ") - "\treadelf -c ")) #t))) + (add-after 'patch-tests 'patch-aarch64-test + (lambda* _ + (substitute* "src/librustc_back/dynamic_lib.rs" + ;; This test is known to fail on aarch64 and powerpc64le: + ;; https://github.com/rust-lang/rust/issues/45410 + (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine")) + #t)) + (add-after 'patch-tests 'use-readelf-for-tests + (lambda* _ + ;; nm doesn't recognize the file format because of the + ;; nonstandard sections used by the Rust compiler, but readelf + ;; ignores them. + (substitute* "src/test/run-make/atomic-lock-free/Makefile" + (("\tnm ") + "\treadelf -c ")) + #t)) + (add-after 'patch-tests 'remove-unsupported-tests + (lambda* _ + ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH. + ;; + (delete-file-recursively "src/test/run-make/linker-output-non-utf8") + #t)) (add-after 'patch-source-shebangs 'patch-cargo-checksums (lambda* _ (substitute* "src/Cargo.lock" @@ -279,13 +289,14 @@ safety and thread safety guarantees.") ;; Dual licensed. (license (list license:asl2.0 license:expat)))) -(define (rust-bootstrapped-package base-rust version checksum) - "Bootstrap rust VERSION with source checksum CHECKSUM using BASE-RUST." +(define* (rust-bootstrapped-package base-rust version checksum + #:key (patches '())) + "Bootstrap rust VERSION with source checksum CHECKSUM patched with PATCHES using BASE-RUST." (package (inherit base-rust) (version version) (source - (rust-source version checksum)) + (rust-source version checksum #:patches patches)) (native-inputs (alist-replace "cargo-bootstrap" (list base-rust "cargo") (alist-replace "rustc-bootstrap" (list base-rust) @@ -410,7 +421,12 @@ safety and thread safety guarantees.") (substitute* "src/tools/cargo/tests/test.rs" (("fn cargo_test_env") "#[ignore]\nfn cargo_test_env")) #t)) - (add-after 'patch-cargo-tests 'fix-mtime-bug + (add-after 'patch-cargo-tests 'ignore-glibc-2.27-incompatible-test + ;; https://github.com/rust-lang/rust/issues/47863 + (lambda _ + (substitute* "src/test/run-pass/out-of-stack.rs" + (("// ignore-android") "// ignore-test\n// ignore-android")))) + (add-after 'ignore-glibc-2.27-incompatible-test 'fix-mtime-bug (lambda* _ (substitute* "src/build_helper/lib.rs" ;; Bug in Rust code. @@ -452,10 +468,10 @@ localstatedir = \"var/lib\" default-linker = \"" gcc "/bin/gcc" "\" channel = \"stable\" rpath = true -# There is 2 failed codegen tests: -# codegen/mainsubprogram.rs and codegen/mainsubprogramstart.rs -# This tests required patched LLVM -codegen-tests = false +" ;; There are 2 failed codegen tests: + ;; codegen/mainsubprogram.rs and codegen/mainsubprogramstart.rs + ;; These tests require a patched LLVM +"codegen-tests = false [target." ,(nix-system->gnu-triplet-for-rust) "] llvm-config = \"" llvm "/bin/llvm-config" "\" cc = \"" gcc "/bin/gcc" "\" @@ -513,45 +529,26 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" (substitute-keyword-arguments (package-arguments base-rust) ((#:phases phases) `(modify-phases ,phases - (replace 'patch-tests - (lambda* (#:key inputs #:allow-other-keys) - (let ((bash (assoc-ref inputs "bash"))) - (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 "\n\"" bash "/bin/sh\""))) - (substitute* "src/libstd/net/tcp.rs" - ;; There is no network in build environment - (("fn connect_timeout_unroutable") - "#[ignore]\nfn connect_timeout_unroutable")) - ;; - (substitute* "src/libstd/sys/unix/process/process_common.rs" - (("fn test_process_mask") "#[allow(unused_attributes)] - #[ignore] - fn test_process_mask")) - ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH. - ;; - (delete-file-recursively "src/test/run-make/linker-output-non-utf8") - (substitute* "src/librustc_metadata/dynamic_lib.rs" - ;; This test is known to fail on aarch64 and powerpc64le: - ;; https://github.com/rust-lang/rust/issues/45410 - (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine")) - #t))) + (delete 'use-readelf-for-tests) + (replace 'patch-aarch64-test + (lambda* _ + (substitute* "src/librustc_metadata/dynamic_lib.rs" + ;; This test is known to fail on aarch64 and powerpc64le: + ;; https://github.com/rust-lang/rust/issues/45410 + (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine")) + #t)) (delete 'fix-mtime-bug)))))))) -(define-public rust - (let ((base-rust rust-1.24)) +(define-public rust-1.25 + (let ((base-rust + (rust-bootstrapped-package rust-1.24 "1.25.0" + "0baxjr99311lvwdq0s38bipbnj72pn6fgbk6lcq7j555xq53mxpf"))) (package (inherit base-rust) - (version "1.25.0") - (source - (rust-source version - "0baxjr99311lvwdq0s38bipbnj72pn6fgbk6lcq7j555xq53mxpf")) - (native-inputs - (alist-replace "cargo-bootstrap" (list base-rust "cargo") - (alist-replace "rustc-bootstrap" (list base-rust) - (package-native-inputs base-rust)))) + (inputs + ;; Use LLVM 6.0 + (alist-replace "llvm" (list llvm) + (package-inputs base-rust))) (arguments (substitute-keyword-arguments (package-arguments base-rust) ((#:phases phases) @@ -560,4 +557,57 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" (lambda* _ (substitute* "src/tools/cargo/tests/generate-lockfile.rs" ;; This test wants to update the crate index. - (("fn no_index_update") "#[ignore]\nfn no_index_update"))))))))))) + (("fn no_index_update") "#[ignore]\nfn no_index_update")))) + (add-after 'configure 'enable-codegen-tests + (lambda* _ + (substitute* "config.toml" + (("codegen-tests = false") "")))) + (delete 'ignore-glibc-2.27-incompatible-test)))))))) + +(define-public rust + (let ((base-rust + (rust-bootstrapped-package rust-1.25 "1.26.2" + "0047ais0fvmqvngqkdsxgrzhb0kljg8wy85b01kbbjc88hqcz7pv" + #:patches '("rust-coresimd-doctest.patch")))) + (package + (inherit base-rust) + (arguments + (substitute-keyword-arguments (package-arguments base-rust) + ((#:phases phases) + `(modify-phases ,phases + ;; binaryen was replaced with LLD project from LLVM + (delete 'dont-build-native) + (replace 'remove-unsupported-tests + (lambda* _ + ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH. + ;; + (delete-file-recursively "src/test/run-make-fulldeps/linker-output-non-utf8") + #t)) + (replace 'patch-cargo-tests + (lambda* _ + (substitute* "src/tools/cargo/tests/testsuite/build.rs" + (("/usr/bin/env") (which "env")) + ;; Guix llvm is compiled without asmjs-unknown-emscripten. + (("fn wasm32_final_outputs") "#[ignore]\nfn wasm32_final_outputs")) + (substitute* "src/tools/cargo/tests/testsuite/death.rs" + ;; This is stuck when built in container. + (("fn ctrl_c_kills_everyone") "#[ignore]\nfn ctrl_c_kills_everyone")) + ;; Prints test output in the wrong order when built on + ;; i686-linux. + (substitute* "src/tools/cargo/tests/testsuite/test.rs" + (("fn cargo_test_env") "#[ignore]\nfn cargo_test_env")) + #t)) + (add-after 'patch-cargo-tests 'disable-cargo-test-for-nightly-channel + (lambda* _ + ;; This test failed to work on "nightly" channel builds + ;; https://github.com/rust-lang/cargo/issues/5648 + (substitute* "src/tools/cargo/tests/testsuite/resolve.rs" + (("fn test_resolving_minimum_version_with_transitive_deps") + "#[ignore]\nfn test_resolving_minimum_version_with_transitive_deps")) + #t)) + (replace 'patch-cargo-index-update + (lambda* _ + (substitute* "src/tools/cargo/tests/testsuite/generate_lockfile.rs" + ;; This test wants to update the crate index. + (("fn no_index_update") "#[ignore]\nfn no_index_update")) + #t))))))))) -- cgit v1.3 From f510a2b93b75ee02e4a17816d2808a37c7b84c3a Mon Sep 17 00:00:00 2001 From: Nikolai Merinov Date: Sat, 30 Jun 2018 14:34:49 +0500 Subject: gnu: rust: Update to 1.27.0. * gnu/packages/rust.scm (rust): Rename to... (rust-1.26): ...this. (rust): New variable. * gnu/packages/patches/rust-bootstrap-stage0-test.patch: New file. --- .../patches/rust-bootstrap-stage0-test.patch | 55 ++++++++++++++++++++++ gnu/packages/rust.scm | 23 ++++++++- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/rust-bootstrap-stage0-test.patch (limited to 'gnu/packages/rust.scm') diff --git a/gnu/packages/patches/rust-bootstrap-stage0-test.patch b/gnu/packages/patches/rust-bootstrap-stage0-test.patch new file mode 100644 index 00000000000..e8484903e5c --- /dev/null +++ b/gnu/packages/patches/rust-bootstrap-stage0-test.patch @@ -0,0 +1,55 @@ +Bootstrap tests failed with local stage0 cargo and rustc +Backported changes from https://github.com/rust-lang/rust/pull/51977 + +From 0834d9d771e912f51deca6c25699e44734624546 Mon Sep 17 00:00:00 2001 +From: Nikolai Merinov +Date: Mon, 2 Jul 2018 01:45:35 +0500 +Subject: [PATCH] bootstrap: tests should use rustc from config.toml + +Tests should always use "rustc" and "cargo" from config.toml instead +of assuming that stage0 binaries was downloaded to build directory. +--- + src/bootstrap/bootstrap.py | 2 ++ + src/bootstrap/config.rs | 6 ++---- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py +index 487440becf..1701f7b83a 100644 +--- a/src/bootstrap/bootstrap.py ++++ b/src/bootstrap/bootstrap.py +@@ -788,6 +788,8 @@ def bootstrap(help_triggered): + env["BOOTSTRAP_PARENT_ID"] = str(os.getpid()) + env["BOOTSTRAP_PYTHON"] = sys.executable + env["BUILD_DIR"] = build.build_dir ++ env["CARGO"] = build.cargo() ++ env["RUSTC"] = build.rustc() + run(args, env=env, verbose=build.verbose) + + +diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs +index 6dd6291be2..d1a0deb583 100644 +--- a/src/bootstrap/config.rs ++++ b/src/bootstrap/config.rs +@@ -23,7 +23,6 @@ use std::cmp; + + use num_cpus; + use toml; +-use util::exe; + use cache::{INTERNER, Interned}; + use flags::Flags; + pub use flags::Subcommand; +@@ -362,9 +361,8 @@ impl Config { + config.src = Config::path_from_python("SRC"); + config.out = Config::path_from_python("BUILD_DIR"); + +- let stage0_root = config.out.join(&config.build).join("stage0/bin"); +- config.initial_rustc = stage0_root.join(exe("rustc", &config.build)); +- config.initial_cargo = stage0_root.join(exe("cargo", &config.build)); ++ config.initial_rustc = Config::path_from_python("RUSTC"); ++ config.initial_cargo = Config::path_from_python("CARGO"); + + config + } +-- +2.17.1 + diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 6d3554a3a70..bb6fea99a04 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -564,7 +564,7 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" (("codegen-tests = false") "")))) (delete 'ignore-glibc-2.27-incompatible-test)))))))) -(define-public rust +(define-public rust-1.26 (let ((base-rust (rust-bootstrapped-package rust-1.25 "1.26.2" "0047ais0fvmqvngqkdsxgrzhb0kljg8wy85b01kbbjc88hqcz7pv" @@ -611,3 +611,24 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" ;; This test wants to update the crate index. (("fn no_index_update") "#[ignore]\nfn no_index_update")) #t))))))))) + +(define-public rust + (let ((base-rust + (rust-bootstrapped-package rust-1.26 "1.27.0" + "089d7rhw55zpvnw71dj8vil6qrylvl4xjr4m8bywjj83d4zq1f9c" + #:patches + '("rust-coresimd-doctest.patch" + "rust-bootstrap-stage0-test.patch")))) + (package + (inherit base-rust) + (arguments + (substitute-keyword-arguments (package-arguments base-rust) + ((#:phases phases) + `(modify-phases ,phases + (add-before 'install 'mkdir-prefix-paths + (lambda* (#:key outputs #:allow-other-keys) + ;; As result of https://github.com/rust-lang/rust/issues/36989 + ;; `prefix' directory should exist before `install' call + (mkdir-p (assoc-ref outputs "out")) + (mkdir-p (assoc-ref outputs "cargo")) + #t))))))))) -- cgit v1.3 From 4f963b6f29b850b1dcb1270cca3075417dc4962f Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 15 Jul 2018 21:47:30 +0300 Subject: gnu: rust@1.19: Don't make public. * gnu/packages/rust.scm (rust@1.19): Don't make it a public variable. --- gnu/packages/rust.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/packages/rust.scm') diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index bb6fea99a04..761f3966c9e 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -167,7 +167,7 @@ in turn be used to build the final Rust.") (snippet '(begin (delete-file-recursively "src/llvm") #t)) (patches (map search-patch patches)))) -(define-public rust-1.19 +(define rust-1.19 (package (name "rust") (version "1.19.0") -- cgit v1.3 From 080e11b48e6af05f6d051bfab6b4bd7830ef664c Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 15 Jul 2018 21:49:21 +0300 Subject: gnu: rust@1.25: Fix build on aarch64-linux. * gnu/packages/rust.scm (rust@1.25)[arguments]: Replace inherited custom 'patch-aarch64-test phase. Make sure all phases return #t. --- gnu/packages/rust.scm | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'gnu/packages/rust.scm') diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 761f3966c9e..28bffb44bb5 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -554,14 +554,28 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" ((#:phases phases) `(modify-phases ,phases (add-after 'patch-cargo-tests 'patch-cargo-index-update - (lambda* _ + (lambda _ (substitute* "src/tools/cargo/tests/generate-lockfile.rs" ;; This test wants to update the crate index. - (("fn no_index_update") "#[ignore]\nfn no_index_update")))) + (("fn no_index_update") "#[ignore]\nfn no_index_update")) + #t)) (add-after 'configure 'enable-codegen-tests - (lambda* _ + (lambda _ (substitute* "config.toml" - (("codegen-tests = false") "")))) + (("codegen-tests = false") "")) + #t)) + (replace 'patch-aarch64-test + (lambda _ + (substitute* "src/librustc_metadata/dynamic_lib.rs" + ;; This test is known to fail on aarch64 and powerpc64le: + ;; https://github.com/rust-lang/rust/issues/45410 + (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine")) + ;; This test fails on aarch64 with llvm@6.0: + ;; https://github.com/rust-lang/rust/issues/49807 + ;; other possible solution: + ;; https://github.com/rust-lang/rust/pull/47688 + (delete-file "src/test/debuginfo/by-value-self-argument-in-trait-impl.rs") + #t)) (delete 'ignore-glibc-2.27-incompatible-test)))))))) (define-public rust-1.26 -- cgit v1.3