Bioconductor / Rhtslib

HTSlib high-throughput sequencing library as an R package
https://bioconductor.org/packages/Rhtslib
11 stars 12 forks source link

Unable to install Rhtslib under Microsoft Open R 4.0.2 #21

Closed dfermin closed 3 years ago

dfermin commented 3 years ago

Hello.

I've got a fresh install of Microsoft Open-R 4.0.2 I've installed the Bioconductor BiocManager package.

When I try to install Rhtslib I get the following error:

Error: package or namespace load failed for ‘Rhtslib’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/libs/Rhtslib.so':
  /opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/libs/Rhtslib.so: undefined symbol: lzma_easy_buffer_encode
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib’

In case it helps I'm using g++ 4.8.5 on RHEL 8.

I have tried different ways of installing the package but none have worked. Any suggests are welcome.

Thanks, Damian

lshep commented 3 years ago

Not an expert in Rhtslib but some google suggest maybe installing liblzma system dependency

dfermin commented 3 years ago

Unfortunately I can't or find the RPM that provides that.

I've got lzma-sdk, xz, xz-libs, pyliblzma, and xz-devel all installed but those don't seem to satisfy the Rhtslib requirements.

mtmorgan commented 3 years ago

Can you provide a more comprehensive illustration of how you're installing... I have

> BiocManager::install("Rhtslib")
Bioconductor version 3.13 (BiocManager 1.30.10.11), R Under development
  (unstable) (2021-02-10 r79979)
Installing package(s) 'Rhtslib'
trying URL 'https://bioconductor.org/packages/3.13/bioc/src/contrib/Rhtslib_1.23.0.tar.gz'
Content type 'application/x-gzip' length 1472273 bytes (1.4 MB)
==================================================
downloaded 1.4 MB

* installing *source* package 'Rhtslib' ...
** using non-staged installation via StagedInstall field
** libs
cd "htslib-1.7" && make -f "/Users/ma38727/bin/R-devel/etc/Makeconf" -f "Makefile.Rhtslib"
Makefile.Rhtslib:128: warning: overriding commands for target `.c.o'
/Users/ma38727/bin/R-devel/etc/Makeconf:168: warning: ignoring old commands for target `.c.o'
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o kfunc.o kfunc.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o knetfile.o knetfile.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o kstring.o kstring.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o bcf_sr_sort.o bcf_sr_sort.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o bgzf.o bgzf.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o errmod.o errmod.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o faidx.o faidx.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o hfile.o hfile.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o hfile_net.o hfile_net.c
echo '#define HTS_VERSION "1.7"' > version.h
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o hts.o hts.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o hts_os.o hts_os.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o md5.o md5.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o multipart.o multipart.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o probaln.o probaln.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o realn.o realn.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o regidx.o regidx.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o sam.o sam.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o synced_bcf_reader.o synced_bcf_reader.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o vcf_sweep.o vcf_sweep.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o tbx.o tbx.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o textutils.o textutils.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o thread_pool.o thread_pool.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o vcf.o vcf.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o vcfutils.o vcfutils.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_codecs.o cram/cram_codecs.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_decode.o cram/cram_decode.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_encode.o cram/cram_encode.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_external.o cram/cram_external.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_index.o cram/cram_index.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_io.o cram/cram_io.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_samtools.o cram/cram_samtools.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/cram_stats.o cram/cram_stats.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/files.o cram/files.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/mFILE.o cram/mFILE.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/open_trace_file.o cram/open_trace_file.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/pooled_alloc.o cram/pooled_alloc.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/rANS_static.o cram/rANS_static.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/sam_header.o cram/sam_header.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o cram/string_alloc.o cram/string_alloc.c
gcc -g -O0  -fpic -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -c -o hfile_libcurl.o hfile_libcurl.c
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 hfile_libcurl.o
ranlib libhts.a
gcc -dynamiclib -install_name /usr/local/lib/libhts.2.dylib -current_version 1.7 -compatibility_version 2 -L/usr/local/lib -o libhts.dylib 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 hfile_libcurl.o -lz -lm -lbz2 -llzma -lcurl
ln -sf libhts.dylib libhts.2.dylib
mkdir -p "/Users/ma38727/Library/R/4.1/Bioc/3.13/library/Rhtslib/include/htslib"
cd "htslib-1.7/htslib" && cp * "/Users/ma38727/Library/R/4.1/Bioc/3.13/library/Rhtslib/include/htslib" && cd .. && cp textutils_internal.h hts_internal.h "/Users/ma38727/Library/R/4.1/Bioc/3.13/library/Rhtslib/include"
gcc -I"/Users/ma38727/bin/R-devel/include" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I"/Users/ma38727/Library/R/4.1/Bioc/3.13/library/Rhtslib/include" -I'/Users/ma38727/Library/R/4.1/Bioc/3.13/library/zlibbioc/include' -I/usr/local/include   -fPIC  -g -O0  -c R_init_Rhtslib.c -o R_init_Rhtslib.o
mkdir -p "/Users/ma38727/Library/R/4.1/Bioc/3.13/library/Rhtslib/usrlib"
cd "htslib-1.7" && cp libhts.a "/Users/ma38727/Library/R/4.1/Bioc/3.13/library/Rhtslib/usrlib"
gcc -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Users/ma38727/bin/R-devel/lib -L/usr/local/lib -o Rhtslib.so R_init_Rhtslib.o /Users/ma38727/Library/R/4.1/Bioc/3.13/library/Rhtslib/usrlib/libhts.a -lcurl -L/Users/ma38727/bin/R-devel/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
mkdir -p "/Users/ma38727/Library/R/4.1/Bioc/3.13/library/Rhtslib/testdata/tabix"
cd "htslib-1.7/test" && (cp *.sam *.bam *.vcf *.bcf *.cram *.fa *.fa.fai *.gff *.bed "/Users/ma38727/Library/R/4.1/Bioc/3.13/library/Rhtslib/testdata" 2>/dev/null || true) && cd tabix && (cp *.sam *.bam *.vcf *.bcf *.cram *.fa *.fa.fai *.gff *.bed "/Users/ma38727/Library/R/4.1/Bioc/3.13/library/Rhtslib/testdata/tabix" 2>/dev/null || true)
installing to /Users/ma38727/Library/R/4.1/Bioc/3.13/library/Rhtslib/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (Rhtslib)

