Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Issue compiling udpt onto a raspberrypi #95

Closed
Kahloyx opened this issue May 7, 2021 · 4 comments
Closed

Issue compiling udpt onto a raspberrypi #95

Kahloyx opened this issue May 7, 2021 · 4 comments

Comments

@Kahloyx
Copy link

Kahloyx commented May 7, 2021

This is maybe a dumb issue or a mistake I made but I get this error code while trying to compile it via cargo build --release: cargo build --release Compiling tokio v1.1.0 Compiling serde v1.0.120 Compiling pin-project v0.4.27 Compiling pin-project v1.0.4 Compiling tracing-futures v0.2.4 error: unexpected selfparameter in function --> /home/oops/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.1.0/src/net/tcp/stream.rs:624:40 | 624 | pub fn try_read_buf<B: BufMut>(&self, buf: &mut B) -> io::Result<usize> { | ^^^^^ not valid as function parameter | = note:self` is only valid as the first parameter of an associated function

error: expected one of async, const, crate, default, extern, fn, pub, type, or unsafe, found #[doc = r" Try to read data from the stream into the provided buffer, advancing the"] #[doc = r" buffer's internal cursor, returning how many bytes were read."] #[doc = r""] #[doc = r" Receives any pending data from the socket but does not wait for new data"] #[doc = r" to arrive. On success, returns the number of bytes read. Because"] #[doc = r" try_read_buf() is non-blocking, the buffer does not have to be stored by"] #[doc = r" the async task and can exist entirely on the stack."] #[doc = r""] #[doc = r" Usually, [readable()] or [ready()] is used with this function."] #[doc = r""] #[doc = r" [readable()]: TcpStream::readable()"] #[doc = r" [ready()]: TcpStream::ready()"] #[doc = r""] #[doc = r" # Return"] #[doc = r""] #[doc = r" If data is successfully read, Ok(n)is returned, wherenis the"] #[doc = r" number of bytes read.Ok(0)indicates the stream's read half is closed"] #[doc = r" and will no longer yield data. If the stream is not ready to read data"] #[doc = r"Err(io::ErrorKind::WouldBlock)is returned."] #[doc = r""] #[doc = r" # Examples"] #[doc = r""] #[doc = r" ```no_run"] #[doc = r" use tokio::net::TcpStream;"] #[doc = r" use std::error::Error;"] #[doc = r" use std::io;"] #[doc = r""] #[doc = r" #[tokio::main]"] #[doc = r" async fn main() -> Result<(), Box<dyn Error>> {"] #[doc = r" // Connect to a peer"] #[doc = r#" let stream = TcpStream::connect("127.0.0.1:8080").await?;"#] #[doc = r""] #[doc = r" loop {"] #[doc = r" // Wait for the socket to be readable"] #[doc = r" stream.readable().await?;"] #[doc = r""] #[doc = r" let mut buf = Vec::with_capacity(4096);"] #[doc = r""] #[doc = r" // Try to read data, this may still fail withWouldBlock"] #[doc = r" // if the readiness event is a false positive."] #[doc = r" match stream.try_read_buf(&mut buf) {"] #[doc = r" Ok(0) => break,"] #[doc = r" Ok(n) => {"] #[doc = r#" println!("read {} bytes", n);"#] #[doc = r" }"] #[doc = r" Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {"] #[doc = r" continue;"] #[doc = r" }"] #[doc = r" Err(e) => {"] #[doc = r" return Err(e.into());"] #[doc = r" }"] #[doc = r" }"] #[doc = r" }"] #[doc = r""] #[doc = r" Ok(())"] #[doc = r" }"] #[doc = r" ```"] pub fn try_read_buf<B: BufMut>(self: (/*ERROR*/), buf: &mut B) -> io::Result<usize> { self.io.registration().try_io(Interest::READABLE, || { use std::io::Read; let dst = buf.chunk_mut(); let dst = unsafe { &mut *(dst as *mut _ as *mut [std::mem::MaybeUninit<u8>] as *mut [u8]) }; let n = (&*self.io).read(dst)?; unsafe { buf.advance_mut(n); } Ok(n) }) }
--> /home/oops/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.1.0/src/macros/cfg.rs:132:13
|
131 | #[cfg_attr(docsrs, doc(cfg(feature = "io-util")))]
| - expected one of 9 possible tokens
132 | $item
| ^^^^^ unexpected token
|
::: /home/oops/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.1.0/src/net/tcp/stream.rs:566:5
|
566 | / cfg_io_util! {
567 | | /// Try to read data from the stream into the provided buffer, advancing the
568 | | /// buffer's internal cursor, returning how many bytes were read.
569 | | ///
... |
642 | | }
643 | | }
| |_____- in this macro invocation

error: aborting due to 2 previous errors

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

@naim94a
Copy link
Owner

naim94a commented May 8, 2021

It seems that your compiler doesn't like something in tokio, which Rust version is being used? Try upgrading the compiler.

@Kahloyx
Copy link
Author

Kahloyx commented May 9, 2021

I tried to install the latest version of the compiler but without success (no version found by the installer for an armv7l platform), the version of the compiler into the raspberrypi OS repo is 1.41.1, I tried reinstalling it but no success.

@naim94a
Copy link
Owner

naim94a commented May 9, 2021

Tokio's current MSRV is 1.45, I would suggest cross compiling if the toolchain isn't available for Raspberry Pi.

@Kahloyx
Copy link
Author

Kahloyx commented May 9, 2021 via email

Repository owner locked and limited conversation to collaborators Jan 30, 2022
@naim94a naim94a converted this issue into discussion #129 Jan 30, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants