Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Rust, Cargo and Maybe Firefox on arm64
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 46367
Location: 56N 3W

PostPosted: Sat Feb 03, 2018 5:27 pm    Post subject: Rust, Cargo and Maybe Firefox on arm64 Reply with quote

The patch below should apply to the rust-1.23.0-r1.ebuild to make it work on arm64.
Its doing all the right things an my Pi3 right now LLVM is at 16% and its only building the embedded llvm for the Pi.

Don't forget the USE=nativeonly if thats what you want.
The build locks up in my QEMU arm64 chroot but that's not new.

We need the updated cargo too. I'll do that once rust builds

Code:
--- rust-1.23.0-r1.ebuild   2018-02-03 15:09:24.000000000 +0000
+++ rust-1.23.0-r101.ebuild   2018-02-03 16:54:41.000000000 +0000
@@ -19,13 +19,15 @@
    SLOT="stable/${ABI_VER}"
    MY_P="rustc-${PV}"
    SRC="${MY_P}-src.tar.gz"
-   KEYWORDS="~amd64 ~x86"
+   KEYWORDS="~amd64 ~arm64 ~x86"
 fi
 
 CHOST_amd64=x86_64-unknown-linux-gnu
 CHOST_x86=i686-unknown-linux-gnu
+CHOST_arm64=aarch64-unknown-linux-gnu
 
 RUST_STAGE0_VERSION="1.$(($(get_version_component_range 2) - 1)).0"
+RUST_STAGE0_arm64="rust-${RUST_STAGE0_VERSION}-${CHOST_arm64}"
 RUST_STAGE0_amd64="rust-${RUST_STAGE0_VERSION}-${CHOST_amd64}"
 RUST_STAGE0_x86="rust-${RUST_STAGE0_VERSION}-${CHOST_x86}"
 
@@ -36,12 +38,13 @@
 
 SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.gz
    amd64? ( https://static.rust-lang.org/dist/${RUST_STAGE0_amd64}.tar.gz )
+   arm64? (  https://static.rust-lang.org/dist/${RUST_STAGE0_arm64}.tar.gz )
    x86? ( https://static.rust-lang.org/dist/${RUST_STAGE0_x86}.tar.gz )
-"
+   "
 
 LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
 
-IUSE="debug doc extended +jemalloc"
+IUSE="debug doc extended nativeonly +jemalloc"
 
 RDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425
       jemalloc? ( dev-libs/jemalloc )"
@@ -80,11 +83,40 @@
    local rust_target_name="CHOST_${ARCH}"
    local rust_target="${!rust_target_name}"
 
+   # All supported targets from rust-1.19 to preserve original behaviour
+   # the build system does not provide a default if targets is empty.
+   local single_target="X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon"
+   if use nativeonly ; then
+      # only build the bundled LLVM for the CHOST arch like -march=native
+      # translate our $ARCH from the environment into  the names rust expects.
+      case ${ARCH} in
+         amd64)
+            local single_target="X86"
+            ;;
+         arm)
+            local single_target="ARM"
+            ;;
+         arm64)
+            local single_target="AArch64"
+            ;;
+         sparc)
+            local single_target="Sparc"
+            ;;
+         x86)
+            local single_target="X86"
+            ;;
+         *)
+            die "Unknown Single Target " ${ARCH}
+            ;;
+      esac
+   fi
+
    cat <<- EOF > "${S}"/config.toml
       [llvm]
       optimize = $(toml_usex !debug)
       release-debuginfo = $(toml_usex debug)
       assertions = $(toml_usex debug)
+      targets = "${single_target}"
       [build]
       build = "${rust_target}"
       host = ["${rust_target}"]


-- edit --

The Pi got to 2G in swap and after 10 hours overnight, no progress.

Moved out of Bootable 64-bit RPi3 Gentoo image (OpenRC/Xfce/VC4) UPDATED -- NeddySeagoon
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.


Last edited by NeddySeagoon on Mon Feb 05, 2018 2:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 46367
Location: 56N 3W

PostPosted: Sun Feb 04, 2018 2:01 pm    Post subject: Reply with quote

Here's the patch for cargo to make it arm64 aware and kind to memory impoverished systems.

Code:
--- cargo-0.24.0.ebuild   2018-02-03 18:43:35.000000000 +0000
+++ cargo-0.24.0-r100.ebuild   2018-02-04 13:31:14.000000000 +0000
@@ -130,7 +130,7 @@
 ws2_32-sys-0.2.1
 "
 
-inherit cargo bash-completion-r1 versionator
+inherit cargo bash-completion-r1 multiprocessing versionator
 
 BOOTSTRAP_VERSION="0.$(($(get_version_component_range 2) - 1)).0"
 
@@ -143,17 +143,22 @@
    )
    amd64? (
       https://static.rust-lang.org/dist/cargo-${BOOTSTRAP_VERSION}-x86_64-unknown-linux-gnu.tar.gz
+   )
+   arm64? (
+      https://static.rust-lang.org/dist/cargo-${BOOTSTRAP_VERSION}-aarch64-unknown-linux-gnu.tar.gz
    )"
 
 RESTRICT="mirror"
 LICENSE="|| ( MIT Apache-2.0 )"
 SLOT="0"
-KEYWORDS="~amd64 ~x86"
+KEYWORDS="~amd64 ~arm64 ~x86"
 
 IUSE="doc libressl"
 
 if [[ ${ARCH} = "amd64" ]]; then
    TRIPLE="x86_64-unknown-linux-gnu"
+elif [[ ${ARCH} = "arm64" ]]; then
+   TRIPLE="aarch64-unknown-linux-gnu"
 else
    TRIPLE="i686-unknown-linux-gnu"
 fi
@@ -184,7 +189,7 @@
 src_compile() {
    export CARGO_HOME="${ECARGO_HOME}"
    local cargo="${WORKDIR}/cargo-${BOOTSTRAP_VERSION}-${TRIPLE}/cargo/bin/cargo"
-   ${cargo} build --release
+   ${cargo} build --release -j$(makeopts_jobs)
 
    # Building HTML documentation
    use doc && ${cargo} doc


However, it all ends in tears with
Code:
    Compiling unicode-bidi v0.3.4
error: struct field shorthands are unstable (see issue #37340)
   --> /var/tmp/portage/dev-util/cargo-0.24.0-r100/work/cargo_home/gentoo/unicode-bidi-0.3.4/src/explicit.rs:180:32
    |
180 |         self.vec.push(Status { level, status });
    |                                ^^^^^
Tested with gcc-5,6 and 7.

-- edit --

Google says that my rust is too old.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum