samtools / samtools

Tools (written in C using htslib) for manipulating next-generation sequencing data
http://htslib.org/
Other
1.63k stars 581 forks source link

Cygwin compilation problems: -rdynamic unrecognised, expl(),logl() missing #512

Open NicoleJohn opened 8 years ago

NicoleJohn commented 8 years ago

Good day.

I am trying to install SAMTools 1.3 on Cygwin using my Windows8.1 64bit machine. I successfully ran the "./configure" command as shown below: $ ./configure checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.exe checking for suffix of executables... .exe checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking location of HTSlib source tree... htslib-1.3 checking for NcursesW wide-character library... yes checking for working ncursesw/curses.h... yes checking for working ncursesw.h... no checking for working ncurses.h... yes checking for zlib.h... yes checking for inflate in -lz... yes configure: creating ./config.status config.status: creating config.mk config.status: creating config.h === configuring in htslib-1.3 (/cygdrive/c/Users/NicoleJohnMagculia/Home/bin/sam tools-1.3/htslib-1.3) configure: running /bin/sh ./configure --disable-option-checking '--prefix=/usr/ local' --cache-file=/dev/null --srcdir=. checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.exe checking for suffix of executables... .exe checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for ranlib... ranlib checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for stdlib.h... (cached) yes checking for unistd.h... (cached) yes checking for sys/param.h... yes checking for getpagesize... yes checking for working mmap... yes checking for gmtime_r... yes checking for zlib.h... yes checking for inflate in -lz... yes configure: creating ./config.status config.status: creating config.mk

config.status: creating config.h

However when I tried to perform "make" function, I encountered this problem:

$ make gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_index.o bam_index.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_plcmd.o bam_plcmd.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o sam_view.o sam_view.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_cat.o bam_cat.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_md.o bam_md.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_reheader.o bam_reheader.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_sort.o bam_sort.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bedidx.o bedidx.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o kprobaln.o kprobaln.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_rmdup.o bam_rmdup.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_rmdupse.o bam_rmdupse.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_mate.o bam_mate.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_stat.o bam_stat.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_color.o bam_color.c echo '#define SAMTOOLS_VERSION "1.3"' > version.h gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bamtk.o bamtk.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam2bcf.o bam2bcf.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam2bcf_indel.o bam2bcf_indel.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o errmod.o errmod.c errmod.c: In function ‘cal_coef’: errmod.c:85:30: warning: incompatible implicit declaration of built-in function ‘expl’ sum = sum1 + expl(lC[n<<8|k] + kle + (n-k)le1); ^ errmod.c:86:43: warning: incompatible implicit declaration of built-in function ‘logl’ beta[k] = -10. / M_LN10 * logl(sum1 / sum); ^ gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o sample.o sample.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o sam_opts.o sam_opts.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o cut_target.o cut_target.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o phase.o phase.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam2depth.o bam2depth.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o padding.o padding.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bedcov.o bedcov.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bamshuf.o bamshuf.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o faidx.o faidx.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o dict.o dict.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o stats.o stats.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o stats_isize.o stats_isize.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_flags.o bam_flags.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_split.o bam_split.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_tview.o bam_tview.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_tview_curses.o bam_tview_curses.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_tview_html.o bam_tview_html.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_lpileup.o bam_lpileup.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_quickcheck.o bam_quickcheck.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_addrprg.o bam_addrprg.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_aux.o bam_aux.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam.o bam.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_import.o bam_import.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o sam.o sam.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o sam_header.o sam_header.c gcc -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3 -c -o bam_plbuf.o bam_plbuf.c ar -csru libbam.a bam_aux.o bam.o bam_import.o sam.o sam_header.o bam_plbuf.o cd htslib-1.3 && make lib-static make[1]: Entering directory '/cygdrive/c/Users/NicoleJohnMagculia/Home/bin/samto ols-1.3/htslib-1.3' gcc -g -O2 -I. -c -o kfunc.o kfunc.c gcc -g -O2 -I. -c -o knetfile.o knetfile.c gcc -g -O2 -I. -c -o kstring.o kstring.c gcc -g -O2 -I. -c -o bgzf.o bgzf.c gcc -g -O2 -I. -c -o faidx.o faidx.c gcc -g -O2 -I. -c -o hfile.o hfile.c gcc -g -O2 -I. -c -o hfile_net.o hfile_net.c echo '#define HTS_VERSION "1.3"' > version.h gcc -g -O2 -I. -c -o hts.o hts.c gcc -g -O2 -I. -c -o md5.o md5.c gcc -g -O2 -I. -c -o regidx.o regidx.c gcc -g -O2 -I. -c -o sam.o sam.c gcc -g -O2 -I. -c -o synced_bcf_reader.o synced_bcf_reader.c gcc -g -O2 -I. -c -o vcf_sweep.o vcf_sweep.c gcc -g -O2 -I. -c -o tbx.o tbx.c gcc -g -O2 -I. -c -o vcf.o vcf.c gcc -g -O2 -I. -c -o vcfutils.o vcfutils.c gcc -g -O2 -I. -c -o cram/cram_codecs.o cram/cram_codecs.c gcc -g -O2 -I. -c -o cram/cram_decode.o cram/cram_decode.c gcc -g -O2 -I. -c -o cram/cram_encode.o cram/cram_encode.c gcc -g -O2 -I. -c -o cram/cram_external.o cram/cram_external.c gcc -g -O2 -I. -c -o cram/cram_index.o cram/cram_index.c gcc -g -O2 -I. -c -o cram/cram_io.o cram/cram_io.c gcc -g -O2 -I. -c -o cram/cram_samtools.o cram/cram_samtools.c gcc -g -O2 -I. -c -o cram/cram_stats.o cram/cram_stats.c gcc -g -O2 -I. -c -o cram/files.o cram/files.c gcc -g -O2 -I. -c -o cram/mFILE.o cram/mFILE.c gcc -g -O2 -I. -c -o cram/open_trace_file.o cram/open_trace_file.c gcc -g -O2 -I. -c -o cram/pooled_alloc.o cram/pooled_alloc.c gcc -g -O2 -I. -c -o cram/rANS_static.o cram/rANS_static.c gcc -g -O2 -I. -c -o cram/sam_header.o cram/sam_header.c gcc -g -O2 -I. -c -o cram/string_alloc.o cram/string_alloc.c gcc -g -O2 -I. -c -o cram/thread_pool.o cram/thread_pool.c gcc -g -O2 -I. -c -o cram/vlen.o cram/vlen.c gcc -g -O2 -I. -c -o cram/zfio.o cram/zfio.c ar -rc libhts.a kfunc.o knetfile.o kstring.o bgzf.o faidx.o hfile.o hfile_net.o hts.o md5.o regidx.o sam.o synced_bcf_reader.o vcf_sweep.o tbx.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/fil es.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 cram/thread_pool.o cram/vlen.o cram/zfio.o
ranlib libhts.a make[1]: Leaving directory '/cygdrive/c/Users/NicoleJohnMagculia/Home/bin/samtoo ls-1.3/htslib-1.3' gcc -pthread -rdynamic -o samtools bam_index.o bam_plcmd.o sam_view.o bam_cat. o bam_md.o bam_reheader.o bam_sort.o bedidx.o kprobaln.o bam_rmdup.o bam_rmdupse .o bam_mate.o bam_stat.o bam_color.o bamtk.o bam2bcf.o bam2bcf_indel.o errmod.o sample.o sam_opts.o cut_target.o phase.o bam2depth.o padding.o bedcov.o bamshuf. o faidx.o dict.o stats.o stats_isize.o bam_flags.o bam_split.o bam_tview.o bam_t view_curses.o bam_tview_html.o bam_lpileup.o bam_quickcheck.o bam_addrprg.o libb am.a htslib-1.3/libhts.a -lncursesw -lm -lz -ldl gcc: error: unrecognized command line option ‘-rdynamic’ Makefile:139: recipe for target 'samtools' failed make: *\ [samtools] Error 1


