Subject: building rust on aarch64

From: Efraim Flashner <[email-masked]>
Date: Thu, 22 Mar 2018 09:20:12 +0200

I tested the patch on my aarch64 box and with the following patch I was
able to start the building process. Currently rust fails its test stage
with the error:

test result: ok. 193 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out

        finished in 267.991
Testing libstd stage1 (aarch64-unknown-linux-gnu -> aarch64-unknown-linux-gnu)
   Compiling libc v0.2.34
   Compiling core v0.0.0 (file:///tmp/guix-build-rust-1.24.1.drv-0/rustc-1.24.1-src/src/libcore)
   Compiling std_unicode v0.0.0 (file:///tmp/guix-build-rust-1.24.1.drv-0/rustc-1.24.1-src/src/libstd_unicode)
   Compiling rand v0.3.19
   Compiling std v0.0.0 (file:///tmp/guix-build-rust-1.24.1.drv-0/rustc-1.24.1-src/src/libstd)
   Compiling alloc v0.0.0 (file:///tmp/guix-build-rust-1.24.1.drv-0/rustc-1.24.1-src/src/liballoc)
error: unused attribute
   --> src/libstd/sys/unix/process/process_common.rs:449:5
    |
449 |     #[ignore]
    |     ^^^^^^^^^
    |
note: lint level defined here
   --> src/libstd/lib.rs:232:9
    |
232 | #![deny(warnings)]
    |         ^^^^^^^^
    = note: #[deny(unused_attributes)] implied by #[deny(warnings)]

error: aborting due to previous error

error: Could not compile `std`.
warning: build failed, waiting for other jobs to finish...
error: build failed

command did not execute successfully: "/gnu/store/3vvhw5xpbcym5l3xk2pszzzyx4m7k8l6-cargo-bootstrap-0.24.0/bin/cargo" "test" "--target" "aarch64-unknown-linux-gnu" "-j" "6" "--release" "--frozen" "--features" "panic-unwind jemalloc backtrace" "--manifest-p
ath" "/tmp/guix-build-rust-1.24.1.drv-0/rustc-1.24.1-src/src/libstd/Cargo.toml" "-p" "std:0.0.0" "-p" "libc:0.0.0" "-p" "alloc_system:0.0.0" "-p" "panic_abort:0.0.0" "-p" "compiler_builtins:0.0.0" "-p" "alloc:0.0.0" "-p" "std_unicode:0.0.0" "-p" "unwind:0
.0.0" "-p" "core:0.0.0" "--"
expected success, got: exit code: 101

failed to run: /tmp/guix-build-rust-1.24.1.drv-0/rustc-1.24.1-src/build/bootstrap/debug/bootstrap test
Build completed unsuccessfully in 1:53:33
phase `check' failed after 6813.3 seconds

This is ultimately no different from master, where rust currently fails
somewhere during the test stage.

-- 
Efraim Flashner   <[email-masked]>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
From d3f6c14535163be65aedfc761b747c4386387537 Mon Sep 17 00:00:00 2001
From: Efraim Flashner <[email-masked]>
Date: Thu, 22 Mar 2018 09:14:53 +0200
Subject: [PATCH] don't build native on arm*

---
 gnu/packages/rust.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index ae81ff8e0..5c5a61594 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -259,6 +259,11 @@ rustc-bootstrap and cargo-bootstrap packages.")
              ;; guix llvm-3.9.1 package installs only shared libraries
              (setenv "LLVM_LINK_SHARED" "1")
              #t))
+         (add-after 'unpack 'dont-build-native
+           (lambda _
+             (substitute* "src/binaryen/CMakeLists.txt"
+               (("ADD_COMPILE_FLAG\\(\\\"-march=native\\\"\\)") ""))
+             #t))
          (add-after 'unpack 'patch-tests
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((bash (assoc-ref inputs "bash")))
-- 
2.16.2