jmacdonald / amp

A complete text editor for your terminal.
https://amp.rs
Other
3.73k stars 105 forks source link

compilation error on Fedora - termbox library issue #136

Closed ibukanov closed 5 years ago

ibukanov commented 5 years ago

On Fedora 29 running cargo install amp with the latest stable Rust and Cargo gives:

could not find native static library termbox, perhaps an -L flag is missing?

I initially thought this is related #95, but on Fedora python still points to Python2, so this is something else. On Ubuntu 18.04 cargo install amp works.

jmacdonald commented 5 years ago

Hmm, the termbox-sys crate just clones the repo and runs the termbox build under the hood. Is git installed on that machine? It could also be the termbox build failing, but we should see output that'd indicate that.

ibukanov commented 5 years ago

Yes, git is installed. cargo install -v gives:

error: Could not compile `termbox-sys`.

Caused by:
  process didn't exit successfully: `rustc --crate-name termbox_sys /home/igor/.cargo/registry/src/github.com-1ecc6299db9ec823/termbox-sys-0.2.11/lib.rs --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=eb4d5fa4c245464c -C extra-filename=-eb4d5fa4c245464c --out-dir /tmp/cargo-installwE5sNX/release/deps -L dependency=/tmp/cargo-installwE5sNX/release/deps --cap-lints allow -L /tmp/cargo-installwE5sNX/release/build/termbox-sys-26f724f97a589134/out/lib -l static=termbox` (exit code: 1)

When I looked into /tmp/cargo-installwE5sNX/release/build/termbox-sys-26f724f97a589134/, I do not see out/lib there. But there is out/lib64 with a static library. So the build script passes the wrong location for termbox library on Fedora.

ibukanov commented 5 years ago

This is https://github.com/gchp/termbox-sys/pull/20.

q66 commented 5 years ago

Yep, I ran into this in Void Linux while building for ppc64le a while ago, so I patched it in: https://github.com/void-linux/void-packages/blob/master/srcpkgs/amp/patches/termbox-fix.patch

Seems like the issue is not specific to Void or ppc64le but also happens in various other 64-bit environments, which makes sense.

jmacdonald commented 5 years ago

For what it's worth, 0.6.0 will fix this, since it moves away from termbox entirely. If that patch lands in termbox-sys, I'll happily bring it into the current 0.5.2.

ibukanov commented 5 years ago

As a workaround to compile I added to Cargo.toml in my local checkout of amp:

[patch.crates-io]
termbox-sys = { git = 'https://github.com/q66/termbox-sys.git' }

That repo contains the fix.

AZanellato commented 5 years ago

Hi @ibukanov, did you ran into any troubles after doing this?

I'm not being able to build amp on my machine with the error

error: linking with `cc` failed: exit code: 1

Something to do with openssl, perhaps?

jmacdonald commented 5 years ago

This is fixed in master, as I've moved away termbox and am doing all of the rendering/screen buffering directly in amp, now. I'll be pushing out a 0.6.0 release over the next two weeks.