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

Ch8: Mget unresolved import #77

Closed
elchead opened this issue Apr 24, 2022 · 2 comments · May be fixed by #91
Closed

Ch8: Mget unresolved import #77

elchead opened this issue Apr 24, 2022 · 2 comments · May be fixed by #91

Comments

@elchead
Copy link

elchead commented Apr 24, 2022

I try to build mget on rust v1.60 on mac and the build fails because of:

➜  ch8-mget git:(1st-edition) ✗ cargo build
   Compiling mget v0.1.0 (/Users/adria/Programming/rust-in-action/ch8/ch8-mget)
error[E0432]: unresolved import `smoltcp::phy::TapInterface`
 --> src/main.rs:2:5
  |
2 | use smoltcp::phy::TapInterface;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TapInterface` in `phy`

error[E0432]: unresolved import `smoltcp::phy::TapInterface`
 --> src/http.rs:7:38
  |
7 | use smoltcp::phy::{wait as phy_wait, TapInterface};
  |                                      ^^^^^^^^^^^^ no `TapInterface` in `phy` 

I also had to modify Cargo.toml because curly bracket content cannot be separated over several lines.

In my IDE, I can however see that TapInterface exists.
Any idea?

dmitris added a commit to dmitris/rust-in-action-code that referenced this issue Nov 11, 2022
per https://toml.io/en/v1.0.0#inline-table, `No newlines are allowed between the curly braces unless they are valid within a value`.

Partially fixes rust-in-action#77 (there's also the "unresolved import `smoltcp::phy::TapInterface`" issue).
@dmitris
Copy link

dmitris commented Nov 11, 2022

@elchead you probably are trying to build on a Mac - you need a Linux OS to build this, the smaltcp package exports the symbol conditionally on the target_os value being linux:
https://github.com/smoltcp-rs/smoltcp/blob/bcc7e58caea01685dabc2333eab88022846271aa/src/phy/mod.rs#L115-L116

#[cfg(all(feature = "phy-tap_interface", target_os = "linux"))]
pub use self::tap_interface::TapInterface;

@elchead
Copy link
Author

elchead commented Nov 23, 2022

@elchead you probably are trying to build on a Mac - you need a Linux OS to build this, the smaltcp package exports the symbol conditionally on the target_os value being linux: https://github.com/smoltcp-rs/smoltcp/blob/bcc7e58caea01685dabc2333eab88022846271aa/src/phy/mod.rs#L115-L116

#[cfg(all(feature = "phy-tap_interface", target_os = "linux"))]
pub use self::tap_interface::TapInterface;

Thanks, good to know!

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.

2 participants