Skip to content

Enable utsname on MacOS #607

Closed
Closed
@chaoticsmol

Description

@chaoticsmol

I'm doing a really quick experiment to try to invoke the uname function on macOS. Following the documentation, I wrote the code below.

extern crate nix;

fn main() {
    println!("Hello, world!");
    let name = nix::sys::utsname::uname();
    println!("
      sysname = {}
      nodename = {}
      release = {}
      version = {}
      machine = {}
    ", name.sysname(), name.nodename(), name.release(), name.version(), name.machine());
}

My Cargo.toml file points to version 0.8.1 of nix as a dependency. When I try to compile this program with cargo build I get the following error:

error[E0433]: failed to resolve. Could not find `utsname` in `sys`
 --> src/main.rs:5:16
  |
5 |     let name = nix::sys::utsname::uname();
  |                ^^^^^^^^^^^^^^^^^^^^^^^^ Could not find `utsname` in `sys`

I'm running this on macOS 10.12.4 with rustc 1.17.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions