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

cargo build Error:unresolved import rusb #31

Open
lurenJBD opened this issue May 23, 2023 · 1 comment
Open

cargo build Error:unresolved import rusb #31

lurenJBD opened this issue May 23, 2023 · 1 comment

Comments

@lurenJBD
Copy link

   Compiling libc v0.2.144
   Compiling proc-macro2 v1.0.58
   Compiling quote v1.0.27
   Compiling unicode-ident v1.0.8
   Compiling cfg-if v1.0.0
   Compiling autocfg v1.1.0
   Compiling memchr v2.5.0
   Compiling version_check v0.9.4
   Compiling syn v1.0.109
   Compiling value-bag v1.0.0-alpha.9
   Compiling log v0.4.17
   Compiling bitflags v1.3.2
   Compiling cc v1.0.79
   Compiling futures-core v0.3.28
   Compiling aho-corasick v1.0.1
   Compiling atty v0.2.14
   Compiling crossbeam-utils v0.8.15
   Compiling glob v0.3.1
   Compiling clang-sys v1.6.1
   Compiling pin-project-lite v0.2.9
   Compiling slab v0.4.8
   Compiling minimal-lexical v0.2.1
   Compiling unicode-width v0.1.10
   Compiling event-listener v2.5.3
   Compiling termcolor v1.2.0
   Compiling regex-syntax v0.7.2
   Compiling textwrap v0.11.0
   Compiling nom v7.1.3
   Compiling concurrent-queue v2.2.0
   Compiling syn v2.0.16
   Compiling regex v1.8.2
   Compiling libloading v0.7.4
   Compiling ansi_term v0.12.1
   Compiling futures-io v0.3.28
   Compiling waker-fn v1.1.0
   Compiling strsim v0.8.0
   Compiling vec_map v0.8.2
   Compiling ctor v0.1.26
   Compiling humantime v2.1.0
   Compiling lazy_static v1.4.0
   Compiling fastrand v1.9.0
   Compiling io-lifetimes v1.0.10
   Compiling either v1.8.1
   Compiling bindgen v0.59.2
   Compiling parking v2.1.0
   Compiling futures-lite v1.13.0
   Compiling which v4.4.0
   Compiling env_logger v0.9.3
   Compiling clap v2.34.0
   Compiling cexpr v0.6.0
   Compiling async-lock v2.7.0
   Compiling polling v2.8.0
   Compiling rustc-hash v1.1.0
   Compiling peeking_take_while v0.1.2
   Compiling lazycell v1.3.0
   Compiling shlex v1.1.0
   Compiling rustix v0.37.19
   Compiling autotools v0.2.6
   Compiling openssl-src v111.25.3+1.1.1t
   Compiling socket2 v0.4.9
   Compiling async-io v1.13.0
   Compiling rustversion v1.0.12
   Compiling linux-raw-sys v0.3.8
   Compiling pkg-config v0.3.27
   Compiling openssl-sys v0.9.87
   Compiling signal-hook-registry v1.4.1
   Compiling getrandom v0.2.9
   Compiling proc-macro-error-attr v1.0.4
   Compiling once_cell v1.17.1
   Compiling async-task v4.4.0
   Compiling signal-hook v0.3.15
   Compiling rand_core v0.6.4
   Compiling async-channel v1.8.0
   Compiling proc-macro-error v1.0.4
   Compiling async-process v1.7.0
   Compiling lock_api v0.4.9
   Compiling quick-error v1.2.3
   Compiling parking_lot_core v0.9.7
   Compiling ppv-lite86 v0.2.17
   Compiling futures-task v0.3.28
   Compiling atomic-waker v1.1.1
   Compiling blocking v1.3.1
   Compiling rand_chacha v0.3.1
   Compiling plist_plus v0.2.2
   Compiling err-derive v0.2.4
   Compiling async-executor v1.5.1
   Compiling cmake v0.1.50
   Compiling foreign-types-shared v0.1.1
   Compiling openssl v0.10.52
   Compiling pin-utils v0.1.0
   Compiling unicode-xid v0.2.4
   Compiling futures-util v0.3.28
   Compiling scopeguard v1.1.0
   Compiling smallvec v1.10.0
   Compiling rusty_libimobiledevice v0.1.7
   Compiling synstructure v0.12.6
   Compiling foreign-types v0.3.2
   Compiling async-global-executor v2.3.1
   Compiling rand v0.8.5
   Compiling openssl-macros v0.1.1
   Compiling futures-macro v0.3.28
   Compiling kv-log-macro v1.0.7
   Compiling async-attributes v1.1.2
   Compiling async-stream-impl v0.2.1
   Compiling tokio v1.28.1
   Compiling byteorder v1.4.3
   Compiling cfg-if v0.1.10
   Compiling dns-parser v0.8.0
   Compiling net2 v0.2.38
   Compiling async-stream v0.2.1
   Compiling async-std v1.12.0
   Compiling parking_lot v0.12.1
   Compiling humantime v1.3.0
   Compiling tokio-macros v2.1.0
   Compiling mio v0.8.6
   Compiling num_cpus v1.15.0
   Compiling bytes v1.4.0
   Compiling env_logger v0.7.1
   Compiling mdns v3.0.0 (/root/mdns)
   Compiling colored v2.0.0
   Compiling netmuxd v0.1.4 (/root/netmuxd)
error[E0432]: unresolved import `rusb`
 --> src/test.rs:3:5
  |
3 | use rusb::{Device, UsbContext};
  |     ^^^^ use of undeclared crate or module `rusb`

error[E0433]: failed to resolve: use of undeclared crate or module `rusb`
  --> src/test.rs:16:21
   |
16 |     let reg: Result<rusb::Registration<rusb::Context>, rusb::Error> = rusb::HotplugBuilder::new()
   |                     ^^^^ use of undeclared crate or module `rusb`

error[E0433]: failed to resolve: use of undeclared crate or module `rusb`
  --> src/test.rs:16:40
   |
16 |     let reg: Result<rusb::Registration<rusb::Context>, rusb::Error> = rusb::HotplugBuilder::new()
   |                                        ^^^^ use of undeclared crate or module `rusb`

error[E0433]: failed to resolve: use of undeclared crate or module `rusb`
  --> src/test.rs:16:56
   |
16 |     let reg: Result<rusb::Registration<rusb::Context>, rusb::Error> = rusb::HotplugBuilder::new()
   |                                                        ^^^^ use of undeclared crate or module `rusb`

error[E0433]: failed to resolve: use of undeclared crate or module `rusb`
  --> src/test.rs:16:71
   |
16 |     let reg: Result<rusb::Registration<rusb::Context>, rusb::Error> = rusb::HotplugBuilder::new()
   |                                                                       ^^^^ use of undeclared crate or module `rusb`

error[E0433]: failed to resolve: use of undeclared crate or module `rusb`
  --> src/test.rs:29:21
   |
29 | impl<T: UsbContext> rusb::Hotplug<T> for Handler {
   |                     ^^^^ use of undeclared crate or module `rusb`

error[E0433]: failed to resolve: use of undeclared crate or module `rusb`
 --> src/test.rs:9:19
  |
9 |     let context = rusb::Context::new().unwrap();
  |                   ^^^^ use of undeclared crate or module `rusb`
  |
help: consider importing one of these items
  |
3 | use core::task::Context;
  |
3 | use futures_util::task::Context;
  |
3 | use std::task::Context;
  |
help: if you import `Context`, refer to it directly
  |
9 -     let context = rusb::Context::new().unwrap();
9 +     let context = Context::new().unwrap();
  |

Some errors have detailed explanations: E0432, E0433.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `netmuxd` due to 7 previous errors
warning: build failed, waiting for other jobs to finish...

System: Debian 10 32Bit
I sure rusty_libimobiledevice and plist_plus are buildable

root@debian10:~/rusty_libimobiledevice# cargo build
   Compiling libc v0.2.122
   Compiling cfg-if v1.0.0
   Compiling memchr v2.3.4
   Compiling cc v1.0.73
   Compiling glob v0.3.0
   Compiling proc-macro2 v1.0.30
   Compiling clang-sys v1.2.2
   Compiling log v0.4.16
   Compiling atty v0.2.14
   Compiling aho-corasick v0.7.15
   Compiling unicode-xid v0.2.2
   Compiling regex-syntax v0.6.25
   Compiling unicode-width v0.1.9
   Compiling bitflags v1.3.2
   Compiling minimal-lexical v0.2.1
   Compiling textwrap v0.11.0
   Compiling nom v7.1.1
   Compiling libloading v0.7.1
   Compiling strsim v0.8.0
   Compiling bindgen v0.59.2
   Compiling either v1.6.1
   Compiling vec_map v0.8.2
   Compiling humantime v2.1.0
   Compiling termcolor v1.1.2
   Compiling regex v1.4.6
   Compiling ansi_term v0.11.0
   Compiling clap v2.33.3
   Compiling cexpr v0.6.0
   Compiling env_logger v0.9.0
   Compiling which v4.2.5
   Compiling quote v1.0.10
   Compiling lazy_static v1.4.0
   Compiling peeking_take_while v0.1.2
   Compiling rustc-hash v1.1.0
   Compiling lazycell v1.3.0
   Compiling shlex v1.1.0
   Compiling autotools v0.2.5
   Compiling pkg-config v0.3.25
   Compiling autocfg v1.1.0
   Compiling openssl-sys v0.9.72
   Compiling getrandom v0.2.5
   Compiling rand_core v0.6.3
   Compiling ppv-lite86 v0.2.16
   Compiling cmake v0.1.48
   Compiling rand_chacha v0.3.1
   Compiling openssl v0.10.38
   Compiling foreign-types-shared v0.1.1
   Compiling foreign-types v0.3.2
   Compiling rand v0.8.5
   Compiling once_cell v1.10.0
   Compiling plist_plus v0.2.0
   Compiling rusty_libimobiledevice v0.1.7 (/root/rusty_libimobiledevice)
warning: lint `unaligned_references` has been removed: converted into hard error, see issue #82523 <https://github.com/rust-lang/rust/issues/82523> for more information
 --> src/bindings.rs:7:10
  |
7 | #![allow(unaligned_references)]
  |          ^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(renamed_and_removed_lints)]` on by default

warning: `rusty_libimobiledevice` (lib) generated 1 warning
    Finished dev [unoptimized + debuginfo] target(s) in 14.84s
root@debian10:~/plist_plus# cargo build
   Compiling libc v0.2.122
   Compiling cfg-if v1.0.0
   Compiling memchr v2.4.1
   Compiling glob v0.3.0
   Compiling proc-macro2 v1.0.37
   Compiling log v0.4.16
   Compiling clang-sys v1.3.1
   Compiling aho-corasick v0.7.18
   Compiling unicode-xid v0.2.2
   Compiling minimal-lexical v0.2.1
   Compiling unicode-width v0.1.9
   Compiling atty v0.2.14
   Compiling regex-syntax v0.6.25
   Compiling textwrap v0.11.0
   Compiling nom v7.1.1
   Compiling libloading v0.7.3
   Compiling humantime v2.1.0
   Compiling termcolor v1.1.3
   Compiling bindgen v0.59.2
   Compiling bitflags v1.3.2
   Compiling ansi_term v0.12.1
   Compiling strsim v0.8.0
   Compiling vec_map v0.8.2
   Compiling regex v1.5.5
   Compiling either v1.6.1
   Compiling which v4.2.5
   Compiling cexpr v0.6.0
   Compiling clap v2.34.0
   Compiling env_logger v0.9.0
   Compiling quote v1.0.17
   Compiling getrandom v0.2.6
   Compiling cc v1.0.73
   Compiling peeking_take_while v0.1.2
   Compiling lazycell v1.3.0
   Compiling rustc-hash v1.1.0
   Compiling lazy_static v1.4.0
   Compiling shlex v1.1.0
   Compiling autotools v0.2.5
   Compiling rand_core v0.6.3
   Compiling ppv-lite86 v0.2.16
   Compiling rand_chacha v0.3.1
   Compiling rand v0.8.5
   Compiling plist_plus v0.2.2 (/root/plist_plus)
warning: lint `unaligned_references` has been removed: converted into hard error, see issue #82523 <https://github.com/rust-lang/rust/issues/82523> for more information
 --> src/unsafe_bindings.rs:7:10
  |
7 | #![allow(unaligned_references)]
  |          ^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(renamed_and_removed_lints)]` on by default

warning: `plist_plus` (lib) generated 1 warning
    Finished dev [unoptimized + debuginfo] target(s) in 12.42s
@lurenJBD
Copy link
Author

lurenJBD commented May 23, 2023

OK,I find the answer from #23

just use this code:
cargo build --bin netmuxd

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

No branches or pull requests

1 participant