rust-bio / rust-htslib

This library provides HTSlib bindings and a high level Rust API for reading and writing BAM files.
MIT License
308 stars 80 forks source link

Unable to find libclang #112

Closed wwood closed 5 years ago

wwood commented 6 years ago

Hi, Using more recent versions of rust-htslib I run into errors like this on my system while trying to build:

ar -rc libhts.a kfunc.o knetfile.o kstring.o bcf_sr_sort.o bgzf.o errmod.o faidx.o hfile.o hfile_net.o hts.o hts_os.o md5.o multipart.o probaln.o realn.o regidx.o sam.o synced_bcf_reader.o vcf_sweep.o tbx.o textutils.o thread_pool.o vcf.o vcfutils.o cram/cram_codecs.o cram/cram_decode.o cram/cram_encode.o cram/cram_external.o cram/cram_index.o cram/cram_io.o cram/cram_samtools.o cram/cram_stats.o cram/files.o cram/mFILE.o cram/open_trace_file.o cram/pooled_alloc.o cram/rANS_static.o cram/sam_header.o cram/string_alloc.o
ranlib libhts.a

--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any of [\'libclang.so\', \'libclang.so.*\', \'libclang-*.so\'], set the LIBCLANG_PATH environment variable to a path where one of these files can be found (skipped: [])"', libcore/result.rs:945:5

I can fix this by, as the instructions suggest, setting LIBCLANG_PATH e.g. like this

LIBCLANG_PATH=~/.guix-profile/lib cargo build

However, I'm not sure this should be necessary, because ~/.guix-profile/lib is in my LIBRARY_PATH:

$ echo $LIBRARY_PATH
/home/ben/.guix-profile/lib

Is it possible to get the build.rs to honour that? I say "more recent" because my (admittedly poor) memory tells me it used to work a year or two ago. Clearly, not that important an issue if it has taken me this long to raise an issue...

Thanks. ben

johanneskoester commented 6 years ago

Can you check if this worked before PR #111?

wwood commented 6 years ago

That pull request is only 2 weeks old, and I've been having trouble since at least 0.19.0. But for completion's sake I tried from current master and the commit before 9cf1c5274f5f349aa52c5e04e01e0ed09c9f339b. The same main error popped up, though the lead up was different in HEAD.

I'm also having problems building the musl target, but I'll mess around a bit more before reporting something.

johanneskoester commented 6 years ago

I think this should be reporting with upstream cargo, as libclang is rather a cargo dependency, isn't it?

johanneskoester commented 6 years ago

Or am I missing something?

wwood commented 6 years ago

I'm not sure, but I'm observing the same thing with bindgen, so this doesn't seem like a rust-htslib thing. I'm assuming this might have something to do with clang-sys, but updating the dependency tree didn't end in any joy. Maybe it isn't just fixed at the bottom.