help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to debug a failed build of rust application under cargo-build-sy


From: woshilapin
Subject: Re: How to debug a failed build of rust application under cargo-build-system?
Date: Thu, 15 Feb 2024 13:06:23 +0000

Hi,

It is indeed a code error which looks weird. Are you sure the 2 compilations 
compile the same source code? How do you invoke `cargo install`? Because if you 
invoke `cargo install --path .`, then I'm pretty sure it's compiling whatever 
is on your machine at the current directory. However, any other invocation of 
`cargo install` might actually pull some source from `crates.io` (the package 
registry for `cargo`). For example, `cargo install cargo-nextest` will download.
Same applies for `guix build` (I'm a guix very beginner so I might not be the 
best at this), I'm not sure `guix build` build the current directory. Doesn't 
it build the `package.scm` which itself describe where to pull the source code?

So, trying a way to be sure that `cargo install` and `guix build` actually 
build the same source code might a first step. I hope this helps.

Have a nice day.
--
woshilapin

Le jeudi 15 février 2024 à 13:43, Tomas Volf <~@wolfsden.cz> a écrit :

> Greetings,
> 
> I am trying to package a rust application and the build fails. I am not sure
> how to debug that. When I try to compile the application using `cargo 
> install', it does pass and build just fine. However, when I try to build the 
> application (imported using the cargo importer) using` guix build', I get 
> this error:
> 
> Compiling tonic v0.10.2
> error[E0277]: the `?` operator can only be used in an async block that 
> returns `Result` or `Option` (or another type that implements `FromResidual`)
> --> 
> /tmp/guix-build-netavark-1.10.3.drv-0/netavark-1.10.3/guix-vendor/rust-tonic-0.10.2.tar.gz/src/transport/server/incoming.rs:32:45
> 
> |
> 28 | / async_stream::try_stream! {
> 29 | | tokio::pin!(incoming);
> 30 | |
> 31 | | while let Some(item) = incoming.next().await {
> 32 | | yield item.map(ServerIo::new_io)?
> | | ^ cannot use the `?` operator in an async block that returns `()`
> 33 | | }
> 34 | | }
> | |_____- this function should return `Result` or `Option` to accept `?`
> |
> = help: the trait `FromResidual<std::result::Result<Infallible, IE>>` is not 
> implemented for `()`
> 
> 
> For more information about this error, try `rustc --explain E0277`.
> error: could not compile `tonic` (lib) due to previous error
> 
> I am not know rust, but this looks like a code error? If that is the case, I 
> do
> not understand why `cargo install' works, since it should be using the same
> code.
> 
> Could someone nudge me in the right direction regarding how to debug this 
> issue?
> I am not really sure where to start.
> 
> Thank you and have a nice day,
> Tomas Volf
> 
> --
> There are only two hard things in Computer Science:
> cache invalidation, naming things and off-by-one errors.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]