antonio-antuan / rust-tdlib

Rust client for TDlib
MIT License
57 stars 11 forks source link

issue compiling rust-tdlib #32

Closed moonstripe closed 1 year ago

moonstripe commented 1 year ago

Hello! Thanks again for your help on the last issue. I'll try to respond quicker this time!

The error I'm getting is when I try to compile the newest version of rust-tdlib (0.4.2):

error[E0432]: unresolved imports `tokio::task::JoinHandle`, `tokio::time`
  --> /Users/kojinglick/.cargo/registry/src/github.com-1ecc6299db9ec823/rust-tdlib-0.4.2/src/client/worker.rs:26:5
   |
26 |     task::JoinHandle,
   |     ^^^^^^^^^^^^^^^^ no `JoinHandle` in `task`
27 |     time,
   |     ^^^^ no `time` in the root
   |
help: consider importing this struct instead
   |
26 |     std::thread::JoinHandle;
   |
help: consider importing one of these items instead
   |
27 |     core::time;
   |
27 |     std::time;
   |

error[E0433]: failed to resolve: could not find `Handle` in `runtime`
   --> /Users/kojinglick/.cargo/registry/src/github.com-1ecc6299db9ec823/rust-tdlib-0.4.2/src/client/worker.rs:385:43
    |
385 |             let current = tokio::runtime::Handle::try_current().unwrap();
    |                                           ^^^^^^ could not find `Handle` in `runtime`

error[E0433]: failed to resolve: could not find `SendTimeoutError` in `error`
  --> /Users/kojinglick/.cargo/registry/src/github.com-1ecc6299db9ec823/rust-tdlib-0.4.2/src/errors.rs:75:39
   |
75 |             tokio::sync::mpsc::error::SendTimeoutError::Timeout(_) => SEND_TO_CHANNEL_TIMEOUT,
   |                                       ^^^^^^^^^^^^^^^^ could not find `SendTimeoutError` in `error`

error[E0433]: failed to resolve: could not find `SendTimeoutError` in `error`
  --> /Users/kojinglick/.cargo/registry/src/github.com-1ecc6299db9ec823/rust-tdlib-0.4.2/src/errors.rs:76:39
   |
76 |             tokio::sync::mpsc::error::SendTimeoutError::Closed(_) => CLOSED_CHANNEL_ERROR,
   |                                       ^^^^^^^^^^^^^^^^ could not find `SendTimeoutError` in `error`

error[E0425]: cannot find function `spawn` in crate `tokio`
   --> /Users/kojinglick/.cargo/registry/src/github.com-1ecc6299db9ec823/rust-tdlib-0.4.2/src/client/worker.rs:357:16
    |
357 |         tokio::spawn(async move {
    |                ^^^^^ not found in `tokio`
    |
help: consider importing this function
    |
2   | use std::thread::spawn;
    |
help: if you import `spawn`, refer to it directly
    |
357 -         tokio::spawn(async move {
357 +         spawn(async move {
    |

error[E0425]: cannot find function `spawn` in crate `tokio`
   --> /Users/kojinglick/.cargo/registry/src/github.com-1ecc6299db9ec823/rust-tdlib-0.4.2/src/client/worker.rs:384:16
    |
384 |         tokio::spawn(async move {
    |                ^^^^^ not found in `tokio`
    |
help: consider importing this function
    |
2   | use std::thread::spawn;
    |
help: if you import `spawn`, refer to it directly
    |
384 -         tokio::spawn(async move {
384 +         spawn(async move {
    |

error[E0425]: cannot find function `spawn` in crate `tokio`
   --> /Users/kojinglick/.cargo/registry/src/github.com-1ecc6299db9ec823/rust-tdlib-0.4.2/src/client/worker.rs:431:16
    |
431 |         tokio::spawn(async move {
    |                ^^^^^ not found in `tokio`
    |
help: consider importing this function
    |
2   | use std::thread::spawn;
    |
help: if you import `spawn`, refer to it directly
    |
431 -         tokio::spawn(async move {
431 +         spawn(async move {
    |

error[E0412]: cannot find type `SendTimeoutError` in module `tokio::sync::mpsc::error`
  --> /Users/kojinglick/.cargo/registry/src/github.com-1ecc6299db9ec823/rust-tdlib-0.4.2/src/errors.rs:72:40
   |
72 | impl<T> From<tokio::sync::mpsc::error::SendTimeoutError<T>> for Error {
   |                                        ^^^^^^^^^^^^^^^^ not found in `tokio::sync::mpsc::error`

error[E0412]: cannot find type `SendTimeoutError` in module `tokio::sync::mpsc::error`
  --> /Users/kojinglick/.cargo/registry/src/github.com-1ecc6299db9ec823/rust-tdlib-0.4.2/src/errors.rs:73:44
   |
73 |     fn from(err: tokio::sync::mpsc::error::SendTimeoutError<T>) -> Self {
   |                                            ^^^^^^^^^^^^^^^^ not found in `tokio::sync::mpsc::error`

error[E0603]: module `runtime` is private
   --> /Users/kojinglick/.cargo/registry/src/github.com-1ecc6299db9ec823/rust-tdlib-0.4.2/src/client/worker.rs:385:34
    |
385 |             let current = tokio::runtime::Handle::try_current().unwrap();
    |                                  ^^^^^^^ private module
    |
note: the module `runtime` is defined here
   --> /Users/kojinglick/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/lib.rs:525:5
    |
525 |     pub(crate) mod runtime;
    |     ^^^^^^^^^^^^^^^^^^^^^^

error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
  --> /Users/kojinglick/.cargo/registry/src/github.com-1ecc6299db9ec823/rust-tdlib-0.4.2/src/errors.rs:72:6
   |
72 | impl<T> From<tokio::sync::mpsc::error::SendTimeoutError<T>> for Error {
   |      ^ unconstrained type parameter

Some errors have detailed explanations: E0207, E0412, E0425, E0432, E0433, E0603.
For more information about an error, try `rustc --explain E0207`.
error: could not compile `rust-tdlib` due to 11 previous errors

My Cargo.toml:

[package]
name = "rust_login_streamlining"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rust-tdlib  = "0.4.2"
futures = "0.3"

Would absolutely appreciate guidance on this. Most likely I'm not doing something right.

antonio-antuan commented 1 year ago

This is a known issue #15
To my shame I had forgot about it but I prepared a fix several days ago: #30 . I hope I'll be able to finalize it today or tomorrow.

upd: btw PR practically correct, I've been using it already for several days. So if it's urgent you can grab it from branch client-authorizer directly, but take into account that AuthStateHandler and all about it had been changed and hasn't been documented yet

moonstripe commented 1 year ago

thank you!! feel free to close

antonio-antuan commented 1 year ago

fixed 0.4.3 has just been released