When I try to install Rhtslib on my Macbook running Mac OS 10.13.4 High Sierra, I get the following compilation error:
/bin/sh ./libtool --tag=CC --mode=link clang -g -O2 -fPIC -no-undefined -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o libhts.la -rpath /usr/
local/lib/R/3.4/site-library/Rhtslib/lib libhts_la-kfunc.lo libhts_la-knetfile.lo libhts_la-kstring.lo libhts_la-bgzf.lo libhts_la-faidx.lo libhts_la-hfile.lo libhts_la-hfile_net.
lo libhts_la-hts.lo libhts_la-regidx.lo libhts_la-sam.lo libhts_la-synced_bcf_reader.lo libhts_la-vcf_sweep.lo libhts_la-tbx.lo libhts_la-vcf.lo libhts_la-vcfutils.lo cram/libhts_
la-cram_codecs.lo cram/libhts_la-cram_decode.lo cram/libhts_la-cram_encode.lo cram/libhts_la-cram_index.lo cram/libhts_la-cram_io.lo cram/libhts_la-cram_samtools.lo cram/libhts_la
-cram_stats.lo cram/libhts_la-files.lo cram/libhts_la-mFILE.lo cram/libhts_la-md5.lo cram/libhts_la-open_trace_file.lo cram/libhts_la-pooled_alloc.lo cram/libhts_la-rANS_static.lo
cram/libhts_la-sam_header.lo cram/libhts_la-string_alloc.lo cram/libhts_la-thread_pool.lo cram/libhts_la-vlen.lo cram/libhts_la-zfio.lo lib/libgnu.la -lm
libtool: link: clang -dynamiclib -o .libs/libhts.0.dylib .libs/libhts_la-kfunc.o .libs/libhts_la-knetfile.o .libs/libhts_la-kstring.o .libs/libhts_la-bgzf.o .libs/libhts_la-faid
x.o .libs/libhts_la-hfile.o .libs/libhts_la-hfile_net.o .libs/libhts_la-hts.o .libs/libhts_la-regidx.o .libs/libhts_la-sam.o .libs/libhts_la-synced_bcf_reader.o .libs/libhts_la-vc
f_sweep.o .libs/libhts_la-tbx.o .libs/libhts_la-vcf.o .libs/libhts_la-vcfutils.o cram/.libs/libhts_la-cram_codecs.o cram/.libs/libhts_la-cram_decode.o cram/.libs/libhts_la-cram_en
code.o cram/.libs/libhts_la-cram_index.o cram/.libs/libhts_la-cram_io.o cram/.libs/libhts_la-cram_samtools.o cram/.libs/libhts_la-cram_stats.o cram/.libs/libhts_la-files.o cram/.l
ibs/libhts_la-mFILE.o cram/.libs/libhts_la-md5.o cram/.libs/libhts_la-open_trace_file.o cram/.libs/libhts_la-pooled_alloc.o cram/.libs/libhts_la-rANS_static.o cram/.libs/libhts_la
-sam_header.o cram/.libs/libhts_la-string_alloc.o cram/.libs/libhts_la-thread_pool.o cram/.libs/libhts_la-vlen.o cram/.libs/libhts_la-zfio.o -Wl,-force_load,lib/.libs/libgnu.a
-L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -lm -O2 -install_name /usr/local/lib/R/3.4/site-library/Rhtslib/lib/libhts.0.dylib -compatibility_v
ersion 1 -current_version 1.0 -Wl,-single_module
Undefined symbols for architecture x86_64:
"_compressBound", referenced from:
_bgzf_open in libhts_la-bgzf.o
_bgzf_dopen in libhts_la-bgzf.o
_bgzf_hopen in libhts_la-bgzf.o
"_crc32", referenced from:
_bgzf_compress in libhts_la-bgzf.o
_cram_read_block in libhts_la-cram_io.o
_cram_write_block in libhts_la-cram_io.o
_cram_read_container in libhts_la-cram_io.o
_cram_write_container in libhts_la-cram_io.o
"_deflate", referenced from:
_bgzf_flush in libhts_la-bgzf.o
_bgzf_close in libhts_la-bgzf.o
_bgzf_compress in libhts_la-bgzf.o
_cram_compress_by_method in libhts_la-cram_io.o
"_deflateEnd", referenced from:
_bgzf_close in libhts_la-bgzf.o
_bgzf_compress in libhts_la-bgzf.o
_cram_compress_by_method in libhts_la-cram_io.o
"_deflateInit2_", referenced from:
_bgzf_write_init in libhts_la-bgzf.o
_bgzf_compress in libhts_la-bgzf.o
_cram_compress_by_method in libhts_la-cram_io.o
"_gzclose", referenced from:
_vcf_hdr_read in libhts_la-vcf.o
_zfclose in libhts_la-zfio.o
"_gzeof", referenced from:
_zfeof in libhts_la-zfio.o
"_gzgetc", referenced from:
_zfpeek in libhts_la-zfio.o
"_gzgets", referenced from:
_zfgets in libhts_la-zfio.o
"_gzopen", referenced from:
_vcf_hdr_read in libhts_la-vcf.o
_zfopen in libhts_la-zfio.o
"_gzputs", referenced from:
_zfputs in libhts_la-zfio.o
"_gzread", referenced from:
_vcf_hdr_read in libhts_la-vcf.o
"_gzungetc", referenced from:
_zfpeek in libhts_la-zfio.o
"_inflate", referenced from:
_bgzf_read_block in libhts_la-bgzf.o
_inflate_gzip_block in libhts_la-bgzf.o
_hts_detect_format in libhts_la-hts.o
_zlib_mem_inflate in libhts_la-cram_io.o
(maybe you meant: _zlib_mem_inflate)
"_inflateEnd", referenced from:
_bgzf_read_block in libhts_la-bgzf.o
_bgzf_close in libhts_la-bgzf.o
_hts_detect_format in libhts_la-hts.o
_zlib_mem_inflate in libhts_la-cram_io.o
"_inflateInit2_", referenced from:
_bgzf_read_block in libhts_la-bgzf.o
_hts_detect_format in libhts_la-hts.o
_zlib_mem_inflate in libhts_la-cram_io.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [libhts.la] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** [htslib/libhts.la] Error 2
ERROR: compilation failed for package ‘Rhtslib’
Unfortunately, there isn't any suggestion in the error message about how to resolve the error, and I can't find anyone else who has a similar error via Google searching. So can someone suggest how I might fix this error and get Rhtslib installed?
I don't have an answer, but all those missing symbols are usually defined in zlib. I think Rhtslib depends on zlibbioc and it should download and link automatically, but maybe try making sure it's installed already.