Skip to content

Ch8: Mget unresolved import #77

Closed

Description

@elchead

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?

Activity

  1. added a commit that references this issue on Nov 11, 2022
    eef1cd9
  2. dmitris commented on Nov 11, 2022

    @dmitris

    @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;
    
  3. elchead commented on Nov 23, 2022

    @elchead
    Author

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions