Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

0.47.0 introduced a dependency on libclang #434

Open
DaGaMs opened this issue Jul 5, 2024 · 5 comments
Open

0.47.0 introduced a dependency on libclang #434

DaGaMs opened this issue Jul 5, 2024 · 5 comments

Comments

@DaGaMs
Copy link

DaGaMs commented Jul 5, 2024

I tried to upgrade my code's dependency on rust-htslib to version 0.47.0 (from 0.46.0) but now when I do cargo build -r on Linux (eg in a docker container) without clang, I get:

thread 'main' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.69.4/lib.rs:622:31:

Unable to find libclang: "couldn't find any valid shared libraries matching: ['[libclang.so](http://libclang.so/)', 'libclang-*.so', '[libclang.so](http://libclang.so/).*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"

Reverting back to 0.46.0 fixes the issue. I'm not sure what happened here, but I suspect it was not intentional?

@moold
Copy link

moold commented Jul 9, 2024

I also got a cargo build --release problem when I used rust-htslib v0.47.0, reverting to v0.46.0 solved the problem.

  --- stderr
  ./htslib/htslib/hts.h:31:10: fatal error: 'stddef.h' file not found
  thread 'main' panicked at hts-sys-2.1.4/build.rs:275:14:
  Unable to generate bindings.: ClangDiagnostic("./htslib/htslib/hts.h:31:10: fatal error: 'stddef.h' file not found\n")
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@fxwiegand
Copy link
Contributor

fxwiegand commented Jul 9, 2024

I think i also ran into this a while ago. @FelixMoelder i think this might be caused by this recent change:

hts-sys = {version = "2.1.4", default-features = false, features = ["bindgen"]}

@DaGaMs
Copy link
Author

DaGaMs commented Jul 9, 2024

So, this is probably related to this feature request in bindgen:

rust-lang/rust-bindgen#918

What I don't understand is: why does 0.46.0 work but 0.47.0 doesn't? If dependency on libclang.a is a general issue of bindgen, then why does 0.46.0 build fine for me? And vice versa, why does adding one header to hts-sys suddenly break things? 🤔

@DaGaMs
Copy link
Author

DaGaMs commented Nov 23, 2024

Has anyone tested this with 0.48.0? I'm a bit concerned that this issue is preventing us from updating past 0.46.0. We need to deploy to various linux's and docker images, introducing a dependency on libclang will cause a lot of pain...

@ArtRand
Copy link

ArtRand commented Jan 8, 2025

Any update here? I have a similar concern as @DaGaMs..
tl;dr

BINDGEN_EXTRA_CLANG_ARGS="-I clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-16.04/lib/clang/11.1.0/include"

Not sure if this is a common problem. But compiling rust-htslib version > 0.46 was failing with this error for me. Often, I don't have permissions to install system packages so I keep a version of clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-16.04 around in my home directory, normally setting LIBCLANG_PATH=$(HOME}/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-16.04/lib takes care of most dependencies. Adding this extra envvar fixed my rusthtslib builds.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants