-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
bat is not working on the Raspberry Pi Zero #952
Comments
I'm not an expert on the difference between various ARM architectures, but it seems that the Pi Zero with its ARMv6 architecture is not compatible with the aarch64 is certainly not compatible as the RPi Zero has a 32bit architecture. Cross compiling for ARMv6 seems nontrivial. This project provides Docker images, if you want to do this locally. And you could always try to compile it on the Pi via |
Yes, it is non-trivial 😄 Even with the cross-compilation Docker images, it doesn't work out of the box due to #650. We can create a custom docker which includes FROM rustembedded/cross:armv5te-unknown-linux-musleabi
RUN apt-get update && \
apt-get install -y clang libclang-dev libc6-dev-i386 Next, build the Docker image:
and create a [target.armv5te-unknown-linux-musleabi]
image = "arm-cc:v1" and then build with
Unfortunately, this currently fails with some illegal instruction errors during the compilation of = note: /target/armv5te-unknown-linux-musleabi/debug/deps/liblibgit2_sys-51cb7b6fa168cf79.rlib(odb.o): In function `git_atomic_inc':
/cargo/registry/src/github.jparrowsec.cn-1ecc6299db9ec823/libgit2-sys-0.12.4+1.0.0/libgit2/src/thread-utils.h:71: undefined reference to `__sync_add_and_fetch_4'
/target/armv5te-unknown-linux-musleabi/debug/deps/liblibgit2_sys-51cb7b6fa168cf79.rlib(odb.o): In function `git_atomic_dec': I managed to strip out the diff --git a/Cargo.toml b/Cargo.toml
index d449df6..0e5b442 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,7 @@ application = [
"atty",
"clap",
"dirs",
- "git",
+ # "git",
"lazy_static",
"liquid",
"paging",
diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs
index d5751f7..b0a4fad 100644
--- a/src/bin/bat/app.rs
+++ b/src/bin/bat/app.rs
@@ -198,14 +198,7 @@ impl App {
}
})
.unwrap_or_else(|| String::from(HighlightingAssets::default_theme())),
- visible_lines: if self.matches.is_present("diff") {
- VisibleLines::DiffContext(
- self.matches
- .value_of("diff-context")
- .and_then(|t| t.parse().ok())
- .unwrap_or(2),
- )
- } else {
+ visible_lines:
VisibleLines::Ranges(
self.matches
.values_of("line-range")
@@ -214,7 +207,7 @@ impl App {
.map(LineRanges::from)
.unwrap_or_default(),
)
- },
+ ,
style_components,
syntax_mapping,
pager: self.matches.value_of("pager"), ... and build a version without Git support for ARMv5, which I have attached: bat-armv5.zip |
With |
Tanks a lot for the stripped down version of bat. Just tried it and it works! This seems to be an issue with the toolchain itself, I've encountered other projects in which compiling towards the Zero target was also an issue. Hopefully it'll get solved by the Rust team in the future. I'll keep using your custom binary in the meantime. Thanks again for the efforts and support, that's really helpful. 👍👍👍 |
Glad it works. Thank you for the feedback 😄 |
There are some new developments on this issue:
|
With #650 now closed and #997 merged, we can now easily cross-compile cross build \
--target armv5te-unknown-linux-musleabi \
--release \
--no-default-features \
--features=atty,clap,dirs,lazy_static,liquid,paging,wild,regex-onig Note that we use the feature flags to disable |
Hi,
First thank you for your tool, it's been serving me very well since 2018.
I have been using on x86_64 for years now and got used to it. I saw you distribute ARM binaries and decided to give it a go.
Trying both packages
It every time gives me the following error when trying to launch bat binary:
Illegal instruction
A quick 'file' on the binary shows nothing unusual for the Pi Zero:
bat: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=5545ace89bb1ef2c3b0e80caf53964cdb762ca36, stripped
Would you know what is wrong with the release? Are you assuming a specific instruction set (or extension) when cross-compiling?
Thanks.
The text was updated successfully, but these errors were encountered: