-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Request: Binaries for ARM / Raspberry Pi #676
Comments
I'm actually pretty interested in a "Rust -> LLVM -> anything else" build process, so in the next week or so I might investigate getting that to work with ripgrep. Can't promise anything though! |
I will say two things:
|
Thanks for considering! I would think this should just add an additional target to however Rust does its builds, as long as you're on Linux (which seems to have better options for ARM cross compiling than MacOS). I don't know if there is a (free) CI that has ARM support, if so that might be helpful. |
Was excited to test these out after seeing the 0.8.0 release notes and remembering your limited ability to test per this conversation. The release at https://github.com/BurntSushi/ripgrep/releases/download/0.8.0/ripgrep-0.8.0-arm-unknown-linux-gnueabihf.tar.gz seems to work great on my RPi 3 -- thank you! Unfortunately I get $ ./rg --version
Illegal instruction on my Pi Zero, which is armv6. Are you sure the release labeled When I cross-compile on my Pi3, |
@n8henrie TL;DR - I have no idea. :-) An illegal instruction usually pops up when someone tries to run a binary that was compiled for more advanced CPU features than their system has. But the ARM build does not add any additional CPU features since it isn't considered an SSSE3 target (which makes sense, since SSSE3 is an x86 thing). Basically, someone else will need to debug this. I did actually try running the CI build on my machine, but installing the requisite cross compiler required me to build from source on Archlinux, and I don't feel like doing that. But basically, the compilers being used are in the Lines 40 to 43 in 81afe8c
$TARGET used is here: Line 36 in 81afe8c
arm-unknown-linux-gnueabihf , which seems to be what you want.
So... I don't know. :-/ |
Also running Arch as my primary Linux box -- took a little figuring out, but seems to be sufficient to install
With Wonder if it may be related to this SO answer saying that the |
I got an AWS Ubuntu instance to see if I could reproduce this issue. Interestingly, I also have to manually install sudo apt -y install gcc gcc-arm-linux-gnueabihf After that, I can compile |
@n8henrie Bummer. Thanks for looking into this though! Is this a bug in the Ubuntu packages, or are there additional/different gcc compilers that should be installed? |
Looks like this confirms a problem with the Ubuntu package being armv7 specific: rust-lang/rust#38570 Everything I'm seeing recommends using https://github.com/raspberrypi/tools, which I imagine may make a RPi-specific binary. If I figured out how to do this on Travis, would you be willing to accept a PR to that effect? While it is an official repo (so I figure should be somewhat reliable), it looks like there are no releases or tags, so I imagine it would involve downloading the master branch and using that to cross-compile and releasing a version specific for RPi. |
Yes, as long as the build times are reasonable. If you have to build the compiler, then I expect the build times would become unreasonable. (And my usual caveat applies. If I'm trying to do a release and the ARM build fails, then I won't spend much time on trying to fix it. If it does fail, I'll make the release anyway, and would be happy to try a subsequent patch release if the problem with the ARM build got fixed.) |
It doesn't need to build the compiler, just cloning from the official raspberrypi/tools and set that as the linker. On my AWS Ubuntu testbox, the following script installs a binary that works on my armv6 and armv7 Raspberry Pis (like building on Arch). #! /bin/bash
set -e
BUILDDIR="${HOME}/build-rpi"
mkdir -p "${BUILDDIR}"
test -d "${BUILDDIR}/tools" || git -C "${BUILDDIR}" clone --depth=1 https://github.com/raspberrypi/tools.git
test -d "${BUILDDIR}/ripgrep" || git -C "${BUILDDIR}" clone --depth=1 --branch=0.8.1 https://github.com/BurntSushi/ripgrep.git
sudo apt update && sudo apt install -y gcc
PATH="${HOME}/.cargo/bin:${PATH}"
rustc --version || curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain="stable"
rustup target add arm-unknown-linux-gnueabihf
cat <<EOF > "${HOME}"/.cargo/config
[target.arm-unknown-linux-gnueabihf]
linker = "${HOME}/build-rpi/tools/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc"
EOF
pushd "${BUILDDIR}/ripgrep"
cargo build --release --target=arm-unknown-linux-gnueabihf
popd Assuming the ripgrep repo is already cloned and that gcc and rustup are already installed (since the Travis environment will already have those), it takes 5m34s to add the If I first run the I'd be happy to work on a PR, but I'm not sure how to change the The other ARM release could be specified as the ARMV7 target (since that what it seems to work on), and |
Ripgrep is so fast and lightweight that it really seems like it would shine on low-resources devices like the Raspberry Pi. Unfortunately, the current binaries don't include an ARM compatible release. Additionally, the process for cross-compiling with Rust from OSX to ARM seems more complicated than I anticipated (at least compared to Go), and installing Rust on the Pi seems like a little more work than I'd hope for just to be able to install ripgrep.
If there's any way the
armv7-unknown-linux-gnueabihf
target could be added as one of the binaries you provide for easy download, I bet it would see a decent amount of use from fellow Raspberry Pi users. As someone unfamiliar with Rust, trying to figure out rustup and cross compiling is currently taking up a lot of my day, and a simplewget
andtar xzf
certainly sounds appealing.The text was updated successfully, but these errors were encountered: