This is a test version of Biostars. For the public version, visit https://www.biostars.org.
error installing samtools on ubuntu

Hello,

I'm trying to install samtools 1.3 on my ubuntu instance. When I try "make" it get the following error

I have previously installed samtools using "apt-get" pre-compiled binary, but that is such an old version, I would like to get the latest version of samtools 1.3

Could anyone help me figure out how to fix this problem ?

> ubuntu@ubuntu:~/Documents/software/samtools-1.3$ make
Makefile:99: config.mk: No such file or directory
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam_index.o bam_index.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam_plcmd.o bam_plcmd.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o sam_view.o sam_view.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam_cat.o bam_cat.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam_md.o bam_md.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam_reheader.o bam_reheader.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam_sort.o bam_sort.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bedidx.o bedidx.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o kprobaln.o kprobaln.c
kprobaln.c: In function ‘kpa_glocal’:
kprobaln.c:78:21: warning: variable ‘is_diff’ set but not used [-Wunused-but-set-variable]
  int bw, bw2, i, k, is_diff = 0, is_backward = 1, Pr;
                     ^
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam_rmdup.o bam_rmdup.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam_rmdupse.o bam_rmdupse.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam_mate.o bam_mate.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam_stat.o bam_stat.c
gcc -g -Wall -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 -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bamtk.o bamtk.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam2bcf.o bam2bcf.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam2bcf_indel.o bam2bcf_indel.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o errmod.o errmod.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o sample.o sample.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o sam_opts.o sam_opts.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o cut_target.o cut_target.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o phase.o phase.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam2depth.o bam2depth.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o padding.o padding.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bedcov.o bedcov.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bamshuf.o bamshuf.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o faidx.o faidx.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o dict.o dict.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o stats.o stats.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o stats_isize.o stats_isize.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam_flags.o bam_flags.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam_split.o bam_split.c
gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam_tview.o bam_tview.c
echo '/* Basic config.h generated by Makefile */' > config.h
echo '#define HAVE_CURSES' >> config.h
echo '#define HAVE_CURSES_H' >> config.h
    gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Ihtslib-1.3  -c -o bam_tview_curses.o bam_tview_curses.c
 bam_tview_curses.c:41:20: fatal error: curses.h: No such file or directory
    compilation terminated.
    Makefile:130: recipe for target 'bam_tview_curses.o' failed
    make: *** [bam_tview_curses.o] Error 1**
samtools

Here are the steps I followed to fix it. Hope this is helpful to others

#Install the missing libraries 
   sudo apt-get install libncurses-dev

# repeat the "make" step. This time no error
ubuntu@ubuntu:~/Documents/software/samtools-1.3$ make

#create a SEPARATE FOLDER called “samtools”. This is where the bin folder will be created 
ubuntu@ubuntu:~/Documents/software/samtools-1.3$ make prefix=/home/ubuntu/Documents/software/samtools install

#add to path 
   Export PATH=/home/Ubuntu/Documents/software/samtools/bin:$PATH

2 answers

you're missing the ncurses library. install ncurses

sudo apt-get install libncurses-dev

You could also try bioconda (https://bioconda.github.io). Once you have conda installed,

conda install -c bioconda "samtools==1.3"

I am also having the same issue. I installed libncurses by giving this command

sudo apt-get install libncurses5-dev libncursesw5-dev

and this is the output of above command


Output of above command

ammar@ammar-HP-15-Notebook-PC:~$ sudo apt-get install libncurses5-dev libncursesw5-dev

Reading package lists... Done

Building dependency tree

Reading state information... Done

libncurses5-dev is already the newest version.

libncursesw5-dev is already the newest version.

The following packages were automatically installed and are no longer required:

linux-headers-4.2.0-16 linux-headers-4.2.0-16-generic

linux-image-4.2.0-16-generic linux-image-extra-4.2.0-16-generic

linux-signed-image-4.2.0-16-generic

Use 'apt-get autoremove' to remove them.

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded

                                  ----------

but when i again changed the directory to samtools and given the command for configuring the same issue was there.

                                  ----------
                             ## Output of ./configure ##

ammar@ammar-HP-15-Notebook-PC:~$ cd samtools-1.3.1 ammar@ammar-HP-15-Notebook-PC:~/samtools-1.3.1$ ./configure

checking for gcc... gcc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables...

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 special C compiler options needed for large files... no

checking for _FILE_OFFSET_BITS value needed for large files... no

checking location of HTSlib source tree... htslib-1.3.1

./configure: line 3086: AX_WITH_CURSES: command not found

configure: error: curses development files not found

The 'samtools tview' command uses the curses text user interface library. Building samtools with tview requires curses/ncurses/etc development files to be installed on the build machine; you may need to ensure a package such as libncurses5-dev (on Debian or Ubuntu Linux) or ncurses-devel (on RPM-based Linux distributions) is installed.

FAILED. Either configure --without-curses or resolve this error to build samtools successfully.

                                   ----------
                                   ----------

Anyone who knows please help.

Log in to answer this question.