sharkdp/fd

Compile fails

EricCrosson opened this issue · 7 comments

On ubuntu 16.04 Linux pollux 4.4.0-78-generic #99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

What I did

Attempted to install

cargo install --git https://github.com/sharkdp/fd --verbose 

What I expected to happen

That fd would be installed to my path without a fuss, much like I experienced on my Mac

What actually happened

  Compiling fd v1.1.0 (https://github.com/sharkdp/fd#54f33e52)
     Running `rustc /home/eric/.cargo/git/checkouts/fd-9d671bc4b2af369e/54f33e5227e928fece1ed917749b6b4d4d23955f/src/main.rs --crate-name fd --crate-type bin -C opt-level=3 -C metadata=0ffa62fa1d203255 --out-dir /tmp/cargo-install.qbpI7XATIUGN/release --emit=dep-info,link -L dependency=/tmp/cargo-install.qbpI7XATIUGN/release/deps --extern ansi_term=/tmp/cargo-install.qbpI7XATIUGN/release/deps/libansi_term-aa5dcc2affa8dc75.rlib --extern regex=/tmp/cargo-install.qbpI7XATIUGN/release/deps/libregex-59f42a2a673f3a9d.rlib --extern clap=/tmp/cargo-install.qbpI7XATIUGN/release/deps/libclap-bb4314a2ee3c5d44.rlib --extern ignore=/tmp/cargo-install.qbpI7XATIUGN/release/deps/libignore-2e1cde877880acb9.rlib --extern atty=/tmp/cargo-install.qbpI7XATIUGN/release/deps/libatty-acdf806defe52cbb.rlib`
error: no method named `split_off` found for type `std::string::String` in the current scope
   --> /home/eric/.cargo/git/checkouts/fd-9d671bc4b2af369e/54f33e5227e928fece1ed917749b6b4d4d23955f/src/lscolors/mod.rs:136:63
    |
136 |                         let extension = String::from(pattern).split_off(2);
    |                                                               ^^^^^^^^^

error: no method named `split_off` found for type `std::string::String` in the current scope
   --> /home/eric/.cargo/git/checkouts/fd-9d671bc4b2af369e/54f33e5227e928fece1ed917749b6b4d4d23955f/src/lscolors/mod.rs:140:62
    |
140 |                         let filename = String::from(pattern).split_off(1);
    |                                                              ^^^^^^^^^

error: aborting due to 2 previous errors

error: failed to compile `fd v1.1.0 (https://github.com/sharkdp/fd#54f33e52)`, intermediate artifacts can be found at `/tmp/cargo-install.qbpI7XATIUGN`

Caused by:
  Could not compile `fd`.

Caused by:
  process didn't exit successfully: `rustc /home/eric/.cargo/git/checkouts/fd-9d671bc4b2af369e/54f33e5227e928fece1ed917749b6b4d4d23955f/src/main.rs --crate-name fd --crate-type bin -C opt-level=3 -C metadata=0ffa62fa1d203255 --out-dir /tmp/cargo-install.qbpI7XATIUGN/release --emit=dep-info,link -L dependency=/tmp/cargo-install.qbpI7XATIUGN/release/deps --extern ansi_term=/tmp/cargo-install.qbpI7XATIUGN/release/deps/libansi_term-aa5dcc2affa8dc75.rlib --extern regex=/tmp/cargo-install.qbpI7XATIUGN/release/deps/libregex-59f42a2a673f3a9d.rlib --extern clap=/tmp/cargo-install.qbpI7XATIUGN/release/deps/libclap-bb4314a2ee3c5d44.rlib --extern ignore=/tmp/cargo-install.qbpI7XATIUGN/release/deps/libignore-2e1cde877880acb9.rlib --extern atty=/tmp/cargo-install.qbpI7XATIUGN/release/deps/libatty-acdf806defe52cbb.rlib` (exit code: 101)

I am still getting my bearings with rust but I will do my best to help -- this tool is a pleasure to use. Thanks for your work on this project thus far! 👍

Your rustc is probably too old. What version are you using? The compile error you're getting indicates that it can't find the String::split_off method, which was added in Rust 1.16.

@sharkdp One thing I typically do is put an explicit Rust version in my .travis.yml so that I always know for sure what the minimum Rust version my tool compiles with.

Awesome :) I'll see if I can compile after I update. Thanks for the pointers

I currently see

rustc --version                                                                                                                                                                          
rustc 1.14.0 (e8a012324 2016-12-16)

Updating info: latest update on 2017-06-08, rust version 1.18.0 (03fc9d622 2017-06-06)

Yessir, updating past Rust 1.16 fixed my problem. Do you know of a better way to update rust than running the uninstall script and then the rustup.sh installer again?

I am amused that travis is still building with the minimum version pegged at 1.12

@EricCrosson The link I gave was to my own separate project, not this one. :-) This one just tests on current stable/beta/nightly.

Do you know of a better way to update rust than running the uninstall script and then the rustup.sh installer again?

The preferred method of managing Rust installations for Rust programmers is rustup. rustup itself is a tool that will let you install multiple Rust installations and switch between them easily. (For instances, I have every Rust version from 1.0 on upwards installed locally.)

@sharkdp One thing I typically do is put an explicit Rust version in my .travis.yml so that I always know for sure what the minimum Rust version my tool compiles with.

Thank you very much for the suggestion! It's implemented now. Also, there was already a comment in the README that refers to the rust 1.16 requirement.

Do you think it would be worth to backport to 1.12 (or similar)? My (unfounded) impression is, that most people use rustup instead of old versions that come with some distribution package manager (?).

@sharkdp Nah I think 1.16 is fine. I'll probably bump ripgrep's minimum Rust version in the next release to something similar. I just like to make sure that the bump happens purposefully and with an appropriate version bump.