Bioconductor / Rsamtools

Binary alignment (BAM), FASTA, variant call (BCF), and tabix file import
https://bioconductor.org/packages/Rsamtools
Other
27 stars 27 forks source link

Rsamtools.so: undefined symbol: hts_open_format #36

Closed christophfink closed 2 years ago

christophfink commented 2 years ago

I’m having the very same problem as the now closed issue #35, also when installing using BiocManager:

> library(BiocManager); BiocManager::install("Rsamtools")
Bioconductor version 3.15 (BiocManager 1.30.17), R 4.2.0 (2022-04-22)
Installing package(s) 'Rsamtools'
trying URL 'https://bioconductor.org/packages/3.15/bioc/src/contrib/Rsamtools_2.12.0.tar.gz'
Content type 'application/x-gzip' length 2870358 bytes (2.7 MB)
==================================================
downloaded 2.7 MB

* installing *source* package ‘Rsamtools’ ...
** using staged installation
** libs
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c Biostrings_stubs.c -o Biostrings_stubs.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c COMPAT_bcf_hdr_read.c -o COMPAT_bcf_hdr_read.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c IRanges_stubs.c -o IRanges_stubs.o
g++ -std=gnu++14 -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto  -c PileupBuffer.cpp -o PileupBuffer.o
g++ -std=gnu++14 -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto  -c PosCacheColl.cpp -o PosCacheColl.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c R_init_Rsamtools.c -o R_init_Rsamtools.o
g++ -std=gnu++14 -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto  -c ResultManager.cpp -o ResultManager.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c S4Vectors_stubs.c -o S4Vectors_stubs.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c XVector_stubs.c -o XVector_stubs.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c as_bam.c -o as_bam.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c bam.c -o bam.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c bam_data.c -o bam_data.o
g++ -std=gnu++14 -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto  -c bam_mate_iter.cpp -o bam_mate_iter.o
In file included from /usr/lib/R/library/Rhtslib/include/sam.h:29,
                 from Template.h:9,
                 from BamIterator.h:10,
                 from BamRangeIterator.h:7,
                 from bam_mate_iter.cpp:2:
BamRangeIterator.h: In member function ‘virtual void BamRangeIterator::finalize_inprogress(bamFile)’:
/usr/lib/R/library/Rhtslib/include/bam.h:57:41: warning: ignoring return value of ‘int64_t bgzf_seek(BGZF*, int64_t, int)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   57 | #define bam_seek(fp, pos, dir) bgzf_seek(fp, pos, dir)
      |                                ~~~~~~~~~^~~~~~~~~~~~~~
BamRangeIterator.h:138:16: note: in expansion of macro ‘bam_seek’
  138 |         (void) bam_seek(bfile, pos, SEEK_SET);
      |                ^~~~~~~~
BamIterator.h: In constructor ‘BamIterator::BamIterator(bamFile, const bam_index_t*)’:
/usr/lib/R/library/Rhtslib/include/bam.h:57:41: warning: ignoring return value of ‘int64_t bgzf_seek(BGZF*, int64_t, int)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   57 | #define bam_seek(fp, pos, dir) bgzf_seek(fp, pos, dir)
      |                                ~~~~~~~~~^~~~~~~~~~~~~~
BamIterator.h:87:16: note: in expansion of macro ‘bam_seek’
   87 |         (void) bam_seek(bfile, 0, 0);
      |                ^~~~~~~~
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c bam_plbuf.c -o bam_plbuf.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c bam_sort.c -o bam_sort.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c bambuffer.c -o bambuffer.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c bamfile.c -o bamfile.o
bamfile.c: In function ‘bamfile_isincomplete’:
bamfile.c:168:20: warning: ignoring return value of ‘bgzf_seek’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  168 |             (void) bgzf_seek(bfile->file->x.bam, offset, SEEK_SET);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c bcffile.c -o bcffile.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c encode.c -o encode.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c fafile.c -o fafile.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c idxstats.c -o idxstats.o
In file included from /usr/lib/R/library/Rhtslib/include/sam.h:29,
                 from bamfile.h:5,
                 from idxstats.c:1:
idxstats.c: In function ‘idxstats_bamfile’:
/usr/lib/R/library/Rhtslib/include/bam.h:57:32: warning: ignoring return value of ‘bgzf_seek’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   57 | #define bam_seek(fp, pos, dir) bgzf_seek(fp, pos, dir)
      |                                ^~~~~~~~~~~~~~~~~~~~~~~
idxstats.c:20:12: note: in expansion of macro ‘bam_seek’
   20 |     (void) bam_seek(fp, 0, 0);
      |            ^~~~~~~~
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c io_sam.c -o io_sam.o
In file included from /usr/lib/R/library/Rhtslib/include/sam.h:29,
                 from io_sam.c:2:
io_sam.c: In function ‘_scan_bam_all’:
/usr/lib/R/library/Rhtslib/include/bam.h:57:32: warning: ignoring return value of ‘bgzf_seek’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   57 | #define bam_seek(fp, pos, dir) bgzf_seek(fp, pos, dir)
      |                                ^~~~~~~~~~~~~~~~~~~~~~~
io_sam.c:304:12: note: in expansion of macro ‘bam_seek’
  304 |     (void) bam_seek(bfile->file->x.bam, bfile->pos0, SEEK_SET);
      |            ^~~~~~~~
g++ -std=gnu++14 -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto  -c pbuffer_wrapper.cpp -o pbuffer_wrapper.o
g++ -std=gnu++14 -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto  -c pileup.cpp -o pileup.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c pileupbam.c -o pileupbam.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c sam.c -o sam.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c sam_opts.c -o sam_opts.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c sam_utils.c -o sam_utils.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c samtools_patch.c -o samtools_patch.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c scan_bam_data.c -o scan_bam_data.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c tabixfile.c -o tabixfile.o
tabixfile.c: In function ‘index_tabix’:
tabixfile.c:190:5: warning: ‘bgzf_is_bgzf’ is deprecated: Use bgzf_compression() or hts_detect_format() instead [-Wdeprecated-declarations]
  190 |     if (bgzf_is_bgzf(fn) != 1)
      |     ^~
In file included from tabixfile.c:3:
/usr/lib/R/library/Rhtslib/include/htslib/bgzf.h:243:9: note: declared here
  243 |     int bgzf_is_bgzf(const char *fn) HTS_DEPRECATED("Use bgzf_compression() or hts_detect_format() instead");
      |         ^~~~~~~~~~~~
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c tagfilter.c -o tagfilter.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c utilities.c -o utilities.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FILE_OFFSET_BITS=64 -I'/usr/lib/R/library/Rhtslib/include' -I'/usr/lib/R/library/S4Vectors/include' -I'/usr/lib/R/library/IRanges/include' -I'/usr/lib/R/library/XVector/include' -I'/usr/lib/R/library/Biostrings/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -c zip_compression.c -o zip_compression.o
g++ -std=gnu++14 -shared -L/usr/lib64/R/lib -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto -o Rsamtools.so Biostrings_stubs.o COMPAT_bcf_hdr_read.o IRanges_stubs.o PileupBuffer.o PosCacheColl.o R_init_Rsamtools.o ResultManager.o S4Vectors_stubs.o XVector_stubs.o as_bam.o bam.o bam_data.o bam_mate_iter.o bam_plbuf.o bam_sort.o bambuffer.o bamfile.o bcffile.o encode.o fafile.o idxstats.o io_sam.o pbuffer_wrapper.o pileup.o pileupbam.o sam.o sam_opts.o sam_utils.o samtools_patch.o scan_bam_data.o tabixfile.o tagfilter.o utilities.o zip_compression.o /usr/lib/R/library/Rhtslib/usrlib/libhts.a -lcurl -L/usr/lib64/R/lib -lR
installing to /home/christoph/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-Rsamtools/00new/Rsamtools/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 from temporary location
Error: package or namespace load failed for ‘Rsamtools’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/christoph/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-Rsamtools/00new/Rsamtools/libs/Rsamtools.so':
  /home/christoph/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-Rsamtools/00new/Rsamtools/libs/Rsamtools.so: undefined symbol: hts_open_format
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/christoph/R/x86_64-pc-linux-gnu-library/4.2/Rsamtools’

The downloaded source packages are in
    ‘/tmp/RtmpmeoPUu/downloaded_packages’
Installation paths not writeable, unable to update packages
  path: /usr/lib/R/library
  packages:
    checkmate, GenomeInfoDbData, hwriter, IRanges, MASS
Warning message:
In install.packages(...) :
  installation of package ‘Rsamtools’ had non-zero exit status
> 

It seems that the linker ‘forgets’ about htslib somehow:

> ldd Rsamtools.so
    linux-vdso.so.1 (0x00007ffdd95a2000)
    libR.so => /usr/lib/R/lib/libR.so (0x00007f29e5abf000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f29e5899000)
    libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f29e587e000)
    libc.so.6 => /usr/lib/libc.so.6 (0x00007f29e5674000)
    libblas.so.3 => /usr/lib/libblas.so.3 (0x00007f29e561d000)
    libm.so.6 => /usr/lib/libm.so.6 (0x00007f29e5535000)
    libreadline.so.8 => /usr/lib/libreadline.so.8 (0x00007f29e54dd000)
    libpcre2-8.so.0 => /usr/lib/libpcre2-8.so.0 (0x00007f29e5444000)
    liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007f29e541a000)
    libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007f29e5407000)
    libz.so.1 => /usr/lib/libz.so.1 (0x00007f29e53ed000)
    libtirpc.so.3 => /usr/lib/libtirpc.so.3 (0x00007f29e53be000)
    libicuuc.so.71 => /usr/lib/libicuuc.so.71 (0x00007f29e51bd000)
    libicui18n.so.71 => /usr/lib/libicui18n.so.71 (0x00007f29e4e8b000)
    libgomp.so.1 => /usr/lib/libgomp.so.1 (0x00007f29e4e46000)
    /usr/lib64/ld-linux-x86-64.so.2 (0x00007f29e6007000)
    libgfortran.so.5 => /usr/lib/libgfortran.so.5 (0x00007f29e4b8b000)
    libncursesw.so.6 => /usr/lib/libncursesw.so.6 (0x00007f29e4b17000)
    libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f29e4b10000)
    libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00007f29e4abb000)
    libicudata.so.71 => /usr/lib/libicudata.so.71 (0x00007f29e2db6000)
    libquadmath.so.0 => /usr/lib/../lib/libquadmath.so.0 (0x00007f29e2d6b000)
    libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00007f29e2c92000)
    libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00007f29e2c60000)
    libcom_err.so.2 => /usr/lib/libcom_err.so.2 (0x00007f29e2c5a000)
    libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00007f29e2c4b000)
    libkeyutils.so.1 => /usr/lib/libkeyutils.so.1 (0x00007f29e2c44000)
    libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007f29e2c30000)

I’m also on Arch Linux, with R 4.2.0, Rhtslib 1.28.0, and htslib 1.15.1.

Originally posted by @christophfink in https://github.com/Bioconductor/Rsamtools/issues/35#issuecomment-1113403648

christophfink commented 2 years ago

I found this ancient support thread discussing different CFLAGS: https://support.bioconductor.org/p/43325/

Tried all the suggestions from there, did not work.

mtmorgan commented 2 years ago

I think you want to do R CMD ldd Rsamtools.so which sets known library paths. This might not help, but the non-help would be informative. Is there an Arch Linux docker image that this can be reproduced on?

hpages commented 2 years ago

@christophfink The output of ldd Rsamtools.so looks fine to me. We use static linking to /usr/lib/R/library/Rhtslib/usrlib/libhts.a so ldd Rsamtools.so won't report it.

Looks like you are using a system-wide R with packages already installed in a system-wide location (/usr/lib/R/library/). I'm surprised that Rhtslib is already installed there but Rsamtools is not. Are we sure the stuff in /usr/lib/R/library/ was installed/compiled with R 4.2 and with the same compiler that you're using to install Rsamtools?

Can you please show us the output of:

which R
ls -l /usr/lib/R/library/

Then start R and show us the output of:

library(Rhtslib)
.libPaths()
sessionInfo()

H.

vjcitn commented 2 years ago

I built R under arch linux within docker. (docker pull archlinux). Commands to build R from source:

 10  pacman -Sy gcc
   11  pacman -Sy subversion
   14  pacman -Sy db
   24  pacman -Sy gcc-fortran
   29  svn co https://svn.r-project.org/R/branches/R-4-2-branch R-4-2-src
   31  cd R-4-2-src
   32  cd tools
   34  pacman -Sy rsync
   35  ./rsync-recommended
   36  cd ..
   38  mkdir /R-4-2-dist
   42  pacman -Sy xorg-server
   45  pacman -Sy xorg-server-devel
   47  pacman -Sy libx11
   52  pacman -Sy libxt
   54  ./configure --enable-R-shlib --prefix=/R-4-2-dist
   56  pacman -Sy make
   60  make -j 2
   61  make install

With this R, install.packages("BiocManager"); BiocManager::install("Rsamtools") produces a fine installation of Rsamtools.

The problem must be with the packaged R 4.2. I will now explore that.

vjcitn commented 2 years ago

With

[root@087b139859d1 /]# pacman -Q -i r
Name            : r
Version         : 4.2.0-1
Description     : Language and environment for statistical computing and graphics
Architecture    : x86_64
URL             : https://www.r-project.org/
Licenses        : GPL
Groups          : None
Provides        : None
Depends On      : lapack  libtiff  pcre2  perl  libxmu  pango  zip  unzip  curl  icu  which
Optional Deps   : tk: tcl/tk interface
                  texlive-bin: latex sty files
                  gcc-fortran: needed to compile some CRAN packages [installed]
                  openblas: faster linear algebra
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 84.76 MiB
Packager        : Antonio Rojas <arojas@archlinux.org>
Build Date      : Fri 22 Apr 2022 08:39:47 AM UTC
Install Date    : Fri 29 Apr 2022 08:49:51 PM UTC
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

I had no problem installing and using Rsamtools obtained via BiocManager.

vjcitn commented 2 years ago

I conclude that this is not a problem with Rsamtools and the difficulty should be raised in an appropriate forum related to arch linux.

christophfink commented 2 years ago

Could you still leave this issue open, until we know a possible fix, as it affects only rsamtools? I'm certain that you have a point when you say that something in the way Arch compiles C causes the underlying issue, but it is, after all, triggered by something in rsamtools or samtools.

As for figuring out what causes this: Arch recently changed its compiler defaults to enable LTO by default. Could that have an influence? (I tried without LTO, and it didn't change things, but would that seem like an avenue worth exploring further?)

christophfink commented 2 years ago

I'll try to build R itself without LTO, additionally to rhslib and rsamtools. Will report back here.

christophfink commented 2 years ago

Quickly reporting back on a WIP intermediate success, in case someone else is facing the same problems: with the following options added to their respective PKGBUILDs, r, r-rhtslib and r-rsamtools build fine:

r: !lto
r-rhtslib: !lto staticlibs
r-rsamtools: !lto !buildflags staticlibs

now trying to figure out the minimal set of changes

vjcitn commented 2 years ago

I reopened the issue on your request.

christophfink commented 2 years ago

Actually, now, the issue can be closed, because it clearly is connected to the way Arch builds packages, and I’ve managed to identify a workaround. I filed a bug report with the R package for Arch, see https://bugs.archlinux.org/task/74609 . Thanks for reopening, though!