withoutboats / notty

A new kind of terminal
GNU Affero General Public License v3.0
2.3k stars 41 forks source link

How do I build and run notty? #29

Closed pscollins closed 8 years ago

pscollins commented 8 years ago

I cloned the repo and ran cargo build, but I see:

➜  notty git:(master) cargo build
    Updating registry `https://github.com/rust-lang/crates.io-index`
    Updating git repository `https://github.com/withoutboats/notty-encoding`
 Downloading unicode-width v0.1.3
 Downloading mime v0.1.3
 Downloading base64 v0.1.1
 Downloading serde v0.6.15
 Downloading libc v0.2.7
 Downloading log v0.3.5
 Downloading num v0.1.31
   Compiling unicode-width v0.1.3
   Compiling libc v0.2.7
   Compiling base64 v0.1.1
   Compiling num v0.1.31
   Compiling notty-encoding v0.1.0 (https://github.com/withoutboats/notty-encoding#671ce83f)
   Compiling log v0.3.5
/home/patrick/.cargo/git/checkouts/notty-encoding-f90d2d7580660013/master/src/args/movement.rs:16:9: 16:44 error: expected type, found `/// Direction of the tab character.`
/home/patrick/.cargo/git/checkouts/notty-encoding-f90d2d7580660013/master/src/args/movement.rs:16         /// Direction of the tab character.
                                                                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build failed, waiting for other jobs to finish...
Could not compile `notty-encoding`.

To learn more, run the command again with --verbose.

Is this a regression introduced by https://github.com/withoutboats/notty-encoding/commit/91d7e8c0b31ce3b23d96c3d96ddc0b791263e742, or is there something wrong with my environment? I've never used Rust before so I may be missing something obvious.

waynr commented 8 years ago

What version of rust are you running? Would you mind running cargo build --verbose and putting that output up also?

pscollins commented 8 years ago

@waynr

➜  notty git:(master) rustc --version
rustc 1.4.0-dev
➜  notty git:(master) cargo build --verbose
       Fresh libc v0.2.7
       Fresh base64 v0.1.1
       Fresh num v0.1.31
       Fresh unicode-width v0.1.3
       Fresh log v0.3.5
   Compiling notty-encoding v0.1.0 (https://github.com/withoutboats/notty-encoding#671ce83f)
     Running `rustc /home/patrick/.cargo/git/checkouts/notty-encoding-f90d2d7580660013/master/src/lib.rs --crate-name notty_encoding --crate-type lib -g -C metadata=0aeced2207c1f18d -C extra-filename=-0aeced2207c1f18d --out-dir /home/patrick/clones/notty/target/debug/deps --emit=dep-info,link -L dependency=/home/patrick/clones/notty/target/debug/deps -L dependency=/home/patrick/clones/notty/target/debug/deps --extern base64=/home/patrick/clones/notty/target/debug/deps/libbase64-93ea9e770c64ecb7.rlib --cap-lints allow`
       Fresh serde v0.6.15
   Compiling mime v0.1.3
     Running `rustc /home/patrick/.cargo/registry/src/github.com-0a35038f75765ae4/mime-0.1.3/src/lib.rs --crate-name mime --crate-type lib -g -C metadata=109af1bd8e9e4434 -C extra-filename=-109af1bd8e9e4434 --out-dir /home/patrick/clones/notty/target/debug/deps --emit=dep-info,link -L dependency=/home/patrick/clones/notty/target/debug/deps -L dependency=/home/patrick/clones/notty/target/debug/deps --extern log=/home/patrick/clones/notty/target/debug/deps/liblog-a262ced734fdfaf2.rlib --extern serde=/home/patrick/clones/notty/target/debug/deps/libserde-55bc167bcdf48a44.rlib --cap-lints allow`
/home/patrick/.cargo/git/checkouts/notty-encoding-f90d2d7580660013/master/src/args/movement.rs:16:9: 16:44 error: expected type, found `/// Direction of the tab character.`
/home/patrick/.cargo/git/checkouts/notty-encoding-f90d2d7580660013/master/src/args/movement.rs:16         /// Direction of the tab character.
                                                                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build failed, waiting for other jobs to finish...
Could not compile `notty-encoding`.

Caused by:
  Process didn't exit successfully: `rustc /home/patrick/.cargo/git/checkouts/notty-encoding-f90d2d7580660013/master/src/lib.rs --crate-name notty_encoding --crate-type lib -g -C metadata=0aeced2207c1f18d -C extra-filename=-0aeced2207c1f18d --out-dir /home/patrick/clones/notty/target/debug/deps --emit=dep-info,link -L dependency=/home/patrick/clones/notty/target/debug/deps -L dependency=/home/patrick/clones/notty/target/debug/deps --extern base64=/home/patrick/clones/notty/target/debug/deps/libbase64-93ea9e770c64ecb7.rlib --cap-lints allow` (exit code: 101)

Is my rust too old? I just grabbed the one available as an Ubuntu PPA.

withoutboats commented 8 years ago

I was able to replicate when building with Rust 1.4.0. Building with 1.6.0 does not have this issue.

I've pushed up a fix and confirmed that notty-encoding now builds on 1.4.0. If you run cargo update it should fetch the commit. Please post if you have any more questions. :-)

pscollins commented 8 years ago

@withoutboats Apparently the "Rust nightly updates" PPA I got it from hasn't been updated in a year, which explains the old version. I grabbed 1.6.0 with:

➜  notty git:(master) curl -sSf https://static.rust-lang.org/rustup.sh | sh

as described on the Rust download page, but after a cargo update and cargo buiild I'm getting:

➜  notty git:(master) cargo build --verbose                                
       Fresh unicode-width v0.1.3
       Fresh libc v0.2.7
       Fresh base64 v0.1.1
       Fresh num v0.1.31
       Fresh log v0.3.5
       Fresh notty-encoding v0.1.0 (https://github.com/withoutboats/notty-encoding#38288789)
       Fresh serde v0.6.15
       Fresh mime v0.1.3
   Compiling notty v0.1.0 (file:///home/patrick/clones/notty)
     Running `rustc src/lib.rs --crate-name notty --crate-type lib -g --out-dir /home/patrick/clones/notty/target/debug --emit=dep-info,link -L dependency=/home/patrick/clones/notty/target/debug -L dependency=/home/patrick/clones/notty/target/debug/deps --extern notty_encoding=/home/patrick/clones/notty/target/debug/deps/libnotty_encoding-0aeced2207c1f18d.rlib --extern unicode_width=/home/patrick/clones/notty/target/debug/deps/libunicode_width-97d72792528d9733.rlib --extern base64=/home/patrick/clones/notty/target/debug/deps/libbase64-2893a943f6e0db91.rlib --extern mime=/home/patrick/clones/notty/target/debug/deps/libmime-b95e634e9256396c.rlib`
src/lib.rs:16:1: 16:16 error: #[feature] may not be used on the stable release channel
src/lib.rs:16 #![feature(io)]
              ^~~~~~~~~~~~~~~
error: aborting due to previous error
Could not compile `notty`.

Caused by:
  Process didn't exit successfully: `rustc src/lib.rs --crate-name notty --crate-type lib -g --out-dir /home/patrick/clones/notty/target/debug --emit=dep-info,link -L dependency=/home/patrick/clones/notty/target/debug -L dependency=/home/patrick/clones/notty/target/debug/deps --extern notty_encoding=/home/patrick/clones/notty/target/debug/deps/libnotty_encoding-0aeced2207c1f18d.rlib --extern unicode_width=/home/patrick/clones/notty/target/debug/deps/libunicode_width-97d72792528d9733.rlib --extern base64=/home/patrick/clones/notty/target/debug/deps/libbase64-2893a943f6e0db91.rlib --extern mime=/home/patrick/clones/notty/target/debug/deps/libmime-b95e634e9256396c.rlib` (exit code: 101)

After downloading the nightly release instead I was able to build it with no errors. I ran ./build_test.sh and that seemed to complete successfully, although it said that zero tests ran. And it seems like getting it to run requires cargo run inside of the scaffolding directory, right? Then I can get a shell, though it seems to be < 40 columns wide --- I use XMonad so many things get sized strangely, I'm not sure if that's on my end or notty's.

It would be nice to have some documentation on dependencies + how to build and run it --- I'll stick a paragraph in the README and submit a PR with it?

withoutboats commented 8 years ago

I'm going to respond to a lot of your comments individually, but the tl;dr is that yes, improving the documentation on building would a very welcome contribution, and that this project is presently in the 'not actually usable, you will be disappointed' stage of development.

Apparently the "Rust nightly updates" PPA I got it from hasn't been updated in a year, which explains the old version. ... After downloading the nightly release instead I was able to build it with no errors.

First, its true that notty currently only builds on nightly. I should have thought about this and recommended you download the nightly version in my prior comment, sorry. But also, it has been less than a year since the PPA was updated, since version 1.4.0 was released at the end of October (Rust releases a new minor version every 6 weeks). This quick release pace has a lot of advantages, but it means that system package managers will almost always have out of date versions.

If you're interested in hacking on this or other Rust projects, I recommend installing and managing your Rust versions through multirust, a very easy tool for switching between different versions of Rust, including nightly.

I ran ./build_test.sh and that seemed to complete successfully, although it said that zero tests ran.

notty is divided into multiple crates (2 libraries and a binary), that script builds and tests each of them in turn to make sure that the public interface of a library doesn't change without its dependent changing. It says zero tests ran because there is no test coverage in the final crate to be compiled, but if you scroll through the output you'll see that some tests run for the first and largest crate. That said, test coverage is rather minimal now.

And it seems like getting it to run requires cargo run inside of the scaffolding directory, right?

This is right. I recommend running cargo run --release, to get an optimized version.

notty is actually a library for building terminal emulators, rather than a terminal emulator itself. It could be used to build a wide variety of programs, from normal graphical terminals, to programs like tmux, to Windows ssh clients. scaffolding is a GTK based implementation intended for manually testing notty. An active project is cleaning scaffolding up and fixing enough bugs that we could release something usable.

Then I can get a shell, though it seems to be < 40 columns wide --- I use XMonad so many things get sized strangely, I'm not sure if that's on my end or notty's.

I think this is notty's fault. Not sure if I'm getting exactly what you're getting, but my column and row dimensions are off right now as well. But I also think I know what's wrong and I am going to push up a fix tonight or tomorrow or so.

pscollins commented 8 years ago

notty is actually a library for building terminal emulators, rather than a terminal emulator itself

Ah, I see, I misunderstood that.

programs like tmux,

I figured something like displaying images would require special support from the terminal emulator?

I will close this issue, anyway, since my build problems have been fixed.

withoutboats commented 8 years ago

I figured something like displaying images would require special support from the terminal emulator?

Yes, the idea would be that both the emulator and the multiplexer would be notty aware.