A low-level ncurses wrapper for Rust

Overview

ncurses-rs Build Status

This is a very thin wrapper around the ncurses TUI lib.

NOTE: The ncurses lib is terribly unsafe and ncurses-rs is only the lightest wrapper it can be. If you want a safe and idiomatic TUI library for Rust, look elsewhere. If you want a 1:1 port of C to Rust or you want to crank a TUI out C-style in Rust, this will probably do the trick.

Building

The compiled library will go to the target directory.

cargo build

Note that you must to have the ncurses library installed and linkable for ncurses-rs to work. On Linux, this should be trivial. On OS X, consider installing ncurses using Homebrew. (Note that you have to force Homebrew to link the library to /usr/local/lib: brew link --force ncurses and set that path to LIBRARY_PATH environmental variable.)

Examples

Examples are built by cargo build. To run them, use cargo run --example ex_<NUMBER>. Example numbers increase along with the complexity of the example.

Current examples:
1. Hello World
2. Basic Input & Attributes
3. Simple Pager
4. Window Movement
5. Menu Library (requires rust nightly)
6. Pager & Syntax Highlighting
7. Basic Input & Attributes (Unicode)
8. Special ACS Characters

Environment variables

Some environment variables are read by build.rs:

If set, NCURSES_RS_RUSTC_LINK_LIB will be used for NCURSES_RS_RUSTC_LINK_LIB.

If set, NCURSES_RS_RUSTC_FLAGS will be used for cargo:rustc-flags.

If set, NCURSES_RS_CFLAGS will be used for the compilation of the test program chtype_size.c.

