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.
This commit is contained in:
parent
6094a65e27
commit
b47b2d3208
|
@ -0,0 +1,21 @@
|
||||||
|
Doctest coresimd::x86::__m256 failed on processors withouth "avx" feature.
|
||||||
|
Backported patch with changes from https://github.com/rust-lang-nursery/stdsimd/issues/481
|
||||||
|
|
||||||
|
--- rustc-1.26.2-src-orig/src/stdsimd/coresimd/x86/mod.rs 1970-01-01 05:00:00.000000000 +0500
|
||||||
|
+++ rustc-1.26.2-src/src/stdsimd/coresimd/x86/mod.rs 2018-06-22 00:01:55.142026720 +0500
|
||||||
|
@@ -293,13 +293,13 @@
|
||||||
|
/// use std::arch::x86_64::*;
|
||||||
|
///
|
||||||
|
/// # fn main() {
|
||||||
|
- /// # #[target_feature(enable = "sse")]
|
||||||
|
+ /// # #[target_feature(enable = "avx")]
|
||||||
|
/// # unsafe fn foo() {
|
||||||
|
/// let eight_zeros = _mm256_setzero_ps();
|
||||||
|
/// let eight_ones = _mm256_set1_ps(1.0);
|
||||||
|
/// let eight_floats = _mm256_set_ps(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0);
|
||||||
|
/// # }
|
||||||
|
- /// # if is_x86_feature_detected!("sse") { unsafe { foo() } }
|
||||||
|
+ /// # if is_x86_feature_detected!("avx") { unsafe { foo() } }
|
||||||
|
/// # }
|
||||||
|
/// ```
|
||||||
|
pub struct __m256(f32, f32, f32, f32, f32, f32, f32, f32);
|
|
@ -157,14 +157,15 @@ in turn be used to build the final Rust.")
|
||||||
(license license:asl2.0)))
|
(license license:asl2.0)))
|
||||||
|
|
||||||
|
|
||||||
(define (rust-source version hash)
|
(define* (rust-source version hash #:key (patches '()))
|
||||||
(origin
|
(origin
|
||||||
(method url-fetch)
|
(method url-fetch)
|
||||||
(uri (string-append "https://static.rust-lang.org/dist/"
|
(uri (string-append "https://static.rust-lang.org/dist/"
|
||||||
"rustc-" version "-src.tar.gz"))
|
"rustc-" version "-src.tar.gz"))
|
||||||
(sha256 (base32 hash))
|
(sha256 (base32 hash))
|
||||||
(modules '((guix build utils)))
|
(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
|
(define-public rust-1.19
|
||||||
(package
|
(package
|
||||||
|
@ -203,20 +204,29 @@ in turn be used to build the final Rust.")
|
||||||
(("fn test_process_mask") "#[allow(unused_attributes)]
|
(("fn test_process_mask") "#[allow(unused_attributes)]
|
||||||
#[ignore]
|
#[ignore]
|
||||||
fn test_process_mask"))
|
fn test_process_mask"))
|
||||||
;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH.
|
#t)))
|
||||||
;; <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00193.html>
|
(add-after 'patch-tests 'patch-aarch64-test
|
||||||
(delete-file-recursively "src/test/run-make/linker-output-non-utf8")
|
(lambda* _
|
||||||
(substitute* "src/librustc_back/dynamic_lib.rs"
|
(substitute* "src/librustc_back/dynamic_lib.rs"
|
||||||
;; This test is known to fail on aarch64 and powerpc64le:
|
;; This test is known to fail on aarch64 and powerpc64le:
|
||||||
;; https://github.com/rust-lang/rust/issues/45410
|
;; https://github.com/rust-lang/rust/issues/45410
|
||||||
(("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine"))
|
(("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
|
;; nm doesn't recognize the file format because of the
|
||||||
;; nonstandard sections used by the Rust compiler, but readelf
|
;; nonstandard sections used by the Rust compiler, but readelf
|
||||||
;; ignores them.
|
;; ignores them.
|
||||||
(substitute* "src/test/run-make/atomic-lock-free/Makefile"
|
(substitute* "src/test/run-make/atomic-lock-free/Makefile"
|
||||||
(("\tnm ")
|
(("\tnm ")
|
||||||
"\treadelf -c "))
|
"\treadelf -c "))
|
||||||
#t)))
|
#t))
|
||||||
|
(add-after 'patch-tests 'remove-unsupported-tests
|
||||||
|
(lambda* _
|
||||||
|
;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH.
|
||||||
|
;; <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00193.html>
|
||||||
|
(delete-file-recursively "src/test/run-make/linker-output-non-utf8")
|
||||||
|
#t))
|
||||||
(add-after 'patch-source-shebangs 'patch-cargo-checksums
|
(add-after 'patch-source-shebangs 'patch-cargo-checksums
|
||||||
(lambda* _
|
(lambda* _
|
||||||
(substitute* "src/Cargo.lock"
|
(substitute* "src/Cargo.lock"
|
||||||
|
@ -279,13 +289,14 @@ safety and thread safety guarantees.")
|
||||||
;; Dual licensed.
|
;; Dual licensed.
|
||||||
(license (list license:asl2.0 license:expat))))
|
(license (list license:asl2.0 license:expat))))
|
||||||
|
|
||||||
(define (rust-bootstrapped-package base-rust version checksum)
|
(define* (rust-bootstrapped-package base-rust version checksum
|
||||||
"Bootstrap rust VERSION with source checksum CHECKSUM using BASE-RUST."
|
#:key (patches '()))
|
||||||
|
"Bootstrap rust VERSION with source checksum CHECKSUM patched with PATCHES using BASE-RUST."
|
||||||
(package
|
(package
|
||||||
(inherit base-rust)
|
(inherit base-rust)
|
||||||
(version version)
|
(version version)
|
||||||
(source
|
(source
|
||||||
(rust-source version checksum))
|
(rust-source version checksum #:patches patches))
|
||||||
(native-inputs
|
(native-inputs
|
||||||
(alist-replace "cargo-bootstrap" (list base-rust "cargo")
|
(alist-replace "cargo-bootstrap" (list base-rust "cargo")
|
||||||
(alist-replace "rustc-bootstrap" (list base-rust)
|
(alist-replace "rustc-bootstrap" (list base-rust)
|
||||||
|
@ -410,7 +421,12 @@ safety and thread safety guarantees.")
|
||||||
(substitute* "src/tools/cargo/tests/test.rs"
|
(substitute* "src/tools/cargo/tests/test.rs"
|
||||||
(("fn cargo_test_env") "#[ignore]\nfn cargo_test_env"))
|
(("fn cargo_test_env") "#[ignore]\nfn cargo_test_env"))
|
||||||
#t))
|
#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* _
|
(lambda* _
|
||||||
(substitute* "src/build_helper/lib.rs"
|
(substitute* "src/build_helper/lib.rs"
|
||||||
;; Bug in Rust code.
|
;; Bug in Rust code.
|
||||||
|
@ -452,10 +468,10 @@ localstatedir = \"var/lib\"
|
||||||
default-linker = \"" gcc "/bin/gcc" "\"
|
default-linker = \"" gcc "/bin/gcc" "\"
|
||||||
channel = \"stable\"
|
channel = \"stable\"
|
||||||
rpath = true
|
rpath = true
|
||||||
# There is 2 failed codegen tests:
|
" ;; There are 2 failed codegen tests:
|
||||||
# codegen/mainsubprogram.rs and codegen/mainsubprogramstart.rs
|
;; codegen/mainsubprogram.rs and codegen/mainsubprogramstart.rs
|
||||||
# This tests required patched LLVM
|
;; These tests require a patched LLVM
|
||||||
codegen-tests = false
|
"codegen-tests = false
|
||||||
[target." ,(nix-system->gnu-triplet-for-rust) "]
|
[target." ,(nix-system->gnu-triplet-for-rust) "]
|
||||||
llvm-config = \"" llvm "/bin/llvm-config" "\"
|
llvm-config = \"" llvm "/bin/llvm-config" "\"
|
||||||
cc = \"" gcc "/bin/gcc" "\"
|
cc = \"" gcc "/bin/gcc" "\"
|
||||||
|
@ -513,45 +529,26 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
|
||||||
(substitute-keyword-arguments (package-arguments base-rust)
|
(substitute-keyword-arguments (package-arguments base-rust)
|
||||||
((#:phases phases)
|
((#:phases phases)
|
||||||
`(modify-phases ,phases
|
`(modify-phases ,phases
|
||||||
(replace 'patch-tests
|
(delete 'use-readelf-for-tests)
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(replace 'patch-aarch64-test
|
||||||
(let ((bash (assoc-ref inputs "bash")))
|
(lambda* _
|
||||||
(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"))
|
|
||||||
;; <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") "#[allow(unused_attributes)]
|
|
||||||
#[ignore]
|
|
||||||
fn test_process_mask"))
|
|
||||||
;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH.
|
|
||||||
;; <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00193.html>
|
|
||||||
(delete-file-recursively "src/test/run-make/linker-output-non-utf8")
|
|
||||||
(substitute* "src/librustc_metadata/dynamic_lib.rs"
|
(substitute* "src/librustc_metadata/dynamic_lib.rs"
|
||||||
;; This test is known to fail on aarch64 and powerpc64le:
|
;; This test is known to fail on aarch64 and powerpc64le:
|
||||||
;; https://github.com/rust-lang/rust/issues/45410
|
;; https://github.com/rust-lang/rust/issues/45410
|
||||||
(("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine"))
|
(("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine"))
|
||||||
#t)))
|
#t))
|
||||||
(delete 'fix-mtime-bug))))))))
|
(delete 'fix-mtime-bug))))))))
|
||||||
|
|
||||||
(define-public rust
|
(define-public rust-1.25
|
||||||
(let ((base-rust rust-1.24))
|
(let ((base-rust
|
||||||
|
(rust-bootstrapped-package rust-1.24 "1.25.0"
|
||||||
|
"0baxjr99311lvwdq0s38bipbnj72pn6fgbk6lcq7j555xq53mxpf")))
|
||||||
(package
|
(package
|
||||||
(inherit base-rust)
|
(inherit base-rust)
|
||||||
(version "1.25.0")
|
(inputs
|
||||||
(source
|
;; Use LLVM 6.0
|
||||||
(rust-source version
|
(alist-replace "llvm" (list llvm)
|
||||||
"0baxjr99311lvwdq0s38bipbnj72pn6fgbk6lcq7j555xq53mxpf"))
|
(package-inputs base-rust)))
|
||||||
(native-inputs
|
|
||||||
(alist-replace "cargo-bootstrap" (list base-rust "cargo")
|
|
||||||
(alist-replace "rustc-bootstrap" (list base-rust)
|
|
||||||
(package-native-inputs base-rust))))
|
|
||||||
(arguments
|
(arguments
|
||||||
(substitute-keyword-arguments (package-arguments base-rust)
|
(substitute-keyword-arguments (package-arguments base-rust)
|
||||||
((#:phases phases)
|
((#:phases phases)
|
||||||
|
@ -560,4 +557,57 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
|
||||||
(lambda* _
|
(lambda* _
|
||||||
(substitute* "src/tools/cargo/tests/generate-lockfile.rs"
|
(substitute* "src/tools/cargo/tests/generate-lockfile.rs"
|
||||||
;; This test wants to update the crate index.
|
;; 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.
|
||||||
|
;; <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00193.html>
|
||||||
|
(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)))))))))
|
||||||
|
|
Loading…
Reference in New Issue