Errors when install samtools 0.1.18 from source code
1
0
Entering edit mode
6.7 years ago
syrttgump ▴ 50

Hi, I downloaded source code of samtools-0.1.18, then compile it by the command line:

make CFLAGS=-fPIC

But this is the error:

gcc -fPIC -o samtools bam_tview.o bam_plcmd.o sam_view.o bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o bamtk.o kaln.o bam2bcf.o bam2bcf_indel.o errmod.o sample.o cut_target.o phase.o bam2depth.o -Lbcftools  libbam.a -lbcf -lcurses  -lm -lz
bam2bcf_indel.o: In function `ks_combsort_uint32_t':
bam2bcf_indel.c:(.text+0x1177): undefined reference to `__ks_insertsort_uint32_t'
bam2bcf_indel.o: In function `ks_introsort_uint32_t':
bam2bcf_indel.c:(.text+0x14f7): undefined reference to `__ks_insertsort_uint32_t'
errmod.o: In function `ks_combsort_uint16_t':
errmod.c:(.text+0x706): undefined reference to `__ks_insertsort_uint16_t'
errmod.o: In function `ks_introsort_uint16_t':
errmod.c:(.text+0xaa3): undefined reference to `__ks_insertsort_uint16_t'
phase.o: In function `ks_combsort_rseq':
phase.c:(.text+0x250f): undefined reference to `__ks_insertsort_rseq'
phase.o: In function `ks_introsort_rseq':
phase.c:(.text+0x2909): undefined reference to `__ks_insertsort_rseq'
libbam.a(bgzf.o): In function `deflate_block':
bgzf.c:(.text+0x14c0): undefined reference to `packInt16'
bgzf.c:(.text+0x1513): undefined reference to `packInt32'
bgzf.c:(.text+0x1531): undefined reference to `packInt32'
libbam.a(bgzf.o): In function `check_header':
bgzf.c:(.text+0x1741): undefined reference to `unpackInt16'
bgzf.c:(.text+0x1788): undefined reference to `unpackInt16'
libbam.a(bgzf.o): In function `bgzf_read_block':
bgzf.c:(.text+0x1c1e): undefined reference to `unpackInt16'
libbam.a(bam_index.o): In function `ks_combsort_off':
bam_index.c:(.text+0x8d9): undefined reference to `__ks_insertsort_off'
libbam.a(bam_index.o): In function `ks_introsort_off':
bam_index.c:(.text+0xcf7): undefined reference to `__ks_insertsort_off'
libbam.a(bam_lpileup.o): In function `ks_combsort_node':
bam_lpileup.c:(.text+0x989): undefined reference to `__ks_insertsort_node'
libbam.a(bam_lpileup.o): In function `ks_introsort_node':
bam_lpileup.c:(.text+0xf61): undefined reference to `__ks_insertsort_node'
libbam.a(bedidx.o): In function `ks_combsort_uint64_t':
bedidx.c:(.text+0x755): undefined reference to `__ks_insertsort_uint64_t'
libbam.a(bedidx.o): In function `ks_introsort_uint64_t':
bedidx.c:(.text+0xb07): undefined reference to `__ks_insertsort_uint64_t'
libbam.a(bam_sort.o): In function `ks_combsort_heap':
bam_sort.c:(.text+0xc58): undefined reference to `__ks_insertsort_heap'
libbam.a(bam_sort.o): In function `ks_introsort_heap':
bam_sort.c:(.text+0x1213): undefined reference to `__ks_insertsort_heap'
libbam.a(bam_sort.o): In function `ks_combsort_sort':
bam_sort.c:(.text+0x331c): undefined reference to `__ks_insertsort_sort'
libbam.a(bam_sort.o): In function `ks_introsort_sort':
bam_sort.c:(.text+0x3710): undefined reference to `__ks_insertsort_sort'
collect2: error: ld returned 1 exit status
make[1]: *** [samtools] Error 1
make[1]: Leaving directory `/wistar/herlynm/jliu/tiantian/download/samtools-0.1.18'
make: *** [all-recur] Error 1

I am using a linux server and gcc version is 6.1.0

samtools software error • 4.0k views
ADD COMMENT
0
Entering edit mode

Why are you trying to install such an ancient version of samtools? It looks like your compiler didn't like the macro-magic used by Heng's kstring code.

ADD REPLY
0
Entering edit mode

I want to install the Perl package Bio::DB::Sam, it need this old version of samtools