I would have guessed that xz-devel would be the correct RPM; can you confirm that the liblzma library you're linking to really doesn't have the entry point? I have

/usr/local/Cellar/xz/5.2.5/lib$ nm liblzma.dylib |grep version  # SANITY CHECK -- this should work
0000000000001bd4 T _lzma_version_number
0000000000001bdf T _lzma_version_string
/usr/local/Cellar/xz/5.2.5/lib$ nm liblzma.dylib |grep lzma_easy_buffer_encode
000000000000492e T _lzma_easy_buffer_encode
dfermin commented 3 years ago

This is how I'm doing it:

[dfermin]$ R

R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Microsoft R Open 4.0.2
The enhanced R distribution from Microsoft
Microsoft packages Copyright (C) 2020 Microsoft Corporation

Using the Intel MKL for parallel mathematical computing (using 24 cores).

Default CRAN mirror snapshot taken on 2020-07-16.
See: https://mran.microsoft.com/.

> BiocManager::install("Rhtslib")
Bioconductor version 3.12 (BiocManager 1.30.10), R 4.0.2 (2020-06-22)
Installing package(s) 'Rhtslib'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1437k  100 1437k    0     0   244k      0  0:00:05  0:00:05 --:--:--  425k

* installing *source* package ‘Rhtslib’ ...
** using non-staged installation via StagedInstall field
** libs
cd "htslib-1.7" && make -f "/opt/microsoft/ropen/4.0.2/lib64/R/etc/Makeconf" -f "Makefile.Rhtslib"
make[1]: Entering directory `/tmp/RtmpTaQZ5C/R.INSTALL371a40e92f6d/Rhtslib/src/htslib-1.7'
Makefile.Rhtslib:128: warning: overriding recipe for target `.c.o'
/opt/microsoft/ropen/4.0.2/lib64/R/etc/Makeconf:159: warning: ignoring old recipe for target `.c.o'
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o kfunc.o kfunc.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o knetfile.o knetfile.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o kstring.o kstring.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o bcf_sr_sort.o bcf_sr_sort.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o bgzf.o bgzf.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o errmod.o errmod.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o faidx.o faidx.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o hfile.o hfile.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o hfile_net.o hfile_net.c
echo '#define HTS_VERSION "1.7"' > version.h
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o hts.o hts.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o hts_os.o hts_os.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o md5.o md5.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o multipart.o multipart.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o probaln.o probaln.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o realn.o realn.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o regidx.o regidx.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o sam.o sam.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o synced_bcf_reader.o synced_bcf_reader.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o vcf_sweep.o vcf_sweep.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o tbx.o tbx.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o textutils.o textutils.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o thread_pool.o thread_pool.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o vcf.o vcf.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o vcfutils.o vcfutils.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/cram_codecs.o cram/cram_codecs.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/cram_decode.o cram/cram_decode.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/cram_encode.o cram/cram_encode.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/cram_external.o cram/cram_external.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/cram_index.o cram/cram_index.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/cram_io.o cram/cram_io.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/cram_samtools.o cram/cram_samtools.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/cram_stats.o cram/cram_stats.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/files.o cram/files.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/mFILE.o cram/mFILE.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/open_trace_file.o cram/open_trace_file.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/pooled_alloc.o cram/pooled_alloc.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/rANS_static.o cram/rANS_static.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/sam_header.o cram/sam_header.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o cram/string_alloc.o cram/string_alloc.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64 -c -o hfile_libcurl.o hfile_libcurl.c
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 hfile_libcurl.o
ranlib libhts.a

gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o kfunc.pico kfunc.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o knetfile.pico knetfile.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o kstring.pico kstring.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o bcf_sr_sort.pico bcf_sr_sort.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o bgzf.pico bgzf.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o errmod.pico errmod.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o faidx.pico faidx.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o hfile.pico hfile.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o hfile_net.pico hfile_net.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o hts.pico hts.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o hts_os.pico hts_os.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o md5.pico md5.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o multipart.pico multipart.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o probaln.pico probaln.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o realn.pico realn.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o regidx.pico regidx.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o sam.pico sam.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o synced_bcf_reader.pico synced_bcf_reader.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o vcf_sweep.pico vcf_sweep.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o tbx.pico tbx.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o textutils.pico textutils.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o thread_pool.pico thread_pool.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o vcf.pico vcf.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o vcfutils.pico vcfutils.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/cram_codecs.pico cram/cram_codecs.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/cram_decode.pico cram/cram_decode.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/cram_encode.pico cram/cram_encode.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/cram_external.pico cram/cram_external.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/cram_index.pico cram/cram_index.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/cram_io.pico cram/cram_io.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/cram_samtools.pico cram/cram_samtools.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/cram_stats.pico cram/cram_stats.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/files.pico cram/files.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/mFILE.pico cram/mFILE.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/open_trace_file.pico cram/open_trace_file.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/pooled_alloc.pico cram/pooled_alloc.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/rANS_static.pico cram/rANS_static.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/sam_header.pico cram/sam_header.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o cram/string_alloc.pico cram/string_alloc.c
gcc -std=gnu99 -DU_STATIC_IMPLEMENTATION -O2 -g  -fpic -I. -DU_STATIC_IMPLEMENTATION -D_FILE_OFFSET_BITS=64  -c -o hfile_libcurl.pico hfile_libcurl.c
gcc -std=gnu99 -shared -Wl,-soname,libhts.so.2  -o libhts.so kfunc.pico knetfile.pico kstring.pico bcf_sr_sort.pico bgzf.pico errmod.pico faidx.pico hfile.pico hfile_net.pico hts.pico hts_os.pico md5.pico multipart.pico probaln.pico realn.pico regidx.pico sam.pico synced_bcf_reader.pico vcf_sweep.pico tbx.pico textutils.pico thread_pool.pico vcf.pico vcfutils.pico cram/cram_codecs.pico cram/cram_decode.pico cram/cram_encode.pico cram/cram_external.pico cram/cram_index.pico cram/cram_io.pico cram/cram_samtools.pico cram/cram_stats.pico cram/files.pico cram/mFILE.pico cram/open_trace_file.pico cram/pooled_alloc.pico cram/rANS_static.pico cram/sam_header.pico cram/string_alloc.pico hfile_libcurl.pico -lz -lm -lbz2 -llzma -lcurl -lpthread
ln -sf libhts.so libhts.so.2
make[1]: Leaving directory `/tmp/RtmpTaQZ5C/R.INSTALL371a40e92f6d/Rhtslib/src/htslib-1.7'
mkdir -p "/opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/include/htslib"
cd "htslib-1.7/htslib" && cp * "/opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/include/htslib" && cd .. && cp textutils_internal.h hts_internal.h "/opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/include"
gcc -std=gnu99 -I/opt/microsoft/ropen/4.0.2/lib64/R/include -DNDEBUG -D_FILE_OFFSET_BITS=64 -I"/opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/include" -I'/opt/microsoft/ropen/4.0.2/lib64/R/library/zlibbioc/include' -DU_STATIC_IMPLEMENTATION   -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c R_init_Rhtslib.c -o R_init_Rhtslib.o
mkdir -p "/opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/usrlib"
cd "htslib-1.7" && cp libhts.so libhts.a "/opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/usrlib"
cd "/opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/usrlib" && ln -s libhts.so libhts.so.2
gcc -std=gnu99 -shared -L/opt/microsoft/ropen/4.0.2/lib64/R/lib -o Rhtslib.so R_init_Rhtslib.o /opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/usrlib/libhts.a -lcurl -L/opt/microsoft/ropen/4.0.2/lib64/R/lib -lR
mkdir -p "/opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/testdata/tabix"
cd "htslib-1.7/test" && (cp *.sam *.bam *.vcf *.bcf *.cram *.fa *.fa.fai *.gff *.bed "/opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/testdata" 2>/dev/null || true) && cd tabix && (cp *.sam *.bam *.vcf *.bcf *.cram *.fa *.fa.fai *.gff *.bed "/opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/testdata/tabix" 2>/dev/null || true)
installing to /opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘Rhtslib’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/libs/Rhtslib.so':
  /opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib/libs/Rhtslib.so: undefined symbol: lzma_easy_buffer_encode
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/opt/microsoft/ropen/4.0.2/lib64/R/library/Rhtslib’

The downloaded source packages are in
    ‘/tmp/RtmpI03xli/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages(...) :
  installation of package ‘Rhtslib’ had non-zero exit status

Apparently I can't find the liblzma.dylib:

[dfermin]$ nm liblzma.dylib | grep version
nm: 'liblzma.dylib': No such file

Yet I have xz-devel installed:

[dfermin]$ sudo rpm -qa xz-devel
xz-devel-5.2.2-1.el7.x86_64
mtmorgan commented 3 years ago

I was guessing at what you needed to look for, but you can 'see' above the line in your output

ln -sf libhts.so libhts.so.2

that the 'lzma' library is found at compile time by the successful discovery of

... -lz -lm -lbz2 -llzma -lcurl -lpthread

at the end of the line. Also, the library that you need to look for is likely liblzma.so; it will be wherever the RPM installed it, not necessarily visible from the command line -- you'll need to discover where that is; /usr/lib/ ? /usr/local/lib ? /opt/...?

hpages commented 3 years ago

It won't be a .dylib file if your are on Linux. On RHEL 8, it should be liblzma.so and you should see it in /usr/lib64/. This is according to http://rpm.pbone.net/info_idpl_49523986_distro_redhatel8_com_xz-libs-5.2.4-2.el8.x86_64.rpm.html

dfermin commented 3 years ago

I have it installed as far as I can tell:

[dfermin]$ ls /usr/lib64/*lzma*
lrwxrwxrwx. 1 root root   19 Feb 25 10:21 /usr/lib64/liblzmasdk.so.4 -> liblzmasdk.so.4.6.5*
-rwxr-xr-x. 1 root root 158K Mar  9  2018 /usr/lib64/liblzmasdk.so.4.6.5*
lrwxrwxrwx. 1 root root   16 Feb 24  2017 /usr/lib64/liblzma.so -> liblzma.so.5.2.2*
lrwxrwxrwx. 1 root root   16 Dec 19  2016 /usr/lib64/liblzma.so.5 -> liblzma.so.5.2.2*
-rwxr-xr-x. 1 root root 154K Nov  5  2016 /usr/lib64/liblzma.so.5.2.2*
hpages commented 3 years ago

First: Let's check that the linker on your system actually sees this lzma library. I suspect it does, otherwise the last gcc invocation during installation of Rhtsllib (i.e. the gcc -std=gnu99 -shared ... command) would have failed. Do you see the /usr/lib64 folder in the output of ld --verbose | grep SEARCH_DIR | tr -s ' ;' \\012?

Here is what I see on my Ubuntu 20.10 system:

hpages@spectre:~$ ld --verbose | grep SEARCH_DIR | tr -s ' ;' \\012
SEARCH_DIR("=/usr/local/lib/x86_64-linux-gnu")
SEARCH_DIR("=/lib/x86_64-linux-gnu")
SEARCH_DIR("=/usr/lib/x86_64-linux-gnu")
SEARCH_DIR("=/usr/lib/x86_64-linux-gnu64")
SEARCH_DIR("=/usr/local/lib64")
SEARCH_DIR("=/lib64")
SEARCH_DIR("=/usr/lib64")
SEARCH_DIR("=/usr/local/lib")
SEARCH_DIR("=/lib")
SEARCH_DIR("=/usr/lib")
SEARCH_DIR("=/usr/x86_64-linux-gnu/lib64")
SEARCH_DIR("=/usr/x86_64-linux-gnu/lib")

liblzma.so is in /lib/x86_64-linux-gnu/:

hpages@spectre:~$ ls -l /lib/x86_64-linux-gnu/*lzma*
-rw-r--r-- 1 root root 281002 Apr 20  2020 /lib/x86_64-linux-gnu/liblzma.a
lrwxrwxrwx 1 root root     38 Apr 20  2020 /lib/x86_64-linux-gnu/liblzma.so -> /lib/x86_64-linux-gnu/liblzma.so.5.2.4
lrwxrwxrwx 1 root root     16 Nov 19 09:57 /lib/x86_64-linux-gnu/liblzma.so.5 -> liblzma.so.5.2.4
-rw-r--r-- 1 root root 162264 Apr 20  2020 /lib/x86_64-linux-gnu/liblzma.so.5.2.4

Second: Let's make sure that the lzma library can be found at run-time. This command should display it:

hpages@spectre:~$ ldconfig -NX -v 2>/dev/null| grep lzma 
    liblzma.so.5 -> liblzma.so.5.2.4

Does it for you? If it doesn't, run sudo ldconfig -v, and try again.

dfermin commented 3 years ago

Yep I see it there. Here is my output:

[dfermin]$ ld --verbose | grep SEARCH_DIR | tr -s ' ;' \\012
SEARCH_DIR("=/usr/x86_64-redhat-linux/lib64")
SEARCH_DIR("=/usr/lib64")
SEARCH_DIR("=/usr/local/lib64")
SEARCH_DIR("=/lib64")
SEARCH_DIR("=/usr/x86_64-redhat-linux/lib")
SEARCH_DIR("=/usr/local/lib")
SEARCH_DIR("=/lib")
SEARCH_DIR("=/usr/lib")

The second command also works:

[dfermin]$ ldconfig -NX -v 2>/dev/null| grep lzma
    liblzma.so.5 -> liblzma.so.5.2.2
    liblzmasdk.so.4 -> liblzmasdk.so.4.6.5
    liblzma.so.5 -> liblzma.so.5.2.2
dfermin commented 3 years ago

Hi. I thought I'd give an update on this since others might be struggling with it. I was able to get the package to install on CRAN R without any problems so it seems to be specific to MRAN R.

hpages commented 3 years ago

Well, that's kind of disappointing for being "The Enhanced R Distribution". Although not totally surprising considering this is Microsoft.

Note that Bioconductor only supports the official distribution of R from CRAN. The 2000 software packages in the project are thoroughly tested against this distribution. Also Microsoft R Open is lagging 2 minor versions behind the official R (4.0.2 vs 4.0.4), and we only test and support the latest. This is another reason why Bioconductor users should stick to R from CRAN.

Finally I thought I would give Microsoft R Open a chance by downloading and installing their packaging for Ubuntu (from https://mran.microsoft.com/download), so maybe I would be able to reproduce/troubleshoot your issue. But it won't even start:

hpages@spectre:~$ R
/opt/microsoft/ropen/4.0.2/lib64/R/bin/exec/R: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

H.

dfermin commented 3 years ago

I can say that for 90% of the packages out there Micro$oft R is pretty good. It's noticeably faster too. I've used the last 2 versions of it without any issues even bioconductor packages. This is the first time I've hit a problem.

hpages commented 3 years ago

Your choice, if you are comfortable with using an unsupported R distribution. But please understand that you're on your own because we can't really help you.

zzwch commented 3 years ago

withr::with_makevars(c(PKG_LIBS='-llzma'), install.packages('Rhtslib_1.22.0.tar.gz', repos = NULL), assignment='+=')

or see below https://github.com/microsoft/microsoft-r-open/issues/119

hpages commented 3 years ago

MRO is being phased out: https://cloudblogs.microsoft.com/sqlserver/2021/06/30/looking-to-the-future-for-r-in-azure-sql-and-sql-server/ Time to move to the CRAN R (a.k.a. "the standard R"), which BTW is the only version that Bioconductor officially supports. Additionally, by using CRAN R, you'll be able to upgrade to the latest R (R 4.1) which is required to use the latest Bioconductor (BioC 3.13). MRO is stuck at R 4.0.