| 1 |
System Requirements |
| 2 |
=================== |
| 3 |
|
| 4 |
Samtools and HTSlib depend on the following libraries: |
| 5 |
|
| 6 |
Samtools: |
| 7 |
zlib <http://zlib.net> |
| 8 |
curses or GNU ncurses (optional, for the 'tview' command) |
| 9 |
<http://www.gnu.org/software/ncurses/> |
| 10 |
|
| 11 |
HTSlib: |
| 12 |
zlib <http://zlib.net> |
| 13 |
libbz2 <http://bzip.org/> |
| 14 |
liblzma <http://tukaani.org/xz/> |
| 15 |
libcurl <https://curl.haxx.se/> |
| 16 |
(optional but strongly recommended, for network access) |
| 17 |
libcrypto <https://www.openssl.org/> |
| 18 |
(optional, for Amazon S3 support; not needed on MacOS) |
| 19 |
libdeflate <https://github.com/ebiggers/libdeflate> |
| 20 |
(optional, but strongly recommended for faster gzip) |
| 21 |
|
| 22 |
See the "System Specific Details" below for guidance on how to install |
| 23 |
these. |
| 24 |
|
| 25 |
The bzip2 and liblzma dependencies can be removed if full CRAM support |
| 26 |
is not needed - see HTSlib's INSTALL file for details. |
| 27 |
|
| 28 |
The following programs are required: |
| 29 |
|
| 30 |
GNU make |
| 31 |
C compiler (e.g. gcc or clang) |
| 32 |
|
| 33 |
In addition, building the configure script requires: |
| 34 |
|
| 35 |
autoheader |
| 36 |
autoconf |
| 37 |
|
| 38 |
Running the configure script uses awk, along with a number of |
| 39 |
standard UNIX tools (cat, cp, grep, mv, rm, sed, among others). Almost |
| 40 |
all installations will have these already. |
| 41 |
|
| 42 |
Running the test harness (make test) uses: |
| 43 |
|
| 44 |
bash |
| 45 |
perl |
| 46 |
|
| 47 |
If you are unsure about this, be sure to use './configure' to determine |
| 48 |
whether you have these libraries and to help diagnose which packages may |
| 49 |
need to be installed on your build machine to provide them. |
| 50 |
|
| 51 |
Building Configure |
| 52 |
================== |
| 53 |
|
| 54 |
This step is only needed if configure.ac has been changed, or if configure |
| 55 |
does not exist (for example, when building from a git clone). The |
| 56 |
configure script and config.h.in can be built by running: |
| 57 |
|
| 58 |
autoheader |
| 59 |
autoconf -Wno-syntax |
| 60 |
|
| 61 |
If you have a full GNU autotools install, you can alternatively run: |
| 62 |
|
| 63 |
autoreconf |
| 64 |
|
| 65 |
When running these tools, you may see warnings about AC_CONFIG_SUBDIRS. |
| 66 |
These are expected, and should be ignored. |
| 67 |
|
| 68 |
Basic Installation |
| 69 |
================== |
| 70 |
|
| 71 |
To build and install Samtools, 'cd' to the samtools-1.x directory containing |
| 72 |
the package's source and type the following commands: |
| 73 |
|
| 74 |
./configure |
| 75 |
make |
| 76 |
make install |
| 77 |
|
| 78 |
The './configure' command checks your build environment and allows various |
| 79 |
optional functionality to be enabled (see Configuration below). If you |
| 80 |
don't want to select any optional functionality, you may wish to omit |
| 81 |
configure and just type 'make; make install' as for previous versions |
| 82 |
of samtools. However if the build fails you should run './configure' |
| 83 |
as it can diagnose the common reasons for build failures. |
| 84 |
|
| 85 |
The 'make' command builds samtools and various miscellaneous utilities. |
| 86 |
If compilation fails you should run './configure' as it can diagnose |
| 87 |
problems with your build environment that cause build failures. |
| 88 |
|
| 89 |
(The bgzip, htsfile, and tabix utilities are provided by HTSlib. If you are |
| 90 |
not also compiling HTSlib separately, you may wish to compile these utilities |
| 91 |
in the associated copy of HTSlib. Type 'make all all-htslib' to do this.) |
| 92 |
|
| 93 |
The 'make install' command installs the samtools executable and various |
| 94 |
scripts and executables from misc/ and a manual page to /usr/local. |
| 95 |
The installation location can be changed by configuring with --prefix=DIR |
| 96 |
or via 'make prefix=DIR install' (see Installation Locations below). |
| 97 |
|
| 98 |
(If you have not also installed HTSlib separately, you may wish to install |
| 99 |
the bgzip, htsfile, and tabix utilities from the associated copy of HTSlib. |
| 100 |
Type 'make install install-htslib' to do this.) |
| 101 |
|
| 102 |
Typically you will want to enable HTSlib's HTTPS/etc plugin etc. |
| 103 |
See README for recipes for typical installation. |
| 104 |
|
| 105 |
|
| 106 |
Configuration |
| 107 |
============= |
| 108 |
|
| 109 |
By default, './configure' examines your build environment, searching for a |
| 110 |
usable HTSlib and checking for requirements such as the curses development |
| 111 |
files, and arranges for a plain samtools build. |
| 112 |
|
| 113 |
This samtools release contains a copy of the HTSlib source code which will |
| 114 |
be used to build samtools. If you already have a system-installed HTSlib |
| 115 |
or another HTSlib that you would prefer to build against, you can arrange |
| 116 |
this via the --with-htslib option. |
| 117 |
|
| 118 |
The following configure options can be used to enable various features and |
| 119 |
specify further optional external requirements: |
| 120 |
|
| 121 |
--with-htslib=DIR |
| 122 |
Specifies the HTSlib source tree or installation directory that samtools |
| 123 |
should use to parse bioinformatics file formats etc. Configure will check |
| 124 |
that DIR appears to contain HTSlib source files or to be the root of an |
| 125 |
installation directory (i.e., it has 'include' and 'lib' subdirectories |
| 126 |
containing HTSlib headers and libraries). |
| 127 |
|
| 128 |
(If the desired HTSlib source tree has been configured to build in a |
| 129 |
separate build directory, DIR should refer to the build directory.) |
| 130 |
|
| 131 |
By default, configure looks for an HTSlib source tree within or alongside |
| 132 |
the samtools source directory; if there are several likely candidates, |
| 133 |
you will have to choose one via this option. |
| 134 |
|
| 135 |
--with-htslib=system |
| 136 |
Ignores any nearby HTSlib source trees, and builds samtools using an |
| 137 |
existing HTSlib installation in a system directory (i.e., a directory |
| 138 |
already being searched by $CPPFLAGS/$LDFLAGS). |
| 139 |
|
| 140 |
--without-curses |
| 141 |
Omit the curses-based 'tview' subcommand from the build. If you do not |
| 142 |
have curses on your build machine or otherwise don't want the interactive |
| 143 |
tview subcommand, this option disables it and skips testing for working |
| 144 |
curses development files. |
| 145 |
|
| 146 |
--enable-configure-htslib |
| 147 |
When building with an HTSlib source tree, run HTSlib's configure script |
| 148 |
as well. HTSlib configure options can also be used and will be |
| 149 |
passed down to the HTSlib configure. See HTSlib's INSTALL documentation |
| 150 |
for details of these options. |
| 151 |
|
| 152 |
If you are building with HTSlib source in a subdirectory of the samtools |
| 153 |
tree, --enable-configure-htslib is turned on by default and the HTSlib |
| 154 |
configure script will be run automatically. This is the case for the |
| 155 |
samtools release tar archives which include an embedded copy of HTSlib. |
| 156 |
|
| 157 |
The configure script also accepts the usual options and environment variables |
| 158 |
for tuning installation locations and compilers: type './configure --help' |
| 159 |
for details. For example, |
| 160 |
|
| 161 |
./configure CC=icc --prefix=/opt/icc-compiled |
| 162 |
|
| 163 |
would specify that samtools is to be built with icc and installed into bin, |
| 164 |
lib, etc subdirectories under /opt/icc-compiled. |
| 165 |
|
| 166 |
If dependencies have been installed in non-standard locations (i.e. not on |
| 167 |
the normal include and library search paths) then the CPPFLAGS and LDFLAGS |
| 168 |
environment variables can be used to set the options needed to find them. |
| 169 |
For example, NetBSD users may use: |
| 170 |
|
| 171 |
./configure CPPFLAGS=-I/usr/pkg/include \ |
| 172 |
LDFLAGS='-L/usr/pkg/lib -Wl,-R/usr/pkg/lib' |
| 173 |
|
| 174 |
to allow compiling and linking against dependencies installed via the ports |
| 175 |
collection. |
| 176 |
|
| 177 |
Installation Locations |
| 178 |
====================== |
| 179 |
|
| 180 |
By default, 'make install' installs samtools and the utilities under |
| 181 |
/usr/local/bin and manual pages under /usr/local/share/man. |
| 182 |
|
| 183 |
You can specify a different location to install Samtools by configuring |
| 184 |
with --prefix=DIR or specify locations for particular parts of HTSlib by |
| 185 |
configuring with --bindir=DIR and so on. Type './configure --help' for |
| 186 |
the full list of such install directory options. |
| 187 |
|
| 188 |
Alternatively you can specify different locations at install time by |
| 189 |
typing 'make prefix=DIR install' or 'make bindir=DIR install' and so on. |
| 190 |
Consult the list of prefix/exec_prefix/etc variables near the top of the |
| 191 |
Makefile for the full list of such variables that can be overridden. |
| 192 |
|
| 193 |
You can also specify a staging area by typing 'make DESTDIR=DIR install', |
| 194 |
possibly in conjunction with other --prefix or prefix=DIR settings. |
| 195 |
For example, |
| 196 |
|
| 197 |
make DESTDIR=/tmp/staging prefix=/opt |
| 198 |
|
| 199 |
would install into bin and share/man subdirectories under /tmp/staging/opt. |
| 200 |
|
| 201 |
|
| 202 |
System Specific Details |
| 203 |
======================= |
| 204 |
|
| 205 |
Installing the prerequisites is system dependent and there is more |
| 206 |
than one correct way of satisfying these, including downloading them |
| 207 |
from source, compiling and installing them yourself. |
| 208 |
|
| 209 |
For people with super-user access, we provide an example set of commands |
| 210 |
below for installing the dependencies on a variety of operating system |
| 211 |
distributions. Note these are not specific recommendations on distribution, |
| 212 |
compiler or SSL implementation. It is assumed you already have the core set |
| 213 |
of packages for the given distribution - the lists may be incomplete if |
| 214 |
this is not the case. |
| 215 |
|
| 216 |
Debian / Ubuntu |
| 217 |
--------------- |
| 218 |
|
| 219 |
sudo apt-get update # Ensure the package list is up to date |
| 220 |
sudo apt-get install autoconf automake make gcc perl zlib1g-dev libbz2-dev liblzma-dev libcurl4-gnutls-dev libssl-dev libncurses5-dev libdeflate-dev |
| 221 |
|
| 222 |
Note: libcurl4-openssl-dev can be used as an alternative to libcurl4-gnutls-dev. |
| 223 |
|
| 224 |
RedHat / CentOS |
| 225 |
--------------- |
| 226 |
|
| 227 |
sudo yum install autoconf automake make gcc perl-Data-Dumper zlib-devel bzip2 bzip2-devel xz-devel curl-devel openssl-devel ncurses-devel libdeflate-devel |
| 228 |
|
| 229 |
Note: On some versions, Perl FindBin will need to be installed to make the tests work. |
| 230 |
|
| 231 |
sudo yum install perl-FindBin |
| 232 |
|
| 233 |
Alpine Linux |
| 234 |
------------ |
| 235 |
|
| 236 |
doas apk update # Ensure the package list is up to date |
| 237 |
doas apk add autoconf automake make gcc musl-dev perl bash zlib-dev bzip2-dev xz-dev curl-dev openssl-dev ncurses-dev |
| 238 |
|
| 239 |
Ideally also install a copy of libdeflate-dev for faster (de)compression. |
| 240 |
This can be found in the Alpine community repository. |
| 241 |
|
| 242 |
Note: some older Alpine versions use libressl-dev rather than openssl-dev. |
| 243 |
|
| 244 |
OpenSUSE |
| 245 |
-------- |
| 246 |
|
| 247 |
sudo zypper install autoconf automake make gcc perl zlib-devel libbz2-devel xz-devel libcurl-devel libopenssl-devel ncurses-devel |
| 248 |
|
| 249 |
Also install libdeflate-devel, available on OpenSUSE Leap 15.4 onwards |
| 250 |
or directly via git releases above. |
| 251 |
|
| 252 |
Windows MSYS2/MINGW64 |
| 253 |
--------------------- |
| 254 |
|
| 255 |
The configure script must be used as without it the compilation will |
| 256 |
likely fail. |
| 257 |
|
| 258 |
Follow MSYS2 installation instructions at |
| 259 |
https://www.msys2.org/wiki/MSYS2-installation/ |
| 260 |
|
| 261 |
Then relaunch to MSYS2 shell using the "MSYS2 MinGW x64" executable. |
| 262 |
Once in that environment (check $MSYSTEM equals "MINGW64") install the |
| 263 |
compilers using pacman -S and the following package list: |
| 264 |
|
| 265 |
base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-libdeflate |
| 266 |
mingw-w64-x86_64-zlib mingw-w64-x86_64-bzip2 mingw-w64-x86_64-xz |
| 267 |
mingw-w64-x86_64-curl mingw-w64-x86_64-autotools |
| 268 |
mingw-w64-x86_64-ncurses mingw-w64-x86_64-tools-git |
| 269 |
|
| 270 |
(The last is only needed for building libraries compatible with MSVC.) |