Trouble compiling SAMtools
Hello, I am having some trouble compiling SAMtools on a Solaris10 X86 p latform using gcc compiler version 3.4.6. Using the Makefile I get some link errors and have not been successful in creating the binary or the associated libraries. It seemed to me that it was missing the socket library. I tried adding -lsocket to the compile directive but landed up with no resolution. Here is a transcript of the make command used to build the binary file. I'd sure appreciate some help/pointers from experienced people of this list. Thanks in advance. root >> make make[1]: Entering directory `/home/zkzac/samtools-0.1.12a' make[2]: Entering directory `/home/zkzac/samtools-0.1.12a' gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bgzf.c -o bgzf.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. kstring.c -o kstring.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_aux.c -o bam_aux.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam.c -o bam.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_import.c -o bam_import.o bam_import.c: In function `append_text': bam_import.c:179: warning: long int format, size_t arg (arg 3) bam_import.c:186: warning: long int format, size_t arg (arg 3) bam_import.c:186: warning: long int format, size_t arg (arg 4) bam_import.c:186: warning: long int format, size_t arg (arg 5) bam_import.c:186: warning: long int format, size_t arg (arg 6) gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. sam.c -o sam.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_index.c -o bam_index.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_pileup.c -o bam_pileup.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_lpileup.c -o bam_lpileup.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_md.c -o bam_md.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. glf.c -o glf.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. razf.c -o razf.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. faidx.c -o faidx.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. knetfile.c -o knetfile.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_sort.c -o bam_sort.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. sam_header.c -o sam_header.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_reheader.c -o bam_reheader.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. kprobaln.c -o kprobaln.o ar -cru libbam.a 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 glf.o razf.o faidx.o knetfile.o bam_sort.o sam_header.o bam_reheader.o kprobaln.o make[2]: Leaving directory `/home/zkzac/samtools-0.1.12a' make[2]: Entering directory `/home/zkzac/samtools-0.1.12a/bcftools' gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I.. -I. bcf.c -o bcf.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I.. -I. vcf.c -o vcf.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I.. -I. bcfutils.c -o bcfutils.o bcfutils.c: In function `bcf_shrink_alt': bcfutils.c:64: warning: implicit declaration of function `alloca' gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I.. -I. prob1.c -o prob1.o prob1.c: In function `cal_pdg': prob1.c:189: warning: implicit declaration of function `alloca' prob1.c: In function `mc_cal_afs': prob1.c:340: warning: implicit declaration of function `isinf' gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I.. -I. ld.c -o ld.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I.. -I. kfunc.c -o kfunc.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I.. -I. index.c -o index.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I.. -I. fet.c -o fet.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I.. -I. bcf2qcall.c -o bcf2qcall.o ar -cru libbcf.a bcf.o vcf.o bcfutils.o prob1.o ld.o kfunc.o index.o fet.o bcf2qcall.o make[2]: Leaving directory `/home/zkzac/samtools-0.1.12a/bcftools' make[2]: Entering directory `/home/zkzac/samtools-0.1.12a/misc' make[2]: Nothing to be done for `lib'. make[2]: Leaving directory `/home/zkzac/samtools-0.1.12a/misc' gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_tview.c -o bam_tview.o bam_tview.c:7:2: warning: #warning "_CURSES_LIB=1 but NCURSES_VERSION not defined; tview is NOT compiled" bam_tview.c:418:2: warning: #warning "No curses library is available; tview is disabled." gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_maqcns.c -o bam_maqcns.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_plcmd.c -o bam_plcmd.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. sam_view.c -o sam_view.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_rmdup.c -o bam_rmdup.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_rmdupse.c -o bam_rmdupse.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_mate.c -o bam_mate.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_stat.c -o bam_stat.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam_color.c -o bam_color.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bamtk.c -o bamtk.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. kaln.c -o kaln.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam2bcf.c -o bam2bcf.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bam2bcf_indel.c -o bam2bcf_indel.o bam2bcf_indel.c: In function `bcf_call_gap_prep': bam2bcf_indel.c:326: warning: implicit declaration of function `alloca' gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. errmod.c -o errmod.o gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -D_CURSES_LIB=1 -I. sample.c -o sample.o gcc -g -Wall -O2 -o samtools bam_tview.o bam_maqcns.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 libbam.a -lm -lcurses -lz -Lbcftools -lbcf Undefined first referenced symbol in file socket libbam.a(knetfile.o) setsockopt libbam.a(knetfile.o) connect libbam.a(knetfile.o) getaddrinfo libbam.a(knetfile.o) freeaddrinfo libbam.a(knetfile.o) ld: fatal: Symbol referencing errors. No output written to samtools collect2: ld returned 1 exit status make[1]: *** [samtools] Error 1 make[1]: Leaving directory `/home/zkzac/samtools-0.1.12a' make: *** [all-recur] Error 1
Zachariah K Zachariah wrote:
Hello,
I am having some trouble compiling SAMtools on a Solaris10 X86 p latform using gcc compiler version 3.4.6. Using the Makefile I get some link errors and have not been successful in creating the binary or the associated libraries. It seemed to me that it was missing the socket library. I tried adding -lsocket to the compile directive but landed up with no resolution. Here is a transcript of the make command used to build the binary file. I'd sure appreciate some help/pointers from experienced people of this list. Thanks in advance.
Hi, This is a question more suitable for the SAMtools mailing list(s) since it's not specific to Galaxy: http://sourceforge.net/mail/?group_id=246254 That said, I'll try to help answer your question.
root >> make make[1]: Entering directory `/home/zkzac/samtools-0.1.12a' make[2]: Entering directory `/home/zkzac/samtools-0.1.12a'
...
gcc -g -Wall -O2 -o samtools bam_tview.o bam_maqcns.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 libbam.a -lm -lcurses -lz -Lbcftools -lbcf Undefined first referenced symbol in file socket libbam.a(knetfile.o) setsockopt libbam.a(knetfile.o) connect libbam.a(knetfile.o) getaddrinfo libbam.a(knetfile.o) freeaddrinfo libbam.a(knetfile.o) ld: fatal: Symbol referencing errors. No output written to samtools collect2: ld returned 1 exit status make[1]: *** [samtools] Error 1 make[1]: Leaving directory `/home/zkzac/samtools-0.1.12a' make: *** [all-recur] Error 1
I'm not sure where you added socket to the compilation but it's not present when linking. If it was in the right place, you'd see it in the output of 'gcc -o samtools' as above. I added it to the Makefile like so: samtools:lib-recur $(AOBJS) $(CC) $(CFLAGS) -o $@ $(AOBJS) libbam.a -lm $(LIBPATH) $(LIBCURSES) -lz -Lbcftools -lbcf -lsocket -lnsl Note -lnsl, you probably need that too. Hope this helps, --nate
_______________________________________________ To manage your subscriptions to this and other Galaxy lists, please use the interface at:
participants (2)
-
Nate Coraor
-
Zachariah K Zachariah