oniguruma build error when compiling with cargo
Closed this issue ยท 4 comments
What steps will reproduce the bug?
git clone https://github.com/sharkdp/bat.git && cd bat/ && cargo build --release
What happens?
the oniguruma library throws compilation errors when building from source. I am experiencing the same error both when compiling the bat crate, as well as when compiling another package which uses bat as a dependency (in this last case I have also tried to install bat with cargo add bat --features regex-fancy an I got the same result). The full output is over 900 lines long. The last two lines are:
error occurred in cc-rs: Command LC_ALL="C" "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "/home/lc/Desktop/bat/target/release/build/onig_sys-88547b4fcc048f15/out" "-I" "oniguruma/src" "-DHAVE_UNISTD_H=1" "-DHAVE_SYS_TYPES_H=1" "-DHAVE_SYS_TIME_H=1" "-o" "/home/lc/Desktop/bat/target/release/build/onig_sys-88547b4fcc048f15/out/a445302c6d3dcb51-regparse.o" "-c" "oniguruma/src/regparse.c" with args cc did not execute successfully (status code exit status: 1).
warning: build failed, waiting for other jobs to finish...
What did you expect to happen instead?
I expected the package to compile with no errors.
How did you install bat?
I have bat installed and working correctly with my distro's package manager. The problem only arises when compiling from source.
bat version and environment
bat 0.25.0 (v0.25.0-modified); OS: Arch Linux; Rust 1.86.0
I ran into this issue on Arch on WSL (haven't tested on my Arch laptop yet). A workaround that worked for me was to use the system oniguruma:
RUSTONIG_SYSTEM_LIBONIG=1 cargo install bat
Hopefully there's a solution that doesn't require this but for now that's what I'm rolling with
Same issue for all crates depend on oniguruma
The issue persists with all crates that depend on oniguruma
seems related to this issue in rust-onig