fcsonline / tmux-thumbs

A lightning fast version of tmux-fingers written in Rust, copy/pasting tmux like vimium/vimperator
MIT License
890 stars 61 forks source link

Error building (termbox) on macOS #27

Closed jrop closed 4 years ago

jrop commented 4 years ago

I am getting the following error when attempting to build this crate on macOS Catalina (10.15.3 (19D76)):

❯ env RUST_BACKTRACE=1 cargo build
   Compiling termbox-sys v0.2.11
   Compiling num-traits v0.1.43
   Compiling regex v1.3.1
   Compiling tempfile v3.1.0
   Compiling gag v0.1.10
error: failed to run custom build command for `termbox-sys v0.2.11`

Caused by:
  process didn't exit successfully: `/Users/jonathan/.tmux/plugins/tmux-thumbs/target/debug/build/termbox-sys-c35f0e040836f872/build-script-build` (exit code: 101)
--- stdout
running: "rm" "-rf" ".termbox"
running: "git" "clone" "https://github.com/nsf/termbox" ".termbox"
waf configure: setting CFLAGS to: `-m64 -fPIC`
running: "./waf" "configure" "--prefix=/"
Setting top to                           : /Users/jonathan/.cargo/registry/src/github.com-1ecc6299db9ec823/termbox-sys-0.2.11/.termbox 
Setting out to                           : /Users/jonathan/.cargo/registry/src/github.com-1ecc6299db9ec823/termbox-sys-0.2.11/.termbox/build 
Checking for 'clang' (C compiler)        : /usr/bin/clang 
'configure' finished successfully (0.227s)

--- stderr
Cloning into '.termbox'...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:1188:5
stack backtrace:
   0: std::sys_common::at_exit_imp::push
   1: core::fmt::ArgumentV1::show_usize
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
   6: std::panicking::try::do_call
   7: core::panicking::panic_fmt
             at src/libcore/panicking.rs:84
   8: core::result::unwrap_failed
             at src/libcore/result.rs:1188
   9: core::result::Result<T,E>::unwrap
             at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/result.rs:956
  10: build_script_build::run
             at ./build.rs:88
  11: build_script_build::configure
             at ./build.rs:58
  12: build_script_build::main
             at ./build.rs:11
  13: std::rt::lang_start::{{closure}}
  14: std::panicking::try::do_call
  15: panic_unwind::dwarf::eh::read_encoded_pointer
  16: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
  17: std::rt::lang_start
  18: build_script_build::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed
fcsonline commented 4 years ago

Is there some termbox issue about this?

rafi commented 4 years ago

14 might be related

jrop commented 4 years ago

@fcsonline I linked the relevant termbox issue above ☝️

fcsonline commented 4 years ago

Is this working for you?

jrop commented 4 years ago

@fcsonline Unfortunately it is not, but it is due to termbox-sys, and not this project. Until they cut a new release, I don't think this will work on my Mac. I left this issue open because, once termbox-sys releases a fix, this tool will likely need to upgrade to the new version in order for this to be fixed for me.

fcsonline commented 4 years ago

Ok, no problem. Waiting for a termbox's fix.

jrop commented 4 years ago

@fcsonline 👇

(@ghcp) Just published 0.2.12 [of termbox-sys]

fcsonline commented 4 years ago

Perfect, now it is time to rustbox to update the dependency :crossed_fingers: :

https://github.com/gchp/rustbox

avshyz commented 4 years ago

Just got the same error!

fcsonline commented 4 years ago

It seems that rustbox crate is not maintained. I'll try to find an alternative. Something like https://github.com/redox-os/termion

gegnew commented 4 years ago

Anyone figure out a temporary fix for this?

fcsonline commented 4 years ago

Nice! I have a working branch using termion :muscle: . I want to review it a bit before release it.

tompreston commented 4 years ago

I get a similar issue with termbox on Fedora 32. The feature/termion branch works though!

Click to see Fedora build error ``` ~/.tmux/plugins/tmux-thumbs$ cargo build --release --verbose Fresh cfg-if v0.1.10 Fresh ppv-lite86 v0.2.6 Fresh autocfg v0.1.7 Fresh remove_dir_all v0.5.2 Fresh lazy_static v1.4.0 Fresh unicode-width v0.1.7 Fresh ansi_term v0.11.0 Fresh regex-syntax v0.6.12 Fresh vec_map v0.8.1 Fresh strsim v0.8.0 Fresh bitflags v0.2.1 Fresh c2-chacha v0.2.3 Fresh textwrap v0.11.0 Fresh thread_local v0.3.6 Fresh libc v0.2.66 Fresh getrandom v0.1.13 Fresh memchr v2.2.1 Fresh bitflags v1.2.1 Fresh atty v0.2.13 Compiling termbox-sys v0.2.11 Fresh rand_core v0.5.1 Fresh num-traits v0.2.10 Fresh aho-corasick v0.7.6 Fresh clap v2.33.0 Fresh rand_chacha v0.2.1 Fresh num-traits v0.1.43 Fresh regex v1.3.1 Running `rustc --crate-name termbox_sys /home/tpreston/.cargo/registry/src/github.com-1ecc6299db9ec823/termbox-sys-0.2.11/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=06359d8e647de566 -C extra-filename=-06359d8e647de566 --out-dir /home/tpreston/.dotfiles/tmux/dot-tmux/plugins/tmux-thumbs/target/release/deps -L dependency=/home/tpreston/.dotfiles/tmux/dot-tmux/plugins/tmux-thumbs/target/release/deps --cap-lints allow -L /home/tpreston/.dotfiles/tmux/dot-tmux/plugins/tmux-thumbs/target/release/build/termbox-sys-421425509eeb1456/out/lib -l static=termbox` Fresh rand v0.7.2 Compiling tempfile v3.1.0 Running `rustc --crate-name tempfile --edition=2018 /home/tpreston/.cargo/registry/src/github.com-1ecc6299db9ec823/tempfile-3.1.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=0c7ddf7419776c95 -C extra-filename=-0c7ddf7419776c95 --out-dir /home/tpreston/.dotfiles/tmux/dot-tmux/plugins/tmux-thumbs/target/release/deps -L dependency=/home/tpreston/.dotfiles/tmux/dot-tmux/plugins/tmux-thumbs/target/release/deps --extern cfg_if=/home/tpreston/.dotfiles/tmux/dot-tmux/plugins/tmux-thumbs/target/release/deps/libcfg_if-df590fbfbcfacc4d.rmeta --extern libc=/home/tpreston/.dotfiles/tmux/dot-tmux/plugins/tmux-thumbs/target/release/deps/liblibc-967ebfff6b6589ae.rmeta --extern rand=/home/tpreston/.dotfiles/tmux/dot-tmux/plugins/tmux-thumbs/target/release/deps/librand-a801d9ec81b416da.rmeta --extern remove_dir_all=/home/tpreston/.dotfiles/tmux/dot-tmux/plugins/tmux-thumbs/target/release/deps/libremove_dir_all-a591bb9d76456107.rmeta --cap-lints allow` error: could not find native static library `termbox`, perhaps an -L flag is missing? error: aborting due to previous error error: could not compile `termbox-sys`. Caused by: process didn't exit successfully: `rustc --crate-name termbox_sys /home/tpreston/.cargo/registry/src/github.com-1ecc6299db9ec823/termbox-sys-0.2.11/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=06359d8e647de566 -C extra-filename=-06359d8e647de566 --out-dir /home/tpreston/.dotfiles/tmux/dot-tmux/plugins/tmux-thumbs/target/release/deps -L dependency=/home/tpreston/.dotfiles/tmux/dot-tmux/plugins/tmux-thumbs/target/release/deps --cap-lints allow -L /home/tpreston/.dotfiles/tmux/dot-tmux/plugins/tmux-thumbs/target/release/build/termbox-sys-421425509eeb1456/out/lib -l static=termbox` (exit code: 1) warning: build failed, waiting for other jobs to finish... error: build failed ```
avshyz commented 4 years ago

I have a bug with that branch. It seems to be working, at first, but when I run a command that has a pager (less, git show, git log, etc') it breaks thumbs (i.e., it becomes jittery, and the command output start to flicker. Every run thereafter of tmux thumbs will cause a jitter.

Here's a screen recording of the weird behaviour https://drive.google.com/file/d/1r_i-58v2e3B3uDRbdHuPGXSzS4eJJi4k/view?usp=sharing

EDIT: In retrospect, this might not be completely related to that branch. Let me know if thats the case and I'll open a new ticket! :)

rafi commented 4 years ago

Nice! I have a working branch using termion. I want to review it a bit before release it.

@fcsonline regarding termion branch, I've noticed text-bleed and invisibility when used on a tmux vertical split when height is less than 100%.

fcsonline commented 4 years ago

I'm going to test a bit more all those cases. It is hard to change the underneath UI library keeping exactly the same behavior. For this reason I really appreciate all your feedback on this branch.

fcsonline commented 4 years ago

@avshyz and @rafi I just pushed new code in that branch. Review it because I think I fixed the glitches you are talking about.

Double-check you use the last code because I force pushed the branch.

rafi commented 4 years ago

@fcsonline much better, text is not jittered. However, the overlay buffer y-axis isn't perfect. Sometimes it's off by a few lines, other times the beginning of buffer appears. I suspect tmux's split height isn't being computed or coupled-in right.

avshyz commented 4 years ago

@fcsonline - I confirm what @rafi have seen (though it's a huge improvement!)

fcsonline commented 4 years ago

Check if this is the case described in this issue:

https://github.com/fcsonline/tmux-thumbs/issues/1

This is one of the oldest issues with long lines. 😅 Long lines and wrapping break all the things. I have been super lazy trying to solve this.

If this is the case, then I think the branch is quite ready.

fcsonline commented 4 years ago

It seems that the termion branch solves the long line issue too. :muscle:

I start to feel really comfortable with the stability of this branch. So the merge will be sooner than later.

fcsonline commented 4 years ago

The branch was merged! :rocket: Also I enabled again the mac build in CI. Closing this issue!