Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails on Risc-v due to Ring #1681

Open
afro-coder opened this issue Aug 6, 2023 · 6 comments
Open

Build fails on Risc-v due to Ring #1681

afro-coder opened this issue Aug 6, 2023 · 6 comments

Comments

@afro-coder
Copy link

Hi there, I'm not a rust programmer yet, trying to learn would be up to collaborate.

I am trying to find projects to port to risc-v architecture, and I recall finding spin an amazing thing to use.

However, it seems that Ring is a dependency and it seems like the project is a bit abandoned.

briansmith/ring#1620

There is a patch available too.
briansmith/ring#1436

Opening an issue so I can try to get this resolved.

Building spin fails with the following as of now

error: failed to run custom build command for `ring v0.16.20`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/home/user/spin/target/debug/build/ring-4a275ceefb2d5a58/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:358:10
  stack backtrace:
     0:       0x2aac4bdbb8 - std::backtrace_rs::backtrace::libunwind::trace::h8728a6b9cacc5847
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
     1:       0x2aac4bdbb8 - std::backtrace_rs::backtrace::trace_unsynchronized::ha6f0ca0828762966
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:       0x2aac4bdbb8 - std::sys_common::backtrace::_print_fmt::h5c4d556655b2b224
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:65:5
     3:       0x2aac4bdbb8 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdc0853d70d35b495
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:44:22
     4:       0x2aac4d9050 - core::fmt::rt::Argument::fmt::hbaac40fdb168e5a0
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/fmt/rt.rs:138:9
     5:       0x2aac4d9050 - core::fmt::write::h6cdec15936470166
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/fmt/mod.rs:1094:21
     6:       0x2aac4ba846 - std::io::Write::write_fmt::ha18473d8b0b33e5b
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/io/mod.rs:1713:15
     7:       0x2aac4bda4e - std::sys_common::backtrace::_print::h6fe93cf501035b12
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:47:5
     8:       0x2aac4bda4e - std::sys_common::backtrace::print::h240f2e706a1eadc0
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:34:9
     9:       0x2aac4bf0fa - std::panicking::default_hook::{{closure}}::h28500eb4d3f6c28a
    10:       0x2aac4bef0a - std::panicking::default_hook::hba0837f1e8268170
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:288:9
    11:       0x2aac4bfb26 - std::panicking::rust_panic_with_hook::h2f3121e16f9db630
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:705:13
    12:       0x2aac4bf9d8 - std::panicking::begin_panic_handler::{{closure}}::ha44bb30b396b603a
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:595:13
    13:       0x2aac4bded6 - std::sys_common::backtrace::__rust_end_short_backtrace::hb9b31a8d520fd5bd
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:151:18
    14:       0x2aac4bf7fa - rust_begin_unwind
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:593:5
    15:       0x2aac461922 - core::panicking::panic_fmt::hf24f1a6db4bce829
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:67:14
    16:       0x2aac461984 - core::panicking::panic::h59321dd3682a6d82
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:117:5
    17:       0x2aac468f9c - core::option::Option<T>::unwrap::h9474e4474dbfab9c
    18:       0x2aac4642ac - build_script_build::build_c_code::he676e6374eaab8d6
    19:       0x2aac463cc8 - build_script_build::ring_build_rs_main::h2bc9cc548e4c2fa0
    20:       0x2aac4637ee - build_script_build::main::h424360415c3acc69
    21:       0x2aac46842a - core::ops::function::FnOnce::call_once::h2b9e723ece1ffd76
    22:       0x2aac46ca9e - std::sys_common::backtrace::__rust_begin_short_backtrace::h71a7bdc05191447c
    23:       0x2aac46828e - std::rt::lang_start::{{closure}}::hb5a7fd820eb49042
    24:       0x2aac4bf6e2 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hecf3cb5e15804868
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/ops/function.rs:284:13
    25:       0x2aac4bf6e2 - std::panicking::try::do_call::h814e99237a770d30
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:500:40
    26:       0x2aac4cd068 - __rust_try
    27:       0x2aac4bf1f4 - std::panicking::try::h092d40dd764856b7
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:464:19
    28:       0x2aac4bf1f4 - std::panic::catch_unwind::hd56eebb37c217b08
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panic.rs:142:14
    29:       0x2aac4bf1f4 - std::rt::lang_start_internal::{{closure}}::hb51110c6674d8902
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/rt.rs:148:48
    30:       0x2aac4bf1f4 - std::panicking::try::do_call::h71903dfff044abe2
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:500:40
    31:       0x2aac4cd068 - __rust_try
    32:       0x2aac4b7520 - std::panicking::try::hdc8a3ed1e2346c6a
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:464:19
    33:       0x2aac4b7520 - std::panic::catch_unwind::h9067233e8ad17799
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panic.rs:142:14
    34:       0x2aac4b7520 - std::rt::lang_start_internal::h448cf9400813f699
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/rt.rs:148:20
    35:       0x2aac468276 - std::rt::lang_start::h879a7a2710e4572d
    36:       0x2aac4672c6 - main
    37:       0x3f8bb011d4 - <unknown>
    38:       0x3f8bb0127c - __libc_start_main
    39:       0x2aac461cd8 - _start
    40:                0x0 - <unknown>
@itowlson
Copy link
Contributor

The ring dependency looks like it comes in through the rustls TLS library (and a couple of other things which may be less critical), which is an indirect dependency in our HTTP stack. Looking at rustls, that seems to be a hard dependency - there's no way for us to opt out of it.

@tschneidereit I heard a rumour you'd got this working with "a lot of ugly hacks" - could you share what you did please?

@afro-coder
Copy link
Author

Sounds good! if we can compile this I'd like to test things here, I'm quite new to the whole porting/rust scenario but I'd like to learn!

@afro-coder
Copy link
Author

Seems like we have a draft PR #2392 haven't had much time to work on risc-v.

@radu-matei
Copy link
Member

cc @endocrimes who I know has a build on risc-v.

@endocrimes
Copy link
Member

Yeah the build works with #2392 - I just need to understand what we're changing in the version bumps before i feel confident in having it merged 😅

@endocrimes
Copy link
Member

I also had to make some changes to cargo-cross: cross-rs/cross#1423 (comment) but that only becomes relevant for us doing builds in CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Investigating / Open for Comment
Development

No branches or pull requests

5 participants