rustlings icon indicating copy to clipboard operation
rustlings copied to clipboard

NetBSD -- could not find `target` in `os`

Open rgeorgia opened this issue 6 years ago • 2 comments

I am trying to run rustlings on NetBSD. When I issue cargo install --force --path . command things began to build but failed when building termios.

In the .cargo/registry/src/github.com-1ecc6299db9ec823/termios-0.3.1/src/os directory I did see freebsd.rs, dragonflybsd.rs and openbsd.rs.

What I did to "fix" the issue:

Copied freebsd.rs to netbsd.rs (freebsd is closer to netbsd than the other two options)

Added netbsd as an option to termios-0.3.1/src/os/mod.rs at lines 7 and 15 respectively.

#[cfg(target_os = "netbsd")] pub use self::netbsd as target
<snip>
#[cfg(target_os = "netbsd")] pub mod netbsd;

Added the following to lib.rs -- as a noob I am not sure if it matters:

//! #[cfg(target_os = "netbsd")]
//! fn set_fastest_speed(termios: &mut Termios) -> io::Result<()> {
//!     cfsetspeed(termios, termios::os::freebsd::B921600)
//! }

Everything did compile and it seems to be working.

rgeorgia avatar Aug 20 '19 17:08 rgeorgia

To get a upstream fix you should request netbsd support in the terminos crate repo since this is a external library used by rustlings.

rusty-snake avatar Aug 20 '19 17:08 rusty-snake

Looks like there's an open PR: https://github.com/dcuddeback/termios-rs/pull/22

komaeda avatar Aug 20 '19 17:08 komaeda