rust-libxml icon indicating copy to clipboard operation
rust-libxml copied to clipboard

Build issue on some platforms (Alpine, Arch Linux etc..)

Open jcamiel opened this issue 8 months ago • 4 comments

Hello all,

I'm starting to have build issue on some platform. I don't know if it started with 0.3.4 or 0.3.5 but it was OK with 0.3.3.

For instance, on Alpine:

$ cargo build
  --- stderr
  thread 'main' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.71.1/lib.rs:604:27:
  Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Repro steps:

  1. Launch Alpine image $ docker run -it alpine:latest
  2. Install Rust $ app add rust cargo
  3. Install libxml libs $ apk add libxml2-dev
  4. Create a sample
    $ cargo init foo && cd foo
    $ cargo add libxml
    $ cargo build
    

With 0.3.3 these steps were OK.

I'm using libxml crate for Hurl, so far I've identified these platforms as KO https://github.com/Orange-OpenSource/hurl/pull/4021/checks

Thanks for this crate BTW

Jc

jcamiel avatar May 09 '25 08:05 jcamiel

On Alpine, I've resolved it by adding clang-dev dependencies apk add clang-dev(I supposed needed now by rust-bindgen)

jcamiel avatar May 09 '25 09:05 jcamiel

Right, this was somewhat deliberately introduced as a build dependency in #143, as we now run bindgen during build to match the installed libxml2 for the platform.

Maybe we could document it better and/or add a CI target for Arch Linux?

dginev avatar May 09 '25 09:05 dginev

Update with some platform:

  • Alpine $ apk add clang-dev
  • Ubuntu / Debian $ apt install libclang-dev
  • Arch Linux $ pacman -S clang

I will add Fedora

jcamiel avatar May 09 '25 10:05 jcamiel

@dginev I've made a PR with these instructions on the README, fell free to close this issue if you want! => #169

jcamiel avatar May 09 '25 11:05 jcamiel

Thanks!

dginev avatar May 09 '25 17:05 dginev