Skip to content

[BUG] Build error when using ncurses-backend #815

Open

Description

@nwrenger

Describe the bug
When trying to build my File Editor TUI using ncurses-backend I am getting an implementation error related to cursive v0.21.1. As I upgraded to cursive v0.21.1, this error does not occur in cursive v0.20.0.

To Reproduce
Build any app on MacOS using ncurses-backend this error occurs.

Expected behavior
A working Build.

Environment

  • MacOS
  • Backend used: ncurses
  • Current locale:
LANG=""
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
  • Cursive version: v0.21.1

Additional context
Error trace:

 Compiling cursive v0.21.1
error[E0425]: cannot find value `BUTTON5_DOUBLE_CLICKED` in crate `ncurses`
   --> /Users/nils/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cursive-0.21.1/src/backends/curses/n.rs:267:52
    |
267 |                         (mevent.bstate == ncurses::BUTTON5_DOUBLE_CLICKED as mmask_t)
    |                                                    ^^^^^^^^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `BUTTON1_DOUBLE_CLICKED`
    |
   ::: /Users/nils/Documents/code/sys/omega/target/debug/build/ncurses-0d2a84155b7472a5/out/raw_constants.rs:129:1
    |
129 | pub const BUTTON1_DOUBLE_CLICKED: i32 = 8;
    | ------------------------------------- similarly named constant `BUTTON1_DOUBLE_CLICKED` defined here

error[E0531]: cannot find unit struct, unit variant or constant `BUTTON5_RELEASED` in crate `ncurses`
   --> /Users/nils/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cursive-0.21.1/src/backends/curses/n.rs:437:18
    |
437 |         ncurses::BUTTON5_RELEASED
    |                  ^^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `BUTTON1_RELEASED`
    |
   ::: /Users/nils/Documents/code/sys/omega/target/debug/build/ncurses-0d2a84155b7472a5/out/raw_constants.rs:126:1
    |
126 | pub const BUTTON1_RELEASED: i32 = 1;
    | ------------------------------- similarly named constant `BUTTON1_RELEASED` defined here

error[E0531]: cannot find unit struct, unit variant or constant `BUTTON5_PRESSED` in crate `ncurses`
   --> /Users/nils/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cursive-0.21.1/src/backends/curses/n.rs:438:20
    |
438 |         | ncurses::BUTTON5_PRESSED
    |                    ^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `BUTTON1_PRESSED`
    |
   ::: /Users/nils/Documents/code/sys/omega/target/debug/build/ncurses-0d2a84155b7472a5/out/raw_constants.rs:127:1
    |
127 | pub const BUTTON1_PRESSED: i32 = 2;
    | ------------------------------ similarly named constant `BUTTON1_PRESSED` defined here

error[E0531]: cannot find unit struct, unit variant or constant `BUTTON5_CLICKED` in crate `ncurses`
   --> /Users/nils/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cursive-0.21.1/src/backends/curses/n.rs:439:20
    |
439 |         | ncurses::BUTTON5_CLICKED
    |                    ^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `BUTTON1_CLICKED`
    |
   ::: /Users/nils/Documents/code/sys/omega/target/debug/build/ncurses-0d2a84155b7472a5/out/raw_constants.rs:128:1
    |
128 | pub const BUTTON1_CLICKED: i32 = 4;
    | ------------------------------ similarly named constant `BUTTON1_CLICKED` defined here

error[E0531]: cannot find unit struct, unit variant or constant `BUTTON5_DOUBLE_CLICKED` in crate `ncurses`
   --> /Users/nils/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cursive-0.21.1/src/backends/curses/n.rs:440:20
    |
440 |         | ncurses::BUTTON5_DOUBLE_CLICKED
    |                    ^^^^^^^^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `BUTTON1_DOUBLE_CLICKED`
    |
   ::: /Users/nils/Documents/code/sys/omega/target/debug/build/ncurses-0d2a84155b7472a5/out/raw_constants.rs:129:1
    |
129 | pub const BUTTON1_DOUBLE_CLICKED: i32 = 8;
    | ------------------------------------- similarly named constant `BUTTON1_DOUBLE_CLICKED` defined here

error[E0531]: cannot find unit struct, unit variant or constant `BUTTON5_TRIPLE_CLICKED` in crate `ncurses`
   --> /Users/nils/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cursive-0.21.1/src/backends/curses/n.rs:441:20
    |
441 |         | ncurses::BUTTON5_TRIPLE_CLICKED => MouseButton::Button5,
    |                    ^^^^^^^^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `BUTTON1_TRIPLE_CLICKED`
    |
   ::: /Users/nils/Documents/code/sys/omega/target/debug/build/ncurses-0d2a84155b7472a5/out/raw_constants.rs:130:1
    |
130 | pub const BUTTON1_TRIPLE_CLICKED: i32 = 16;
    | ------------------------------------- similarly named constant `BUTTON1_TRIPLE_CLICKED` defined here

error[E0531]: cannot find unit struct, unit variant or constant `BUTTON5_PRESSED` in crate `ncurses`
   --> /Users/nils/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cursive-0.21.1/src/backends/curses/n.rs:466:18
    |
466 |         ncurses::BUTTON5_PRESSED => f(MouseEvent::WheelDown),
    |                  ^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `BUTTON1_PRESSED`
    |
   ::: /Users/nils/Documents/code/sys/omega/target/debug/build/ncurses-0d2a84155b7472a5/out/raw_constants.rs:127:1
    |
127 | pub const BUTTON1_PRESSED: i32 = 2;
    | ------------------------------ similarly named constant `BUTTON1_PRESSED` defined here

Some errors have detailed explanations: E0425, E0531.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `cursive` (lib) due to 7 previous errors

Activity

  1. gyscos commented on Oct 14, 2025

    @gyscos
    Owner

    Hi, and thanks for the report!

    I'm not super familiar with building ncurses on macos (you may have better luck using the crossterm backend for example). It looks like an issue in the ncurses-rs crate. Unfortunately this repo has since been archived, and will likely not get fixes.

    We could consider switching to another ncurses rust bindings, maybe https://github.com/narfit66/ncursesw-rs (though it also hasn't been updated for 3 years).

    Is there a reason you need the ncurses backend specifically, and not crossterm or termion? The main advantage of ncurses is the somewhat better input support (things like shift/ctrl + Fn keys are better supported, at least on linux). It also used to have a performance advantage, but the other backends should have caught up by now.

  2. nwrenger commented on Oct 15, 2025

    @nwrenger
    Author

    I just want to have working color support for macOS built in terminal app. The built in terminal is a little bit quirky because (1) users can have there own terminal coloring, which interferes with coloring from crossterm/termion, and (2) not by default enabled 256-color & truecolor support. The easiest fix for me was to use ncurses which is able to handle these edge cases…

  3. added 2 commits that reference this issue on May 3, 2026
    49919b5
    e1aa477
  4. badscrew commented on May 3, 2026

    @badscrew
    Contributor

    Hi -
    I would like to propose a PR that resolves this (see previous message or #870),
    it adds a probe for the existence of the BUTTON5 in the ncurses bindings. if not found (like on macos ncurses), it gates the build and avoids the errors when building for ncurses backend.

    Hope this is helpful

  5. added 3 commits that reference this issue on May 3, 2026
    8174440
    675e107
    d389df8
  6. badscrew commented on May 3, 2026

    @badscrew
    Contributor

    @nwrenger - could you grab my branch from the PR, test and see if it works as expected for your use case please?
    https://github.com/badscrew/cursive/tree/fix/ncurses-button5-probe

  7. nwrenger commented on May 4, 2026

    @nwrenger
    Author

    Yeah, your fix definitely works. It can compile with working input and coloring.

    But, in testing and with a little bit of research I found out that starting with macOS 26 Tahoe the built-in terminal app now ships with the required coloring features to support coloring with the crossterm backend (256-color & truecolor). Therefore, I won't be switching back to ncurses.

  8. badscrew commented on May 4, 2026

    @badscrew
    Contributor

    Well it's done anyway :)
    @gyscos - we have a tester who tested this PR

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions