Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Ubuntu Documentation? Install doesn't work with cargo either #618

Closed
niftylettuce opened this issue Sep 30, 2017 · 11 comments
Closed

No Ubuntu Documentation? Install doesn't work with cargo either #618

niftylettuce opened this issue Sep 30, 2017 · 11 comments

Comments

@niftylettuce
Copy link

It seems quite odd that you'd have OS X, Windows, but not Ubuntu instructions for installation?

This leaves end user digging through GitHub issues to find nearly no docs other than a recommended cargo install. I don't think anyone wants to compile from source either.

Am I wrong or is there no clear way to install on Ubuntu?

Also, you make a note about using curl https://sh.rustup.rs -sSf | sh via #10 (comment), but that doesn't work either if the user already has rust installed on the OS. Also attempting to uninstall Rust is a nightmare, see https://www.reddit.com/r/rust/comments/5yk0hc/does_cleanly_uninstalling_rust_on_linux_have_to/.

This thread in general is so polluted with comments and confusion as well #10.

Also, if we tell users to use cargo to install it, perhaps that should be in the README in a clearly defined "Ubuntu Install "section?. There's a comment here to do that, but it's from January... #313 (comment)

Related: #355

Full output of cargo error I received:

I'm installing on Ubuntu 14.04.5 LTS (on a stock Digital Ocean droplet). I had a bug trying to use cargo to install ripgrep.

sudo cargo install ripgrep
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling utf8-ranges v1.0.0
   Compiling ansi_term v0.9.0
   Compiling bytecount v0.1.7
   Compiling lazy_static v0.2.9
   Compiling crossbeam v0.2.10
   Compiling vec_map v0.8.0
   Compiling void v1.0.2
   Compiling unicode-width v0.1.4
   Compiling regex-syntax v0.4.1
   Compiling libc v0.2.31
   Compiling same-file v0.1.3
   Compiling walkdir v1.0.7
   Compiling log v0.3.8
   Compiling memchr v1.0.1
   Compiling atty v0.2.3
   Compiling env_logger v0.4.3
   Compiling strsim v0.6.0
   Compiling termcolor v0.3.3
   Compiling unreachable v1.0.0
   Compiling thread_local v0.3.4
   Compiling term_size v0.3.0
   Compiling cfg-if v0.1.2
   Compiling encoding_rs v0.6.11
   Compiling textwrap v0.8.0
   Compiling num_cpus v1.7.0

   Compiling bitflags v0.9.1
   Compiling clap v2.26.2
   Compiling memmap v0.5.2
   Compiling fnv v1.0.5
   Compiling aho-corasick v0.6.3
   Compiling regex v0.2.2
   Compiling grep v0.1.6
   Compiling globset v0.2.0
   Compiling ignore v0.2.2
   Compiling ripgrep v0.6.0
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/cargo-install.g4egpqZk0Ufd/release/build/ripgrep-bc6ad105e676df2b/build_script_build-bc6ad105e676df2b.0.o" "-o" "/tmp/cargo-install.g4egpqZk0Ufd/release/build/ripgrep-bc6ad105e676df2b/build_script_build-bc6ad105e676df2b" "-Wl,--gc-sections" "-pie" "-Wl,-O1" "-nodefaultlibs" "-L" "/tmp/cargo-install.g4egpqZk0Ufd/release/deps" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/tmp/cargo-install.g4egpqZk0Ufd/release/deps/libclap-a5de31793dbfafe8.rlib" "/tmp/cargo-install.g4egpqZk0Ufd/release/deps/libatty-b6841561eaa9990b.rlib" "/tmp/cargo-install.g4egpqZk0Ufd/release/deps/libstrsim-9194d0a0d94f76d9.rlib" "/tmp/cargo-install.g4egpqZk0Ufd/release/deps/libbitflags-e3c5d2be25b5a586.rlib" "/tmp/cargo-install.g4egpqZk0Ufd/release/deps/liblazy_static-8823bb1423f1ad41.rlib" "/tmp/cargo-install.g4egpqZk0Ufd/release/deps/libansi_term-3ad49c05b79382a2.rlib" "/tmp/cargo-install.g4egpqZk0Ufd/release/deps/libvec_map-220b10ad4267d2a8.rlib" "/tmp/cargo-install.g4egpqZk0Ufd/release/deps/libtextwrap-20686c873a7ca803.rlib" "/tmp/cargo-install.g4egpqZk0Ufd/release/deps/libterm_size-72593745bbe4ef3e.rlib" "/tmp/cargo-install.g4egpqZk0Ufd/release/deps/liblibc-69a7df4df6b083eb.rlib" "/tmp/cargo-install.g4egpqZk0Ufd/release/deps/libunicode_width-ac36c60662f8c788.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_unicode-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-570da8f8.rlib" "-l" "util" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util"
  = note: /usr/bin/ld: /usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-570da8f8.rlib(jemalloc.pic.o): unrecognized relocation (0x2a) in section `.text.unlikely.malloc_conf_init'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status


error: aborting due to previous error

error: failed to compile `ripgrep v0.6.0`, intermediate artifacts can be found at `/tmp/cargo-install.g4egpqZk0Ufd`
@niftylettuce
Copy link
Author

Also I figured out how to get rust reinstalled...

sudo apt-get -y remove rustc
sudo apt-y autoremove
sudo -i
curl https://sh.rustup.rs -sSf | s

Then sudo apt-get install cargo && sudo cargo install ripgrep again.

Reference: https://www.howtodojo.com/2017/09/install-rust-ubuntu-16-04/

Although this still yields an error:

sudo cargo install ripgrep
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling regex-syntax v0.4.1
   Compiling fnv v1.0.5
   Compiling cfg-if v0.1.2
   Compiling strsim v0.6.0
   Compiling encoding_rs v0.6.11
   Compiling crossbeam v0.2.10
   Compiling ansi_term v0.9.0
   Compiling bitflags v0.9.1
   Compiling lazy_static v0.2.9
   Compiling termcolor v0.3.3
   Compiling vec_map v0.8.0
   Compiling bytecount v0.1.7
   Compiling libc v0.2.31
   Compiling utf8-ranges v1.0.0
   Compiling same-file v0.1.3
   Compiling walkdir v1.0.7
   Compiling term_size v0.3.0
   Compiling atty v0.2.3
   Compiling memmap v0.5.2
   Compiling memchr v1.0.1
   Compiling aho-corasick v0.6.3
   Compiling void v1.0.2
   Compiling unreachable v1.0.0
   Compiling thread_local v0.3.4
   Compiling num_cpus v1.7.0
   Compiling log v0.3.8
   Compiling env_logger v0.4.3
   Compiling unicode-width v0.1.4
   Compiling textwrap v0.8.0
   Compiling clap v2.26.2
   Compiling regex v0.2.2
   Compiling grep v0.1.6
   Compiling globset v0.2.0
   Compiling ignore v0.2.2

   Compiling ripgrep v0.6.0
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/cargo-install.gsxfisZF01P9/release/build/ripgrep-bc6ad105e676df2b/build_script_build-bc6ad105e676df2b.0.o" "-o" "/tmp/cargo-install.gsxfisZF01P9/release/build/ripgrep-bc6ad105e676df2b/build_script_build-bc6ad105e676df2b" "-Wl,--gc-sections" "-pie" "-Wl,-O1" "-nodefaultlibs" "-L" "/tmp/cargo-install.gsxfisZF01P9/release/deps" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/tmp/cargo-install.gsxfisZF01P9/release/deps/libclap-a5de31793dbfafe8.rlib" "/tmp/cargo-install.gsxfisZF01P9/release/deps/libatty-b6841561eaa9990b.rlib" "/tmp/cargo-install.gsxfisZF01P9/release/deps/libstrsim-9194d0a0d94f76d9.rlib" "/tmp/cargo-install.gsxfisZF01P9/release/deps/libbitflags-e3c5d2be25b5a586.rlib" "/tmp/cargo-install.gsxfisZF01P9/release/deps/liblazy_static-8823bb1423f1ad41.rlib" "/tmp/cargo-install.gsxfisZF01P9/release/deps/libansi_term-3ad49c05b79382a2.rlib" "/tmp/cargo-install.gsxfisZF01P9/release/deps/libvec_map-220b10ad4267d2a8.rlib" "/tmp/cargo-install.gsxfisZF01P9/release/deps/libtextwrap-20686c873a7ca803.rlib" "/tmp/cargo-install.gsxfisZF01P9/release/deps/libterm_size-72593745bbe4ef3e.rlib" "/tmp/cargo-install.gsxfisZF01P9/release/deps/liblibc-69a7df4df6b083eb.rlib" "/tmp/cargo-install.gsxfisZF01P9/release/deps/libunicode_width-ac36c60662f8c788.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_unicode-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-570da8f8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-570da8f8.rlib" "-l" "util" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util"
  = note: /usr/bin/ld: /usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-570da8f8.rlib(jemalloc.pic.o): unrecognized relocation (0x2a) in section `.text.unlikely.malloc_conf_init'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status


error: aborting due to previous error

error: failed to compile `ripgrep v0.6.0`, intermediate artifacts can be found at `/tmp/cargo-install.gsxfisZF01P9`

Caused by:
  Could not compile `ripgrep`.

@BurntSushi
Copy link
Owner

BurntSushi commented Sep 30, 2017 via email

@niftylettuce
Copy link
Author

I used ack instead. This was way too complicated to try to install. Just debugging alone took over an hour.

@BurntSushi
Copy link
Owner

The README explains how to get precompiled binaries. Otherwise there's not much else to be done with this issue. Thanks for the report.

@niftylettuce
Copy link
Author

niftylettuce commented Oct 1, 2017 via email

@BurntSushi
Copy link
Owner

I already explained why there aren't Ubuntu docs. I also pointed out at least twice that there are docs pointing to precompiled binaries, which should work on any Linux distro. Adding ripgrep to more package repos (including Ubuntu) is tracked by #10, which is exactly when I'll add Ubuntu docs. Until then, there's nothing Ubuntu specific about installing ripgrep.

@niftylettuce
Copy link
Author

niftylettuce commented Oct 1, 2017

You should at least make a mention of Ubuntu in the Readme. CMD+F "Ubuntu" is one of the first things power-users do.

@dieggsy
Copy link

dieggsy commented Oct 1, 2017

FWIW, Ubuntu 17.04 here, cargo install ripgrep works just fine for me. I think rust was just installed with the curl command on the rust-lang website. (I use nix to install these days though, but thought I'd check).

@haakenlid
Copy link

haakenlid commented Oct 21, 2017

It's pretty straightforward to install in Ubuntu. Here's a simple bash script for downloading the binary with wget and installing the man pages and bash completions.

#!/bin/bash
[[ $UID == 0 ]] || { echo "run as sudo to install"; exit 1; }
REPO="https://github.com/BurntSushi/ripgrep/releases/download/"
RELEASE="0.6.0/ripgrep-0.6.0-x86_64-unknown-linux-musl.tar.gz"

TMPDIR=$(mktemp -d)
cd $TMPDIR
wget -O - ${REPO}${RELEASE} | tar zxf - --strip-component=1
mv rg /usr/local/bin/
mv rg.1 /usr/local/share/man/man1/
mv complete/rg.bash-completion /usr/share/bash-completion/completions/rg
mandb

Edit: I've updated this script, with the current directory structure of the unzipped download and getting the latest release number from the github api, as suggested by grolongo in the next message. I use sed instead of jq to extract the tag value from the json response, since sed is installed in every linux/unix distro.

#!/bin/bash
[[ $UID == 0 ]] || { echo "run as sudo to install"; exit 1; }
REPO="BurntSushi/ripgrep"
LATEST=$(curl -sSL "https://api.github.com/repos/${REPO}/releases/latest"\
  | sed -n '/tag_name/s/[^0-9.]//gp')
FILE="${LATEST}/ripgrep-${LATEST}-x86_64-unknown-linux-musl.tar.gz"
DOWNLOAD="https://github.com/${REPO}/releases/download/${FILE}"
TMPDIR=$(mktemp -d)

cd $TMPDIR
wget --show-progress -q -O - ${DOWNLOAD} | tar zxf - --strip-component=1
cp rg /usr/local/bin/
cp doc/rg.1 /usr/local/share/man/man1/
cp complete/rg.bash /usr/share/bash-completion/completions/rg
mandb -q

@grolongo
Copy link

grolongo commented Dec 8, 2017

@haakenlid you could even make it better by grabbing the latest version number like this:

RG_LATEST=$(curl -sSL "https://api.github.com/repos/BurntSushi/ripgrep/releases/latest" | jq --raw-output .tag_name)
RELEASE="${RG_LATEST}/ripgrep-${RG_LATEST}-x86_64-unknown-linux-musl.tar.gz"

This way you don't have to manually edit your script each time a new release is out.

@niftylettuce
Copy link
Author

niftylettuce commented Jan 22, 2018

I've updated @haakenlid answer in combination with yours @grolongo. For any users wishing to install ripgrep (latest version) on Ubuntu (and can't use snap yet) you can do so by:

  1. Install the jq package via sudo apt-get install -y jq
  2. Run this command to install the latest version of ripgrep:
curl -o- https://gist.githubusercontent.com/niftylettuce/a9f0a293289eb7274516bf2cb0455796/raw/8491560fd53c98ee85a2f9916000167190113b52/install-ripgrep-on-ubuntu.sh | sudo bash

Install script is located at: https://gist.github.com/niftylettuce/a9f0a293289eb7274516bf2cb0455796

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants