betrusted-io / xous-core

The Xous microkernel
Apache License 2.0
529 stars 85 forks source link

cargo xtask renode-image error #276

Closed eau-u4f closed 1 year ago

eau-u4f commented 1 year ago

Trying to prepare renode, and error when building renode-image. From: https://github.com/betrusted-io/xous-core#quickstart-using-an-emulator

$ cargo xtask renode-image
    Updating git repository `https://github.com/betrusted-io/curve25519-dalek.git`
    Updating git repository `https://github.com/betrusted-io/ring-xous`
    Updating git repository `https://github.com/betrusted-io/usb-device.git`
    Updating crates.io index
    Updating git repository `https://github.com/betrusted-io/com_rs.git`
    Updating git repository `https://github.com/betrusted-io/engine25519-as.git`
  Downloaded serde v1.0.139
  Downloaded unicode-ident v1.0.0
  Downloaded cc v1.0.73
  Downloaded bzip2 v0.4.3
  Downloaded ureq v2.5.0
  Downloaded bzip2-sys v0.1.11+1.0.8
  Downloaded fastrand v1.7.0
  Downloaded itoa v1.0.2
  Downloaded num-traits v0.2.15
  Downloaded num-integer v0.1.45
  Downloaded memchr v2.5.0
  Downloaded form_urlencoded v1.0.1
  Downloaded filetime v0.2.17
  Downloaded chunked_transfer v1.4.0
  Downloaded once_cell v1.12.0
  Downloaded rustc_version v0.4.0
  Downloaded quick-xml v0.19.0
  Downloaded ryu v1.0.10
  Downloaded remove_dir_all v0.5.3
  Downloaded percent-encoding v2.2.0
  Downloaded matches v0.1.9
  Downloaded proc-macro2 v1.0.39
  Downloaded time v0.1.44
  Downloaded semver v1.0.9
  Downloaded quote v1.0.18
  Downloaded serde_derive v1.0.139
  Downloaded serde_json v1.0.82
  Downloaded thiserror v1.0.32
  Downloaded syn v1.0.95
  Downloaded thiserror-impl v1.0.32
  Downloaded webpki-roots v0.22.4
  Downloaded sct v0.7.0
  Downloaded untrusted v0.7.1
  Downloaded pkg-config v0.3.25
  Downloaded miniz_oxide v0.5.1
  Downloaded tinyvec_macros v0.1.0
  Downloaded zip v0.5.13
  Downloaded tinyvec v1.6.0
  Downloaded unicode-bidi v0.3.8
  Downloaded tempfile v3.3.0
  Downloaded webpki v0.22.0
  Downloaded unicode-normalization v0.1.21
  Downloaded rustls v0.20.6
  Downloaded url v2.2.2
  Downloaded cfg-if v1.0.0
  Downloaded adler v1.0.2
  Downloaded byteorder v1.4.3
  Downloaded log v0.4.17
  Downloaded chrono v0.4.19
  Downloaded flate2 v1.0.24
  Downloaded crc32fast v1.3.2
  Downloaded idna v0.2.3
  Downloaded convert_case v0.4.0
  Downloaded base64 v0.13.0
  Downloaded autocfg v1.1.0
  Downloaded atty v0.2.14
  Downloaded libc v0.2.126
  Downloaded svd2utra v0.1.7
  Downloaded 58 crates (4.3 MB) in 2.21s
   Compiling cc v1.0.73
   Compiling cfg-if v1.0.0
   Compiling proc-macro2 v1.0.39
   Compiling unicode-ident v1.0.0
   Compiling libc v0.2.126
   Compiling syn v1.0.95
   Compiling log v0.4.17
   Compiling autocfg v1.1.0
   Compiling untrusted v0.7.1
   Compiling serde_derive v1.0.139
   Compiling pkg-config v0.3.25
   Compiling crc32fast v1.3.2
   Compiling tinyvec_macros v0.1.0
   Compiling memchr v2.5.0
   Compiling adler v1.0.2
   Compiling matches v0.1.9
   Compiling serde v1.0.139
   Compiling rustls v0.20.6
   Compiling serde_json v1.0.82
   Compiling semver v1.0.9
   Compiling unicode-bidi v0.3.8
   Compiling percent-encoding v2.2.0
   Compiling ryu v1.0.10
   Compiling itoa v1.0.2
   Compiling byteorder v1.4.3
   Compiling convert_case v0.4.0
   Compiling fastrand v1.7.0
   Compiling once_cell v1.12.0
   Compiling remove_dir_all v0.5.3
   Compiling chunked_transfer v1.4.0
   Compiling base64 v0.13.0
   Compiling tinyvec v1.6.0
   Compiling num-traits v0.2.15
   Compiling num-integer v0.1.45
   Compiling miniz_oxide v0.5.1
   Compiling form_urlencoded v1.0.1
   Compiling ring v0.16.20 (https://github.com/betrusted-io/ring-xous?rev=4296c2e7904898766cf7d8d589759a129794783b#4296c2e7)
   Compiling bzip2-sys v0.1.11+1.0.8
   Compiling unicode-normalization v0.1.21
   Compiling time v0.1.44
   Compiling filetime v0.2.17
   Compiling atty v0.2.14
   Compiling tempfile v3.3.0
   Compiling flate2 v1.0.24
   Compiling quick-xml v0.19.0
   Compiling idna v0.2.3
   Compiling quote v1.0.18
   Compiling svd2utra v0.1.7
   Compiling rustc_version v0.4.0
   Compiling url v2.2.2
   Compiling chrono v0.4.19
   Compiling bzip2 v0.4.3
   Compiling thiserror-impl v1.0.32
   Compiling webpki v0.22.0
   Compiling sct v0.7.0
   Compiling thiserror v1.0.32
   Compiling webpki-roots v0.22.4
   Compiling zip v0.5.13
   Compiling ureq v2.5.0
   Compiling xtask v0.1.0 (/Users/bleh/dev/precursor/xous-core/xtask)
    Finished dev [unoptimized + debuginfo] target(s) in 1m 11s
     Running `target/debug/xtask renode-image`
Locale language changed to en
  Downloaded lazy_static v1.4.0
  Downloaded unicode-xid v0.2.2
  Downloaded proc-macro2 v1.0.36
  Downloaded quote v1.0.15
  Downloaded serde_json v1.0.78
  Downloaded memchr v2.4.1
  Downloaded regex v1.6.0
  Downloaded regex-syntax v0.6.27
  Downloaded glob v0.3.0
  Downloaded ryu v1.0.9
  Downloaded itoa v1.0.1
  Downloaded aho-corasick v0.7.18
  Downloaded serde v1.0.135
  Downloaded 13 crates (1.1 MB) in 2.50s
   Compiling memchr v2.4.1
   Compiling serde v1.0.135
   Compiling proc-macro2 v1.0.36
   Compiling unicode-xid v0.2.2
   Compiling serde_json v1.0.78
   Compiling regex-syntax v0.6.27
   Compiling itoa v1.0.1
   Compiling ryu v1.0.9
   Compiling lazy_static v1.4.0
   Compiling glob v0.3.0
   Compiling aho-corasick v0.7.18
   Compiling quote v1.0.15
   Compiling regex v1.6.0
   Compiling locales v0.1.0 (/Users/bleh/dev/precursor/xous-core/locales)
    Finished dev [unoptimized + debuginfo] target(s) in 5.72s
Outdated toolchain installed.
Error: Toolchain for riscv32imac-unknown-xous-elf was not found on this system!
Would you like this program to attempt to download and install it?   [Y/n]
Attempting to install toolchain for riscv32imac-unknown-xous-elf into /opt/homebrew/Cellar/rust/1.64.0
Downloading toolchain from https://github.com/betrusted-io/rust/releases/download/1.64.0.1/riscv32imac-unknown-xous_1.64.0.zip...
Download in progress...
Download successful. Total data size is 21756827 bytes
Extracting toolchain to /opt/homebrew/Cellar/rust/1.64.0...
Toolchain successfully installed
    Command: cargo build --release --target riscv32imac-unknown-xous-elf --package xous-ticktimer --package xous-log --package xous-names --package xous-susres --package graphics-server --package keyboard --package spinor --package llio --package com --package net --package dns --package gam --package ime-frontend --package ime-plugin-shell --package codec --package modals --package root-keys --package trng --package sha2 --package engine-25519 --package jtag --package status --package shellchat --package pddb --package usb-device-xous --features timestamp --features renode
  Downloaded libloading v0.7.3
  Downloaded hash32 v0.2.1
  Downloaded hex-literal v0.3.4
  Downloaded getrandom v0.1.16
  Downloaded polyval v0.6.0
  Downloaded num_enum v0.5.7
  Downloaded num_enum_derive v0.5.7
  Downloaded num-complex v0.3.1
  Downloaded rand v0.8.5
  Downloaded unicode-xid v0.2.3
  Downloaded radium v0.6.2
  Downloaded vcell v0.1.3
  Downloaded rand v0.7.3
  Downloaded rand_chacha v0.2.2
  Downloaded universal-hash v0.5.0
  Downloaded version_check v0.9.4
  Downloaded static_assertions v1.1.0
  Downloaded stable_deref_trait v1.2.0
  Downloaded wayland-scanner v0.29.4
  Downloaded threadpool v1.8.1
  Downloaded rand_chacha v0.3.1
  Downloaded ppv-lite86 v0.2.16
  Downloaded num v0.3.1
  Downloaded wayland-sys v0.29.4
  Downloaded aes-kw v0.2.1
  Downloaded xml-rs v0.8.4
  Downloaded qrcode v0.12.0
  Downloaded zeroize v1.3.0
  Downloaded zeroize_derive v1.3.2
  Downloaded ptr_meta v0.1.4
  Downloaded rkyv v0.4.3
  Downloaded rand_core v0.5.1
  Downloaded memoffset v0.6.5
  Downloaded wayland-commons v0.29.4
  Downloaded num-complex v0.4.1
  Downloaded no-std-net v0.5.0
  Downloaded minimal-lexical v0.2.1
  Downloaded xcursor v0.3.4
  Downloaded wyz v0.4.0
  Downloaded ptr_meta_derive v0.1.4
  Downloaded typenum v1.15.0
  Downloaded xous-api-names v0.9.20
  Downloaded xous-ipc v0.9.24
  Downloaded xous-tts-backend v0.1.5
  Downloaded opaque-debug v0.3.0
  Downloaded xous-semver v0.1.2
  Downloaded wayland-cursor v0.29.4
  Downloaded wayland-protocols v0.29.4
  Downloaded num-rational v0.3.2
  Downloaded num-iter v0.1.43
  Downloaded num-derive v0.3.3
  Downloaded signature v1.4.0
  Downloaded scoped-tls v1.0.0
  Downloaded miniz_oxide v0.4.4
  Downloaded rand_core v0.6.3
  Downloaded xous-api-log v0.1.18
  Downloaded wayland-client v0.29.4
  Downloaded regex-syntax v0.6.26
  Downloaded bitflags v1.3.2
  Downloaded xous v0.9.24
  Downloaded block-buffer v0.9.0
  Downloaded nix v0.22.3
  Downloaded bitfield v0.13.2
  Downloaded xous-api-ticktimer v0.9.18
  Downloaded x25519-dalek v1.2.0
  Downloaded bitvec v0.22.3
  Downloaded smallvec v1.8.0
  Downloaded xous-api-susres v0.9.18
  Downloaded crossbeam-channel v0.5.4
  Downloaded crossbeam-epoch v0.9.8
  Downloaded crossbeam v0.8.1
  Downloaded crossbeam-utils v0.8.8
  Downloaded dlib v0.5.0
  Downloaded cty v0.2.2
  Downloaded float-cmp v0.8.0
  Downloaded enum_dispatch v0.3.8
  Downloaded usbd-human-interface-device v0.2.1
  Downloaded crypto-mac v0.11.1
  Downloaded synstructure v0.12.6
  Downloaded num_cpus v1.13.1
  Downloaded regex v1.5.6
  Downloaded generic-array v0.14.5
  Downloaded sntpc v0.3.1
  Downloaded minifb v0.23.0
  Downloaded managed v0.8.0
  Downloaded libm v0.2.2
  Downloaded microfft v0.4.0
  Downloaded funty v1.2.0
  Downloaded rkyv_derive v0.4.0
  Downloaded hmac v0.11.0
  Downloaded inout v0.1.3
  Downloaded blowfish v0.9.1
  Downloaded hex v0.4.3
  Downloaded blowfish v0.8.0
  Downloaded seahash v4.1.0
  Downloaded hkdf v0.11.0
  Downloaded frunk v0.4.0
  Downloaded frunk_derives v0.4.0
  Downloaded embedded-time v0.12.1
  Downloaded delegate v0.7.0
  Downloaded checked_int_cast v1.0.0
  Downloaded nom v7.1.1
  Downloaded frunk_proc_macro_helpers v0.1.0
  Downloaded frunk_core v0.4.0
  Downloaded smoltcp v0.8.1
  Downloaded scopeguard v1.1.0
  Downloaded spectrum-analyzer v0.5.2
  Downloaded packed_struct v0.10.0
  Downloaded heapless v0.7.13
  Downloaded ctr v0.9.1
  Downloaded crypto-common v0.1.6
  Downloaded crossbeam-queue v0.3.5
  Downloaded cipher v0.4.3
  Downloaded ed25519-dalek v1.0.1
  Downloaded ed25519 v1.5.2
  Downloaded downcast-rs v1.2.0
  Downloaded aes-gcm-siv v0.11.1
  Downloaded digest v0.9.0
  Downloaded cpufeatures v0.2.2
  Downloaded utralib v0.1.9
  Downloaded crossbeam-deque v0.8.1
  Downloaded cipher v0.3.0
  Downloaded tap v1.0.1
  Downloaded subtle v2.4.1
  Downloaded raw-window-handle v0.4.3
  Downloaded aead v0.5.0
  Downloaded packed_struct_codegen v0.10.0
  Downloaded bit_field v0.9.0
  Downloaded x11-dl v2.19.1
  Downloaded 129 crates (7.1 MB) in 1.48s (largest was `utralib` at 2.5 MB)
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.39
   Compiling unicode-ident v1.0.0
   Compiling syn v1.0.95
   Compiling cfg-if v1.0.0
   Compiling log v0.4.17
   Compiling xous v0.9.24
   Compiling rkyv v0.4.3
   Compiling seahash v4.1.0
   Compiling memchr v2.5.0
error[E0514]: found crate `core` compiled by an incompatible version of rustc
  |
  = help: please recompile that crate using this compiler (rustc 1.64.0) (consider running `cargo clean` first)
  = note: the following crate versions were found:
          crate `core` compiled by rustc 1.64.0 (a55dd71d5 2022-09-19): /opt/homebrew/Cellar/rust/1.64.0/lib/rustlib/riscv32imac-unknown-xous-elf/lib/libcore-136c5ac1df6b4bb6.rlib

error[E0514]: found crate `compiler_builtins` compiled by an incompatible version of rustc
  |
  = help: please recompile that crate using this compiler (rustc 1.64.0) (consider running `cargo clean` first)
  = note: the following crate versions were found:
          crate `compiler_builtins` compiled by rustc 1.64.0 (a55dd71d5 2022-09-19): /opt/homebrew/Cellar/rust/1.64.0/lib/rustlib/riscv32imac-unknown-xous-elf/lib/libcompiler_builtins-cdb7a6185060702d.rlib

error: could not compile `cfg-if` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error[E0514]: found crate `core` compiled by an incompatible version of rustc
   --> /Users/bleh/.cargo/registry/src/github.com-1ecc6299db9ec823/seahash-4.1.0/src/lib.rs:157:1
    |
157 | extern crate core as std;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: please recompile that crate using this compiler (rustc 1.64.0) (consider running `cargo clean` first)
    = note: the following crate versions were found:
            crate `core` compiled by rustc 1.64.0 (a55dd71d5 2022-09-19): /opt/homebrew/Cellar/rust/1.64.0/lib/rustlib/riscv32imac-unknown-xous-elf/lib/libcore-136c5ac1df6b4bb6.rlib

error: cannot find attribute `derive` in this scope
 --> /Users/bleh/.cargo/registry/src/github.com-1ecc6299db9ec823/seahash-4.1.0/src/stream.rs:7:3
  |
7 | #[derive(Clone, Copy)]
  |   ^^^^^^

error: cannot find macro `debug_assert` in this scope
  --> /Users/bleh/.cargo/registry/src/github.com-1ecc6299db9ec823/seahash-4.1.0/src/reference.rs:38:5
   |
38 |     debug_assert!(
   |     ^^^^^^^^^^^^

error: cannot find attribute `derive` in this scope
 --> /Users/bleh/.cargo/registry/src/github.com-1ecc6299db9ec823/seahash-4.1.0/src/buffer.rs:8:3
  |
8 | #[derive(Clone)]
  |   ^^^^^^

error[E0405]: cannot find trait `Default` in this scope
  --> /Users/bleh/.cargo/registry/src/github.com-1ecc6299db9ec823/seahash-4.1.0/src/stream.rs:19:6
   |
19 | impl Default for SeaHasher {
   |      ^^^^^^^ not found in this scope

For more information about this error, try `rustc --explain E0405`.
error: could not compile `seahash` due to 7 previous errors
Error: "Local build failed"
xobs commented 1 year ago

That's bizarre. It's complaining that you're compiling with a different version of rustc. It's saying you're using the 1.64.0 toolchain, and it... really wants the 1.64.0 toolchain.

Can you please provide the output of rustc --version?

eau-u4f commented 1 year ago

$ rustc --version rustc 1.64.0

xobs commented 1 year ago

Are you using a custom build of rustc? If you use the official version, it prints out the git hash that built it:

$ $ rustc --version
rustc 1.64.0 (a55dd71d5 2022-09-19)
$

If you use a custom build of Rust, you will need to build libstd for Xous yourself. Instructions on how to do that are made available at: https://github.com/betrusted-io/rust#building-from-source

eau-u4f commented 1 year ago

homebrew version on macOS

eau-u4f commented 1 year ago

i'll try the build from source.

xobs commented 1 year ago

It looks like homebrew ships a custom build of Rust, and is therefore incompatible with the precompiled libstd we ship: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/rust.rb

Since that's the case, you'll need to build libstd from source.

bunnie commented 1 year ago

Should this issue be marked as wontfix and closed because the resolution seems to be that an incompatible toolchain build was used?

xobs commented 1 year ago

In the future, building your own libstd will be slightly easier when using nightly and -Zbuild-std, but for now it's a "wontfix" -- we only support official Rust builds.