bat: cargo install failing due to a compilation problem of onig_sys crate

cargo install bat failing on Ubuntu 18.04 due to https://github.com/rust-onig/rust-onig/issues/109 (bat version 0.12.1)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

apt-get install libclang-dev made it build for me on Debian 10.1 aarch64

i’m reaally surprised, that a cli tool to view files has a hard dependency on libclang, though

This can be resolved once https://github.com/rust-onig/rust-onig/pull/126 is merged. This would also remove the need for libclang to be installed at build time.

Another option would be that https://github.com/trishume/syntect/pull/270 gets merged, in which case onig would not be a dependency anymore.

This can be resolved once rust-onig/rust-onig#126 is merged. This would also remove the need for libclang to be installed at build time.

The PR has been merged today. A new version of onig has been released. We are now waiting for this to be included in syntect: https://github.com/trishume/syntect/pull/293 (thanks to @Keats).

Another option would be that trishume/syntect#270 gets merged, in which case onig would not be a dependency anymore.

This has been merged a while ago and we have made it possible to use it within bat, but using fancy-regex is currently not (yet) an option, as it can not handle all regex features in the custom syntaxes included in bat, see https://github.com/trishume/syntect/issues/287

Ah dang. I’ll try and do a point release with the Send fix this evening.

I think the crash is due to something I forgot to put in the release notes and maybe should have better monitoring for in general but you need to re-generate your pack files for the new version. The format is the same so nothing immediately fails but the regexes get rewritten to be compatible with fancy-regex before being saved in the pack file, to reduce loading time.

And yah seems plausible that sometimes fancy-regex will be much faster. regex is a really good regex engine, just in the Javascript and Rust benchmarks I use it’s slower.

The fancy-regex mode was just merged and released as v4.0.0! You may want to try using it to fix this issue, although it does halve performance so you may only want to use it on platforms where it’s needed.

Still hoping that onig’s build will eventually improve but for now fancy-regex is a good option.

i’m reaally surprised, that a cli tool to view files has a hard dependency on libclang, though

That’s a build-time-only dependency which (although maybe not optimal) is certainly not too surprising. bat has some C-code dependencies and libclang can be used to automatically generate C-to-Rust bindings.

If you want, you can actually get zero-dependency versions of bat (statically linked musl builds on the Release page), so I don’t think there is any reason to complain about runtime dependencies.