ADD REPLY
0
Entering edit mode

Download the binaries then, they're on sourceforge. Though a better option would be to not use Bio::DB:Sam, since if it's using something that ancient it's not maintained.

ADD REPLY
1
Entering edit mode

The problem is that Bio::DB::Sam is one of the few ways to display bam coverage tracks in GBrowse and in general to read Bamfiles in Perl

ADD REPLY
0
Entering edit mode

Eeek!

ADD REPLY
0
Entering edit mode

If you need to compile that lib, possibly an older compiler of the 4.x family could work. That might also result in having to build perl from scratch.

ADD REPLY
0
Entering edit mode
6.7 years ago
Michael 54k

If you must, I was able to compile samtools-0.1.18 with the following changes under gcc (GCC) 6.2.0 Make sure you have a recent zlib, that is where my LDFLAGS need to point to. Otherwise you will get an error about missing symbol gzopen64. If your libz is already recent enough (1.2.8 or higher), You can leave the LDFLAGS out

diff -rup samtools-0.1.18/bcftools/Makefile samtools-0.1.18-a/bcftools/Makefile
--- samtools-0.1.18/bcftools/Makefile   2011-09-02 18:57:34.000000000 +0200
+++ samtools-0.1.18-a/bcftools/Makefile 2017-08-17 14:05:01.679285689 +0200
@@ -1,5 +1,5 @@
 CC=            gcc
-CFLAGS=        -g -Wall -O2 #-m64 #-arch ppc
+CFLAGS=        -g -Wall -O2 -m64 #-arch ppc
 DFLAGS=        -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE
 LOBJS=     bcf.o vcf.o bcfutils.o prob1.o em.o kfunc.o kmin.o index.o fet.o mut.o bcf2qcall.o
 OMISC=     ..
@@ -7,7 +7,7 @@ AOBJS=      call1.o main.o $(OMISC)/kstring.
 PROG=      bcftools
 INCLUDES=
 SUBDIRS=   .
-
+LDFLAGS=    -L/usr/local/lib
 .SUFFIXES:.c .o

 .c.o:
@@ -31,7 +31,7 @@ libbcf.a:$(LOBJS)
        $(AR) -csru $@ $(LOBJS)

 bcftools:lib $(AOBJS)
-       $(CC) $(CFLAGS) -o $@ $(AOBJS) -L. $(LIBPATH) -lbcf -lm -lz
+       $(CC) $(CFLAGS) -o $@ $(AOBJS) -L. $(LIBPATH) -lbcf -lm -lz $(LDFLAGS)

 bcf.o:bcf.h
 vcf.o:bcf.h
Only in samtools-0.1.18-a/: lib
diff -rup samtools-0.1.18/Makefile samtools-0.1.18-a/Makefile
--- samtools-0.1.18/Makefile    2011-09-02 18:57:34.000000000 +0200
+++ samtools-0.1.18-a/Makefile  2017-08-17 13:53:24.978198313 +0200
@@ -1,7 +1,8 @@
 CC=            gcc
-CFLAGS=        -g -Wall -O2 #-m64 #-arch ppc
+CFLAGS=        -g -Wall -O2 -m64 #-arch ppc
 DFLAGS=        -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1
 KNETFILE_O=    knetfile.o
+LDFLAGS=    -L/usr/local/lib
 LOBJS=     bgzf.o kstring.o bam_aux.o bam.o bam_import.o sam.o bam_index.o \
            bam_pileup.o bam_lpileup.o bam_md.o razf.o faidx.o bedidx.o \
            $(KNETFILE_O) bam_sort.o sam_header.o bam_reheader.o kprobaln.o bam_cat.o
@@ -41,7 +42,7 @@ libbam.a:$(LOBJS)
        $(AR) -csru $@ $(LOBJS)

 samtools:lib-recur $(AOBJS)
-       $(CC) $(CFLAGS) -o $@ $(AOBJS) -Lbcftools $(LIBPATH) libbam.a -lbcf $(LIBCURSES) -lm -lz
+       $(CC)  $(LDFLAGS) -o $@ $(AOBJS) -Lbcftools $(LIBPATH) libbam.a -lbcf $(LIBCURSES) -lm -lz

 razip:razip.o razf.o $(KNETFILE_O)
        $(CC) $(CFLAGS) -o $@ razf.o razip.o $(KNETFILE_O) -lz
ADD COMMENT

Login before adding your answer.

Traffic: 2584 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