Rsamtools undefined symbol: gzopen64
1
0
Entering edit mode
Shuang He • 0
@shuang-he-16892
Last seen 5.4 years ago
China/Beijing

Hi,when I tried to install Rsamtools ,I get the errors:

Error: package or namespace load failed for ‘Rsamtools’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/lustre1/cxu_pkuhpc/program/R-3.5.1/library/Rsamtools/libs/Rsamtools.so':
  /path/R-3.5.1/library/Rsamtools/libs/Rsamtools.so: undefined symbol: gzopen64
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/path/program/R-3.5.1/library/Rsamtools’

  1. linux version: 

$lsb_release -a

LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch

Distributor ID: CentOS

Description: CentOS release 6.5 (Final)

Release: 6.5

Codename: Final

2.

> sessionInfo() 
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.5 (Final)

Matrix products: default
BLAS: /path/program/R-3.5.1/lib/libRblas.so
LAPACK: /path/program/R-3.5.1/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] BiocInstaller_1.30.0

loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1   

(1)commond:

  • tar -xzvf  Rsamtools_1.32.2.tar.gz
  • R CMD INSTALL Rsamtools

 

(2)$/path/R-3.5.1/bin/R CMD ldd Rsamtools/src/Rsamtools.so

    linux-vdso.so.1 (0x00007fffec7ff000)

    libz.so.1 => /lib64/libz.so.1 (0x00002b4ce4d61000)

    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002b4ce4f77000)

    libm.so.6 => /lib64/libm.so.6 (0x00002b4ce5306000)

    libgomp.so.1 => /usr/lib64/libgomp.so.1 (0x00002b4ce5608000)

    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b4ce5829000)

    libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b4ce5a40000)

    libc.so.6 => /lib64/libc.so.6 (0x00002b4ce5c5c000)

    /lib64/ld-linux-x86-64.so.2 (0x0000003711e00000)

    libdl.so.2 => /lib64/libdl.so.2 (0x00002b4ce5ffa000)

(3)files under /lib64/

lrwxrwxrwx 1 root root    13 Jul 25 01:01 libz.so.1 -> libz.so.1.2.3
-rwxr-xr-x 1 root root  117K Jul 24 23:27 libz.so.1.2.11
-rwxr-xr-x 1 root root   89K Feb 22  2013 libz.so.1.2.3

$objdump -T libz.so.1.2.11 | grep gzopen64 

0000000000011190 g    DF .text 000000000000000d  ZLIB_1.2.3.3 gzopen64

$objdump -T libz.so.1.2.3 | grep gzopen64  

without anything return .

because I can't change the system file(link libz.so.1.2.11 to libz.so.1),then can I  change the Rsamtools/src/Rsamtools.so file ?

 let  "libz.so.1 => /lib64/libz.so.1 (0x00002b4ce4d61000) " become "libz.so.1.2.11 =>  /lib64/libz.so.1.2.11/

 

What else can I do ?

Thank you very much !!

Rsamtools gzopen64 zlib • 1.7k views
ADD COMMENT
0
Entering edit mode
@martin-morgan-1513
Last seen 4 months ago
United States

Thanks for the careful report.

I think that there is basically a mis-configuration on your system, with the .so pointing to an old rather than new version of libz.

Nonetheless, I think you can work around this by editing Rsamtools/src/Makevars to contain the full path to the libz you'd like to use

Rsamtools master$ git diff
diff --git a/inst/extdata/ex1.bam.bai b/inst/extdata/ex1.bam.bai
deleted file mode 100644
index aa79a0a..0000000
Binary files a/inst/extdata/ex1.bam.bai and /dev/null differ
diff --git a/src/Makevars b/src/Makevars
index b9f8ad4..e12dd0e 100644
--- a/src/Makevars
+++ b/src/Makevars
@@ -1,7 +1,7 @@
 include Makevars.common
 
 PKG_CFLAGS = ${PKG_CFLAGS0}
-PKG_LIBS = ${PKG_LIBS0} -lz
+PKG_LIBS = ${PKG_LIBS0} -L/usr/lib64/libz.so.1.2.11
 
 libs0: libbam.a libbcf.a libtabix.a
 

 

ADD COMMENT
0
Entering edit mode

Thanks,Martin.But after editing the  Rsamtools/src/Makevars(simply use vim), I still got the same errors. Following is the whole Rsamtools/src/Makevars file: 

include Makevars.common

PKG_CFLAGS = ${PKG_CFLAGS0}

PKG_LIBS = ${PKG_LIBS0} -lz

PKG_LIBS = ${PKG_LIBS0} -L/lib64/libz.so.1.2.11

libs0: libbam.a libbcf.a libtabix.a

libbam.a: $(BAMOBJ) $(AR) -crus $@ $(BAMOBJ)

libbcf.a: $(BCFOBJ) $(AR) -crus $@ $(BCFOBJ)

libtabix.a: $(TABIXOBJ) $(AR) -crus $@ $(TABIXOBJ)

command and error reports:

$/path/R-3.5.1/bin/R CMD INSTALL Rsamtools

* installing to library ‘/path/R-3.5.1/library’

* installing *source* package ‘Rsamtools’ ...

** libs

mkdir -p "/path/R-3.5.1/library/Rsamtools/include/samtools/bcftools"

mkdir -p "/path/R-3.5.1/library/Rsamtools/include/tabix"

cp samtools/*.h "/path/R-3.5.1/library/Rsamtools/include/samtools/"

cp samtools/bcftools/*h "/path/R-3.5.1/library/Rsamtools/include/samtools/bcftools/"

cp tabix/*h "/path/R-3.5.1/library/Rsamtools/include/tabix/"

cp samtools/bgzf.h samtools/kstring.h samtools/knetfile.h \

"/path/R-3.5.1/library/Rsamtools/include/tabix/"

mkdir -p "/path/R-3.5.1/library/Rsamtools/usrlib"

cp libbam.a libbcf.a libtabix.a "/path/R-3.5.1/library/Rsamtools/usrlib"

g++ -shared -L/path/R-3.5.1/packages/lib -o Rsamtools.so Biostrings_stubs.o
 IRanges_stubs.o PileupBuffer.o PosCacheColl.o R_init_Rsamtools.o ResultManager.o S4Vectors_stubs.o XVector_stubs.o as_bam.o bam_data.o bam_mate_iter.o bambuffer.o bamfile.o bcffile.o encode.o fafile.o idxstats.o io_sam.o pbuffer_wrapper.o pileup.o pileupbam.o samtools_patch.o scan_bam_data.o tabixfile.o tagfilter.o utilities.o zip_compression.o -pthread -fopenmp /path/R-3.5.1/library/Rsamtools/usrlib/libbam.a 
/path/R-3.5.1/library/Rsamtools/usrlib/libbcf.a 
/path/R-3.5.1/library/Rsamtools/usrlib/libtabix.a -L/lib64/libz.so.1.2.11

installing to /path/R-3.5.1/library/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

Error: package or namespace load failed for ‘Rsamtools’ in dyn.load(file, DLLpath = DLLpath, ...):

 unable to load shared object '/path/R-3.5.1/library/Rsamtools/libs/Rsamtools.so':

  /path/R-3.5.1/library/Rsamtools/libs/Rsamtools.so: undefined symbol: gzopen64

Error: loading failed

Execution halted

ERROR: loading failed

* removing ‘/path/R-3.5.1/library/Rsamtools’

and I can't find the libz.so.1 after installing

$/path/R-3.5.1/bin/R CMD ldd Rsamtools/src/Rsamtools.so

linux-vdso.so.1 (0x00007fffe85ff000)

libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002add811ef000)

libm.so.6 => /lib64/libm.so.6 (0x00002add8157d000)

libgomp.so.1 => /usr/lib64/libgomp.so.1 (0x00002add81880000)

libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002add81aa1000)

libpthread.so.0 => /lib64/libpthread.so.0 (0x00002add81cb7000)

libc.so.6 => /lib64/libc.so.6 (0x00002add81ed4000)

/lib64/ld-linux-x86-64.so.2 (0x0000003711e00000)

libdl.so.2 => /lib64/libdl.so.2 (0x00002add82272000)

sorry if I misunderstand anything.

ADD REPLY
0
Entering edit mode

I think the updated line should not have had -L, so

PKG_LIBS = ${PKG_LIBS0} /lib64/libz.so.1.2.11

 

ADD REPLY
0
Entering edit mode

Thanks again. but now it reported new errors after updating.

** testing if installed package can be loaded
Error: package or namespace load failed for ‘Rsamtools’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/path/R-3.5.1/library/Rsamtools/libs/Rsamtools.so':
  /lib64/libz.so.1: version `ZLIB_1.2.3.3' not found (required by /path/R-3.5.1/library/Rsamtools/libs/Rsamtools.so)
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/lustre1/cxu_pkuhpc/program/R-3.5.1/library/Rsamtools’

 libz.so.1 still links to /lib64/libz.so.1

$/path/R-3.5.1/bin/R CMD ldd Rsamtools/src/Rsamtools.so
Rsamtools/src/Rsamtools.so: /lib64/libz.so.1: version `ZLIB_1.2.3.3' not found (required by Rsamtools/src/Rsamtools.so)
linux-vdso.so.1 (0x00007fff8bf9d000)

libz.so.1 => /lib64/libz.so.1 (0x00002abc65058000)

libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002abc6526e000)

libm.so.6 => /lib64/libm.so.6 (0x00002abc655fd000)

libgomp.so.1 => /usr/lib64/libgomp.so.1 (0x00002abc658ff000)

libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002abc65b20000)

libpthread.so.0 => /lib64/libpthread.so.0 (0x00002abc65d37000)

libc.so.6 => /lib64/libc.so.6 (0x00002abc65f53000)

/lib64/ld-linux-x86-64.so.2 (0x0000003711e00000)

libdl.so.2 => /lib64/libdl.so.2 (0x00002abc662f1000)
ADD REPLY
0
Entering edit mode

I'll give this some additional thought, but have you contacted your system administrator to indicate that the symlink seems incorrect (libz 1.2.3.3 is from 2006, more than 12 years ago).

I think you might also try replacing the full path to libz.so with the full path to the static ilbrary libz.a.

ADD REPLY
0
Entering edit mode
Thank you very much.Yes,I contacted system administrator.And I replaced 
PKG_LIBS = ${PKG_LIBS0} /lib64/libz.so.1.2.11
 with 
PKG_LIBS = ${PKG_LIBS0} /usr/local/lib/libz.a (or with -L )

but both  doesn't work .

$/path/R-3.5.1/bin/R CMD INSTALL Rsamtools

* installing to library ‘/path/R-3.5.1/library’

* installing *source* package ‘Rsamtools’ ...

** libs

mkdir -p "/path/R-3.5.1/library/Rsamtools/include/samtools/bcftools"

mkdir -p "/path/R-3.5.1/library/Rsamtools/include/tabix"

cp samtools/*.h "/path/R-3.5.1/library/Rsamtools/include/samtools/"

cp samtools/bcftools/*h "/path/R-3.5.1/library/Rsamtools/include/samtools/bcftools/"

cp tabix/*h "/path/R-3.5.1/library/Rsamtools/include/tabix/"

cp samtools/bgzf.h samtools/kstring.h samtools/knetfile.h \

"/path/R-3.5.1/library/Rsamtools/include/tabix/"

mkdir -p "/path/R-3.5.1/library/Rsamtools/usrlib"

cp libbam.a libbcf.a libtabix.a "/path/R-3.5.1/library/Rsamtools/usrlib"

g++ -shared -L/path/R-3.5.1/packages/lib -o Rsamtools.so Biostrings_stubs.o IRanges_stubs.o PileupBuffer.o PosCacheColl.o R_init_Rsamtools.o ResultManager.o S4Vectors_stubs.o XVector_stubs.o as_bam.o bam_data.o bam_mate_iter.o bambuffer.o bamfile.o bcffile.o encode.o fafile.o idxstats.o io_sam.o pbuffer_wrapper.o pileup.o pileupbam.o samtools_patch.o scan_bam_data.o tabixfile.o tagfilter.o utilities.o zip_compression.o -pthread -fopenmp /path/R-3.5.1/library/Rsamtools/usrlib/libbam.a /path/R-3.5.1/library/Rsamtools/usrlib/libbcf.a /path/R-3.5.1/library/Rsamtools/usrlib/libtabix.a /usr/local/lib/libz.a

/usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC

/usr/local/lib/libz.a: could not read symbols: Bad value

collect2: error: ld returned 1 exit status

make: *** [Rsamtools.so] Error 1

ERROR: compilation failed for package ‘Rsamtools’

* removing ‘/path/R-3.5.1/library/Rsamtools’

 

(add -L)

$/path/R-3.5.1/bin/R CMD INSTALL Rsamtools

* installing to library ‘/path/R-3.5.1/library’

* installing *source* package ‘Rsamtools’ ...

** libs

mkdir -p "/path/R-3.5.1/library/Rsamtools/include/samtools/bcftools"

mkdir -p "/path/R-3.5.1/library/Rsamtools/include/tabix"

cp samtools/*.h "/path/R-3.5.1/library/Rsamtools/include/samtools/"

cp samtools/bcftools/*h "/path/R-3.5.1/library/Rsamtools/include/samtools/bcftools/"

cp tabix/*h "/path/R-3.5.1/library/Rsamtools/include/tabix/"

cp samtools/bgzf.h samtools/kstring.h samtools/knetfile.h \

"/path/R-3.5.1/library/Rsamtools/include/tabix/"

mkdir -p "/path/R-3.5.1/library/Rsamtools/usrlib"

cp libbam.a libbcf.a libtabix.a "/path/R-3.5.1/library/Rsamtools/usrlib"

g++ -shared -L/path/R-3.5.1/packages/lib -o Rsamtools.so Biostrings_stubs.o IRanges_stubs.o PileupBuffer.o PosCacheColl.o R_init_Rsamtools.o ResultManager.o S4Vectors_stubs.o XVector_stubs.o as_bam.o bam_data.o bam_mate_iter.o bambuffer.o bamfile.o bcffile.o encode.o fafile.o idxstats.o io_sam.o pbuffer_wrapper.o pileup.o pileupbam.o samtools_patch.o scan_bam_data.o tabixfile.o tagfilter.o utilities.o zip_compression.o -pthread -fopenmp /path/R-3.5.1/library/Rsamtools/usrlib/libbam.a /path/R-3.5.1/library/Rsamtools/usrlib/libbcf.a /path/R-3.5.1/library/Rsamtools/usrlib/libtabix.a -L/usr/local/lib/libz.a

installing to /path/R-3.5.1/library/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

Error: package or namespace load failed for ‘Rsamtools’ in dyn.load(file, DLLpath = DLLpath, ...):

 unable to load shared object '/path/R-3.5.1/library/Rsamtools/libs/Rsamtools.so':

  /path/R-3.5.1/library/Rsamtools/libs/Rsamtools.so: undefined symbol: gzopen64

Error: loading failed

Execution halted

ERROR: loading failed

* removing ‘/path/R-3.5.1/library/Rsamtools’

 

ADD REPLY

Login before adding your answer.

Traffic: 752 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6