Comments
  • Improve Portability

    Improve Portability

    Work in progress to improve portability. This fixes issues with NetBSD curses where the constants weren't the correct values which resulted in incorrect rendering.

    pancurses demo before fixes image

    pancurses demo after image

    pancurses demo with ncurses image

    Also fixes linker errors with mouse on NetBSD curses; NetBSD curses advertises the mouse functions as macros

    opened by Ella-0 12
  • Added mouse support.

    Added mouse support.

    I've added mouse support. I tested building against the latest rust and it worked, but I can't write an example to test it out. I was able to run has_mouse(), but it returns false for me. Hopefully that's not because of something I did wrong :)

    Try it out and let me know.

    opened by ghost 9
  • test fail to build on fedora 25:   undefined reference to 'wget_wch'

    test fail to build on fedora 25: undefined reference to 'wget_wch'

    ncurses 6.0

    cargo test  --verbose
    
    warning: path `/tmp/ncurses-rs/src/ncurses.rs` was erroneously implicitly accepted for library `ncurses`,
    please rename the file to `src/lib.rs` or set lib.path in Cargo.toml
           Fresh libc v0.2.32
           Fresh gcc v0.3.54
           Fresh pkg-config v0.3.9
       Compiling ncurses v5.86.0 (file:///tmp/ncurses-rs)
         Running `rustc --crate-name ex_7 examples/ex_7.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' -C metadata=32c66cdfcc872a56 -C extra-filename=-32c66cdfcc872a56 --out-dir /tmp/ncurses-rs/target/debug/examples -L dependency=/tmp/ncurses-rs/target/debug/deps --extern libc=/tmp/ncurses-rs/target/debug/deps/liblibc-126a44a53dfd6129.rlib --extern ncurses=/tmp/ncurses-rs/target/debug/deps/libncurses-9c81af12678bde21.rlib -C target-cpu=native -L native=/usr/lib64`
    error: linking with `cc` failed: exit code: 1
      |
      = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_70.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_71.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_710.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_711.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_712.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_713.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_714.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_715.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_72.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_73.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_74.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_75.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_76.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_77.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_78.rust-cgu.o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.ex_79.rust-cgu.o" "-o" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56" "/tmp/ncurses-rs/target/debug/examples/ex_7-32c66cdfcc872a56.crate.allocator.rust-cgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-L" "/tmp/ncurses-rs/target/debug/deps" "-L" "/usr/lib64" "-L" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/ncurses-rs/target/debug/deps/libncurses-9c81af12678bde21.rlib" "/tmp/ncurses-rs/target/debug/deps/liblibc-126a44a53dfd6129.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-ef68455a36f432e0.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-f6e1402098866357.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_system-4217dfafb936c36b.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-97fa3d5ef4bd4fdd.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-cf9300d96e8efc7d.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-e6f731c8a56b92a5.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-58100a6f9c048547.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-f59d3752d69fd895.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_unicode-fe3fcd278911a505.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-fcc46f3067b1a58b.rlib" "/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-295aef536590064a.rlib" "-Wl,-Bdynamic" "-l" "ncurses" "-l" "tinfo" "-l" "util" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util"
      = note: src/ncurses.rs:349: error: undefined reference to 'wget_wch'
              collect2: error: ld returned 1 exit status
              
    
    error: aborting due to previous error
    
    error: Could not compile `ncurses`.
    
    Caused by:
      process didn't exit successfully: `rustc --crate-name ex_7 examples/ex_7.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 --cfg feature="default" -C metadata=32c66cdfcc872a56 -C extra-filename=-32c66cdfcc872a56 --out-dir /tmp/ncurses-rs/target/debug/examples -L dependency=/tmp/ncurses-rs/target/debug/deps --extern libc=/tmp/ncurses-rs/target/debug/deps/liblibc-126a44a53dfd6129.rlib --extern ncurses=/tmp/ncurses-rs/target/debug/deps/libncurses-9c81af12678bde21.rlib -C target-cpu=native -L native=/usr/lib64` (exit code: 101)
    
    opened by matthiaskrgr 7
  • Relicense under dual MIT/Apache-2.0

    Relicense under dual MIT/Apache-2.0

    This issue was automatically generated. Feel free to close without ceremony if you do not agree with re-licensing or if it is not possible for other reasons. Respond to @cmr with any questions or concerns, or pop over to #rust-offtopic on IRC to discuss.

    You're receiving this because someone (perhaps the project maintainer) published a crates.io package with the license as "MIT" xor "Apache-2.0" and the repository field pointing here.

    TL;DR the Rust ecosystem is largely Apache-2.0. Being available under that license is good for interoperation. The MIT license as an add-on can be nice for GPLv2 projects to use your code.

    Why?

    The MIT license requires reproducing countless copies of the same copyright header with different names in the copyright field, for every MIT library in use. The Apache license does not have this drawback. However, this is not the primary motivation for me creating these issues. The Apache license also has protections from patent trolls and an explicit contribution licensing clause. However, the Apache license is incompatible with GPLv2. This is why Rust is dual-licensed as MIT/Apache (the "primary" license being Apache, MIT only for GPLv2 compat), and doing so would be wise for this project. This also makes this crate suitable for inclusion and unrestricted sharing in the Rust standard distribution and other projects using dual MIT/Apache, such as my personal ulterior motive, the Robigalia project.

    Some ask, "Does this really apply to binary redistributions? Does MIT really require reproducing the whole thing?" I'm not a lawyer, and I can't give legal advice, but some Google Android apps include open source attributions using this interpretation. Others also agree with it. But, again, the copyright notice redistribution is not the primary motivation for the dual-licensing. It's stronger protections to licensees and better interoperation with the wider Rust ecosystem.

    How?

    To do this, get explicit approval from each contributor of copyrightable work (as not all contributions qualify for copyright, due to not being a "creative work", e.g. a typo fix) and then add the following to your README:

    ## License
    
    Licensed under either of
    
     * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
     * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
    
    at your option.
    
    ### Contribution
    
    Unless you explicitly state otherwise, any contribution intentionally submitted
    for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
    additional terms or conditions.
    

    and in your license headers, if you have them, use the following boilerplate (based on that used in Rust):

    // Copyright 2016 ncurses-rs Developers
    //
    // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
    // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
    // http://opensource.org/licenses/MIT>, at your option. This file may not be
    // copied, modified, or distributed except according to those terms.
    

    It's commonly asked whether license headers are required. I'm not comfortable making an official recommendation either way, but the Apache license recommends it in their appendix on how to use the license.

    Be sure to add the relevant LICENSE-{MIT,APACHE} files. You can copy these from the Rust repo for a plain-text version.

    And don't forget to update the license metadata in your Cargo.toml to:

    license = "MIT OR Apache-2.0"
    

    I'll be going through projects which agree to be relicensed and have approval by the necessary contributors and doing this changes, so feel free to leave the heavy lifting to me!

    Contributor checkoff

    To agree to relicensing, comment with :

    I license past and future contributions under the dual MIT/Apache-2.0 license, allowing licensees to chose either at their option.
    

    Or, if you're a contributor, you can check the box in this repo next to your name. My scripts will pick this exact phrase up and check your checkbox, but I'll come through and manually review this issue later as well.

    • [ ] @Gyscos
    • [ ] @LindseyB
    • [ ] @Marckvdv
    • [ ] @NewbiZ
    • [ ] @Reisen
    • [x] @aatxe
    • [ ] @alan-andrade
    • [ ] @alexchandel
    • [ ] @arbitrary-cat
    • [ ] @benekastah
    • [ ] @brandonson
    • [ ] @chengsun
    • [ ] @chris-morgan
    • [x] @cmr
    • [ ] @coolwanglu
    • [ ] @dpc
    • [ ] @dsyang
    • [ ] @ebfe
    • [ ] @emintham
    • [ ] @euclio
    • [ ] @evanpw
    • [ ] @golddranks
    • [ ] @hsoft
    • [ ] @hyPiRion
    • [ ] @itsjustsoda
    • [ ] @jeaye
    • [ ] @jxs
    • [ ] @leshow
    • [ ] @mahkoh
    • [ ] @manuc66
    • [ ] @marchelzo
    • [ ] @petevine
    • [ ] @phillipw
    • [ ] @pmsanford
    • [ ] @skullzzz
    • [ ] @tsurai
    • [ ] @uasi
    • [ ] @untitaker
    • [ ] @utkarshkukreti
    • [ ] @yeahnoob
    opened by emberian 7
  • Fix build for NetBSD Curses

    Fix build for NetBSD Curses

    NCURSES_MOUSE_VERSION is not defined in NetBSD Curses; This patch checks for NetBSD curses as NetBSD curses uses #define _CURSES_H_ instead of #define __NCURSES_H

    opened by Ella-0 6
  • Add resize_term functions

    Add resize_term functions

    Add the three resize_term functions (resize_term, resizeterm, is_term_resized). I don't see any reason for these to not be a part of the library.

    For reference, see http://invisible-island.net/ncurses/man/resizeterm.3x.html or the ncurses man page (specifically the resizeterm man page).

    opened by gbear605 6
  • Should  ncurses-rs perform / expose `setlocale`.

    Should ncurses-rs perform / expose `setlocale`.

    For wide characters to work, before initializing ncurses the following must be done:

    setlocale(LC_CTYPE, "");
    

    Right now I've resorted to using https://github.com/mahkoh/posix.rs.git, but it seems an overkill to include another library to do something that is a part of standard procedure.

    How about including setlocale in ncurses-rs?

    opened by dpc 6
  • Invalid constant values with NCURSES_MOUSE_VERSION = 1

    Invalid constant values with NCURSES_MOUSE_VERSION = 1

    When NCURSES_MOUSE_VERSION = 1 (happens on Ubuntu 18.04), some constants have different values than when NCURSES_MOUSE_VERSION = 2 (happens on Archlinux, and seems to be what ncurses-rs expects).

    Here is the code from /usr/include/ncurses.h on ubuntu (but this part is the same on Archlinux):

    /*
     * In 32 bits the version-1 scheme does not provide enough space for a 5th
     * button, unless we choose to change the ABI by omitting the reserved-events.
     */
    #if NCURSES_MOUSE_VERSION > 1
    
    #define BUTTON5_RELEASED        NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED)
    #define BUTTON5_PRESSED         NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED)
    #define BUTTON5_CLICKED         NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED)
    #define BUTTON5_DOUBLE_CLICKED  NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED)
    #define BUTTON5_TRIPLE_CLICKED  NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED)
    
    #define BUTTON_CTRL             NCURSES_MOUSE_MASK(6, 0001L)
    #define BUTTON_SHIFT            NCURSES_MOUSE_MASK(6, 0002L)
    #define BUTTON_ALT              NCURSES_MOUSE_MASK(6, 0004L)
    #define REPORT_MOUSE_POSITION   NCURSES_MOUSE_MASK(6, 0010L)
    
    #else
    
    #define BUTTON1_RESERVED_EVENT  NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT)
    #define BUTTON2_RESERVED_EVENT  NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT)
    #define BUTTON3_RESERVED_EVENT  NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT)
    #define BUTTON4_RESERVED_EVENT  NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT)
    
    #define BUTTON_CTRL             NCURSES_MOUSE_MASK(5, 0001L)
    #define BUTTON_SHIFT            NCURSES_MOUSE_MASK(5, 0002L)
    #define BUTTON_ALT              NCURSES_MOUSE_MASK(5, 0004L)
    #define REPORT_MOUSE_POSITION   NCURSES_MOUSE_MASK(5, 0010L)
    
    #endif
    
    #define ALL_MOUSE_EVENTS        (REPORT_MOUSE_POSITION - 1)
    

    In ncurses-rs, these values are defined as constants (hard-coded to the case NCURSES_MOUSE_VERSION = 2), and do not reflect this. As a result, many mouse events are broken when using ncurses-rs on Ubuntu.

    opened by gyscos 5
  • Can't print chars like ✔?

    Can't print chars like ✔?

    Hei!

    Nice work. I'm currently trying the library. Now, i'm trying to print characters like emojis (or others things). And mvprintw(LINES() - 2, 1, "✔") gives me weird symbols. Any way to print this correctly?

    Have a nice day!

    opened by AmarOk1412 5
  • Add a build script to deal with `chtype`

    Add a build script to deal with `chtype`

    Hi,

    Here is a commit to solve the problems due to the size of chtype.

    It's not the first time there are problems with the size of chtype. I found that it was reported (and solved) in #44, but a recent commit (6064435c284c20d31fd6aaf82b13d093fc0eae91) reintroduced the bug. This causes segmentation fault on some systems: I got hit by this bug when using Cursive on a Debian Jessie. Recent issues, #119 and #120, seems related as well.

    The problem is not that easy to solve because the size of chtype depends on several parameters (see the commit message of this patch for the gory details), and the only reliable way to define it seems to use a build script.

    Note that this is the first time I try to use build.rs (and I'm a beginner with Rust), I don't know if there are good practice to follow for build script (my code may be ugly :/). I'm open to suggestions to clean/improve it before it get merged.

    I tested on my Archlinux (OS 64-bit, ncurses v6.0.20161112 => chtype is 32-bit) and on a Debian Jessie (OS 64-bit, ncurses v5.9.20140913 => chtype is 64-bit) and it seems to be working.

    opened by grim7reaper 5
  • `chtype` (and so `attr_t`) is 64bits on Ubuntu 16.10

    `chtype` (and so `attr_t`) is 64bits on Ubuntu 16.10

    • On my machine (archlinux with ncurses 6.0 installed), /usr/include/ncurses.h contains:
    #if 1 && defined(_LP64)
    typedef unsigned chtype;
    typedef unsigned mmask_t;
    # else
    typedef uint32_t chtype;
    typedef uint32_t mmask_t;
    #endif
    

    This results in a 32bits chtype.

    • On a Ubuntu 16.10 docker image (with libncursesw5-dev installed), /usr/include/ncursesw/ncurses.h contains:
    #if 0 && defined(_LP64)
    typedef unsigned chtype;
    typedef unsigned mmask_t;
    #else
    typedef unsigned long chtype;
    typedef unsigned long mmask_t;
    #endif
    

    This results in a 64bits chtype.

    ncurses-rs assumes it is 32 bits, so this type mismatch can cause big troubles in functions like attr_get where ncurses overwrites some extra bytes.

    opened by gyscos 5
  • garbled Chinese characters and setlocale doesn't work

    garbled Chinese characters and setlocale doesn't work

    I am trying to print Chinese character in a ncurses screen

        log::debug!("row str {}", row_str);
        ncurses::addstr(&row_str);
    

    variable row_str is displayed well in as a parameter of log::debug , but get garbled by using ncurses::addstr.

    i've tried to fix by the following 3 methods, but no one works.

        // method 1
        gettextrs::setlocale(gettextrs::LocaleCategory::LcAll, "");
        // method 2
        use libc::setlocale;
        unsafe {
            setlocale(0, "".as_bytes().as_ptr() as *const i8);
        }
        //method 3
        ncurses::setlocale(ncurses::constants::LcCategory::all, "")
    
    opened by SmileXie 0
  • Unable to refit contents of root when terminal is resized

    Unable to refit contents of root when terminal is resized

    For some reason, I am unable to get my program to adjust to the terminal when it changes size. I know that the terminal is sending SIGWINCH because other ncurses programs are able to resize by themselves just fine.

    Initially, I thought that refresh() by itself would be enough because the original c++ version of the program I am rewriting was able to use it alone. Continuing to look at the documentation, however, I noticed that resizeterm(0,0) is also supposed to refit the ncurses contents to the terminal window.

    Code

    opened by papuSpartan 0
  • Critical 9.8/10 vulnerability for this library

    Critical 9.8/10 vulnerability for this library

    opened by vwbusguy 4
  • Cross-compiling breaks with ncurses-5.101.0?

    Cross-compiling breaks with ncurses-5.101.0?

    I'm trying to build a project with GitLab's CI using docker image katharostech/rust-osxcross.

    It works nice for native build, however with --target=x86_64-apple-darwin it breaks like the following:

    cargo build --target=x86_64-apple-darwin
       Compiling itoa v0.4.8
       Compiling ryu v1.0.6
       Compiling serde v1.0.130
       Compiling libc v0.2.109
       Compiling serde_json v1.0.72
       Compiling ncurses v5.101.0
    error: failed to run custom build command for `ncurses v5.101.0`
    Caused by:
      process didn't exit successfully: `/builds/me/myproject/target/debug/build/ncurses-21d2ecc62be4b2b5/build-script-build` (exit code: 101)
    --- stdout
    cargo:rerun-if-env-changed=PKG_CONFIG_PATH
    cargo:rerun-if-env-changed=NCURSES5_NO_PKG_CONFIG
    cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64-apple-darwin
    cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64_apple_darwin
    cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
    cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
    cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-apple-darwin
    cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_apple_darwin
    cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
    cargo:rerun-if-env-changed=PKG_CONFIG
    cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-apple-darwin
    cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_apple_darwin
    cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
    cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
    cargo:rerun-if-env-changed=NCURSES_NO_PKG_CONFIG
    cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64-apple-darwin
    cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64_apple_darwin
    cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
    cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
    cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-apple-darwin
    cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_apple_darwin
    cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
    cargo:rerun-if-env-changed=PKG_CONFIG
    cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-apple-darwin
    cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_apple_darwin
    cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
    cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
    cargo:rustc-link-lib=ncurses
    OPT_LEVEL = Some("0")
    TARGET = Some("x86_64-apple-darwin")
    HOST = Some("x86_64-unknown-linux-gnu")
    CC_x86_64-apple-darwin = None
    CC_x86_64_apple_darwin = None
    TARGET_CC = None
    CC = None
    CROSS_COMPILE = None
    CFLAGS_x86_64-apple-darwin = None
    CFLAGS_x86_64_apple_darwin = None
    TARGET_CFLAGS = None
    CFLAGS = None
    CRATE_CC_NO_DEFAULTS = None
    DEBUG = Some("true")
    CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2,sse3,ssse3")
    --- stderr
    cc: error: x86_64: No such file or directory
    cc: error: unrecognized command line option '-arch'; did you mean '-march='?
    thread 'main' panicked at 'assertion failed: command.status().expect("compilation failed").success()', /builds/me/myproject/.cargo/registry/src/github.com-1ecc6299db9ec823/ncurses-5.101.0/build.rs:105:5
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
    

    And just in case on my local Ubuntu with OSXcross installed, it breaks in the similar manner, too.

    Would be grateful for any hint or assistance :)

    opened by 097115 2
  • menu example is not working for me

    menu example is not working for me

    I'm running NixOS 21.05, but the menu example is not working. (I tried, because I have problems in my project using menu).

    nix-shell -p --run "cargo run --example ex_5"
       Compiling libc v0.2.102
       Compiling pkg-config v0.3.19
       Compiling cc v1.0.70
       Compiling ncurses v5.100.0 (/home/palo/dev/ncurses-rs)
    warning: variable does not need to be mutable
      --> build.rs:79:9
       |
    79 |     let mut build = cc::Build::new();
       |         ----^^^^^
       |         |
       |         help: remove this `mut`
       |
       = note: `#[warn(unused_mut)]` on by default
    
    warning: variable does not need to be mutable
       --> build.rs:104:9
        |
    104 |     let mut build = cc::Build::new();
        |         ----^^^^^
        |         |
        |         help: remove this `mut`
    
    warning: unused `Result` that must be used
      --> build.rs:95:5
       |
    95 |     file.write_all(&consts.stdout);
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: `#[warn(unused_must_use)]` on by default
       = note: this `Result` may be an `Err` variant, which should be handled
    
    warning: unused `Result` that must be used
       --> build.rs:120:5
        |
    120 |     file.write_all(&consts.stdout);
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: this `Result` may be an `Err` variant, which should be handled
    
    warning: `ncurses` (build script) generated 4 warnings
    error: failed to run custom build command for `ncurses v5.100.0 (/home/palo/dev/ncurses-rs)`
    
    Caused by:
      process didn't exit successfully: `/home/palo/dev/ncurses-rs/target/debug/build/ncurses-09f72d651aec0eab/build-script-build` (exit status: 101)
      --- stdout
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=NCURSES5_NO_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG
      cargo:rerun-if-env-changed=NCURSES5_STATIC
      cargo:rerun-if-env-changed=NCURSES5_DYNAMIC
      cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
      cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
      cargo:rerun-if-env-changed=NCURSES_NO_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG
      cargo:rerun-if-env-changed=NCURSES_STATIC
      cargo:rerun-if-env-changed=NCURSES_DYNAMIC
      cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
      cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
      cargo:rustc-link-lib=ncurses
      OPT_LEVEL = Some("0")
      TARGET = Some("x86_64-unknown-linux-gnu")
      HOST = Some("x86_64-unknown-linux-gnu")
      CC_x86_64-unknown-linux-gnu = None
      CC_x86_64_unknown_linux_gnu = None
      HOST_CC = None
      CC = Some("gcc")
      CFLAGS_x86_64-unknown-linux-gnu = None
      CFLAGS_x86_64_unknown_linux_gnu = None
      HOST_CFLAGS = None
      CFLAGS = None
      CRATE_CC_NO_DEFAULTS = None
      DEBUG = Some("true")
      CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
    
      --- stderr
      In file included from /nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/assert.h:35,
                       from /home/palo/dev/ncurses-rs/target/debug/build/ncurses-d3ec6d0e162c87ed/out/chtype_size.c:2:
      /nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
        397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
            |    ^~~~~~~
      /home/palo/dev/ncurses-rs/target/debug/build/ncurses-d3ec6d0e162c87ed/out/chtype_size.c:6:10: fatal error: ncurses.h: No such file or directory
          6 | #include <ncurses.h>
            |          ^~~~~~~~~~~
      compilation terminated.
      thread 'main' panicked at 'assertion failed: command.status().expect(\"compilation failed\").success()', build.rs:166:5
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    
    opened by mrVanDalo 0
Owner
Jeaye Wilkerson
I'm a leader, a problem solver, and a hacker with a passion for privacy and security.
Jeaye Wilkerson
Verified Rust for low-level systems code

See Goals for a brief description of the project's goals. Building the project The main project source is in source. tools contains scripts for settin

Secure Foundations Lab 95 Dec 27, 2022
Horus is an open source tool for running forensic and administrative tasks at the kernel level using eBPF, a low-overhead in-kernel virtual machine, and the Rust programming language.

Horus Horus is an open-source tool for running forensic and administrative tasks at the kernel level using eBPF, a low-overhead in-kernel virtual mach

null 4 Dec 15, 2022
Rust low-level minimalist APNG writer and PNG reader with just a few dependencies with all possible formats coverage (including HDR).

project Wiki https://github.com/js29a/micro_png/wiki at glance use micro_png::*; fn main() { // load an image let image = read_png("tmp/test.

jacek SQ6KBQ 8 Aug 30, 2023
A new pure-Rust library for cross-platform low-level access to USB devices.

nusb A new pure-Rust library for cross-platform low-level access to USB devices. Documentation Compared to rusb and libusb Pure Rust, no dependency on

Kevin Mehall 23 Oct 30, 2023
A low-level MVCC file format for storing blobs.

Sediment This repository isn't ready for public consumption. It just reached a stage where I wanted to start sharing ideas with others as well as usin

Khonsu Labs 24 Jan 8, 2023
Unopinionated low level API bindings focused on soundness, safety, and stronger types over raw FFI.

?? firehazard ?? Create a fire hazard by locking down your (Microsoft) Windows so nobody can escape (your security sandbox.) Unopinionated low level A

null 5 Nov 17, 2022
Simple low-level web server to serve file uploads with some shell scripting-friendly features

http_file_uploader Simple low-level web server to serve file uploads with some shell scripting-friendly features. A bridge between Web's multipart/for

Vitaly Shukela 2 Oct 27, 2022
Low level access to processors using the AArch64 execution state.

aarch64-cpu Low level access to processors using the AArch64 execution state. Usage Please note that for using this crate's register definitions (as p

Rust Embedded 18 Jan 5, 2023
High-performance, low-level framework for composing flexible web integrations

High-performance, low-level framework for composing flexible web integrations. Used mainly as a dependency of `barter-rs` project

Barter 8 Dec 28, 2022
Wrapper around atspi-code to provide higher-level at-spi Rust bindings

atspi Wrapper around atspi-codegen to provide higher-level at-spi Rust bindings. Contributions Take a look at our atspi-codegen crate, and try inpleme

Odilia 3 Feb 7, 2022
Low overhead Rust implementation of time-related concepts

It's Rust time! Low overhead implementation of time-related concepts. Who is time for? For applications where simplicity and low-overhead are more imp

MOIA GmbH - Open Source 10 Feb 20, 2023
F-Fetch targets low systems. Written in Rust. It's very simple, designed so you can pick it up and replace it.

F-Fetch F-Fetch targets low systems. Written in Rust. It's very simple, designed so you can pick it up and replace it. First Look ~/.config/ffetch/con

cd 3 Jul 10, 2023
Tool to draw low-resolution graphs in terminal

lowcharts Tool to draw low-resolution graphs in terminal. lowcharts is meant to be used in those scenarios where we have numerical data in text files

juanleon lahoz 114 Dec 31, 2022
Enhance low quality images and videos using AI technology.

Real ESRGAN GUI Real ESRGAN GUI is a simple and minimal GUI for xinntao's Real-ESRGAN This allows you to enhance low quality images and videos using A

null 20 Dec 21, 2022
The hacker's BLE (bluetooth low energy) browser terminal app

Blendr is a terminal UI app for browsing BLE (Bluetooth Low Energy) devices. It allows you to inspect, search, connect, and analyze data coming from B

Dmitriy Kovalenko 120 Jul 4, 2023
Rust Imaging Library's Python binding: A performant and high-level image processing library for Python written in Rust

ril-py Rust Imaging Library for Python: Python bindings for ril, a performant and high-level image processing library written in Rust. What's this? Th

Cryptex 13 Dec 6, 2022
Real-time CLI level meter built in Rust.

Meter This is a very simple command line utility written in Rust for measuring the gain of a microphone. It displays the values in dBFS. This is usefu

Chris Burgess 16 Sep 8, 2022
Conference Monitoring Project based on Image Recognition that uses Rust Language and AWS Rekognition service to get the level of image similarity.

Conference Monitoring System based on Image Recognition in Rust This is a Conference Monitoring Project based on Image Recognition that uses Rust Lang

Pankaj Chaudhary 6 Dec 18, 2022
A lightweight and high-performance order-book designed to process level 2 and trades data. Available in Rust and Python

ninjabook A lightweight and high-performance order-book implemented in Rust, designed to process level 2 and trades data. Available in Python and Rust

Ninja Quant 134 Jul 22, 2024