How can I troubleshoot this problem? I am not a computer programmer and just relying on the information I read in your instructions. Your assistance is very much valuable to me.

Thanks.

Sincerely,

Nicole John

jmarshall commented 8 years ago

It seems the -rdynamic option is not accepted by Cygwin's GCC. Samtools needs it on most platforms to support HTSlib plugins, and its being present in the makefile always is temporary (see 3c15c88a0b0b64700a67a19446e689f18996b6f5).

You haven't configured HTSlib to use plugins, so you don't need it. Remove the word -rdynamic from the ALL_LDFLAGS line in the Makefile and remove the word -ldl from the following ALL_LIBS line. Having removed -rdynamic/-ldl, you should be able to link samtools on Cygwin successfully.

Samtools et al are not heavily tested on Windows or Cygwin, as there are few people using them there. So it is in fact easier to compile them on Linux, other Unixes, or Mac OS X, if you have access to these platforms.


errmod.c:85:30: warning: incompatible implicit declaration of built-in function ‘expl’ errmod.c:86:43: warning: incompatible implicit declaration of built-in function ‘logl’

This is similar to samtools/bcftools#281 and can be fixed similarly if it causes trouble.

NicoleJohn commented 8 years ago

Thank you so much for your prompt reply. I successfully compiled and installed the samtools in cygwin.

Again, thanks!

All the best,

Nicole John

jmarshall commented 8 years ago

The missing expl() and logl() library functions also cause linking to fail. A quick hack to fix this is to add -Dexpl=exp -Dlogl=log to the ALL_CPPFLAGS line in the same part of the Makefile. (If you've already run make, delete errmod.o to ensure that it gets remade when you rerun make.)

NicoleJohn commented 8 years ago

Good day.

Now, I am trying to compile bcftools 1.3 again through Cygwin. I have removed -rdynamic from the makefile as I encountered the same error again. However, after doing this, another error occurred (see below):

[…snip… This bcftools plugin compilation failure on Cygwin is now samtools/bcftools#377.]