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 when used as a cargo git dependency #475

Closed
antis81 opened this issue Nov 20, 2023 · 1 comment
Closed

Build fails when used as a cargo git dependency #475

antis81 opened this issue Nov 20, 2023 · 1 comment

Comments

@antis81
Copy link

antis81 commented Nov 20, 2023

Situation: I added the crate as a git dependency (tox on crate.io is still 0.1.1).

[dependencies.tox] 
git = "https://github.com/tox-rs/tox.git"
branch = "master"
# tag = "v0.2.0"

With this cargo build fails… ☹️

❓ 🤔 Is there a use tokio::spawn; missing in some files?

cargo build                                                                                                                                                                                                                      
…
…
Compiling tox_core v0.2.0 (https://github.com/tox-rs/tox.git?branch=master#5ab95a61)
error[E0425]: cannot find function `spawn` in crate `tokio`
   --> /home/nils/.cargo/git/checkouts/tox-a959b112c82f70eb/5ab95a6/tox_core/src/relay/client/client.rs:317:16
    |
317 |         tokio::spawn(async move { self.run(dht_sk, dht_pk).await });
    |                ^^^^^ not found in `tokio`
    |
note: found an item that was configured out
   --> /home/nils/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/lib.rs:546:19
    |
546 |     pub use task::spawn;
    |                   ^^^^^
    = note: the item is gated behind the `rt` feature
help: consider importing this function
    |
1   + use std::thread::spawn;
    |
help: if you import `spawn`, refer to it directly
    |
317 -         tokio::spawn(async move { self.run(dht_sk, dht_pk).await });
317 +         spawn(async move { self.run(dht_sk, dht_pk).await });
    |

error[E0425]: cannot find function `spawn` in crate `tokio`
   --> /home/nils/.cargo/git/checkouts/tox-a959b112c82f70eb/5ab95a6/tox_core/src/relay/server/server_ext.rs:130:24
    |
130 |                 tokio::spawn(async move {
    |                        ^^^^^ not found in `tokio`
    |
note: found an item that was configured out
   --> /home/nils/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/lib.rs:546:19
    |
546 |     pub use task::spawn;
    |                   ^^^^^
    = note: the item is gated behind the `rt` feature
help: consider importing this function
    |
4   + use std::thread::spawn;
    |
help: if you import `spawn`, refer to it directly
    |
130 -                 tokio::spawn(async move {
130 +                 spawn(async move {
    |

For more information about this error, try `rustc --explain E0425`.
error: could not compile `tox_core` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

ℹ️ Cloning and building the tox crate directly succeeds. Shouldn't it result in the same error… 🤔 ❔

@antis81 antis81 changed the title Build fails when used in a cargo git dependency Build fails when used as a cargo git dependency Nov 20, 2023
@antis81
Copy link
Author

antis81 commented Nov 23, 2023

Sorry my failure I guess… adding the rt, rt-multi-thread features to dev-dependencies should be enough, right? Closing the issue.

@antis81 antis81 closed this as completed Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant