-
Notifications
You must be signed in to change notification settings - Fork 443
/
INSTALL
358 lines (257 loc) · 13.6 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
Building and Installing HTSlib
==============================
Requirements
============
Building HTSlib requires a few programs and libraries to be present.
See the "System Specific Details" below for guidance on how to install
these.
At least the following are required:
GNU make
C compiler (e.g. gcc or clang)
In addition, building the configure script requires:
autoheader
autoconf
autoreconf
Running the configure script uses awk, along with a number of
standard UNIX tools (cat, cp, grep, mv, rm, sed, among others). Almost
all installations will have these already.
Running the test harness (make test) uses:
bash
perl
HTSlib uses the following external libraries. Building requires both the
library itself, and include files needed to compile code that uses functions
from the library. Note that some Linux distributions put include files in
a development ('-dev' or '-devel') package separate from the main library.
zlib (required)
libbz2 (required, unless configured with --disable-bz2)
liblzma (required, unless configured with --disable-lzma)
libcurl (optional, but strongly recommended)
libcrypto (optional for Amazon S3 support; not needed on MacOS)
libdeflate (optional, but strongly recommended for faster gzip)
Disabling libbzip2 and liblzma will make some CRAM files unreadable, so
is not recommended.
Using libcurl provides HTSlib with network protocol support, for
example it enables the use of ftp://, http://, and https:// URLs.
It is also required if direct access to Amazon S3 or Google Cloud
Storage is enabled.
Amazon S3 support requires an HMAC function to calculate a message
authentication code. On MacOS, the CCHmac function from the standard
library is used. Systems that do not have CCHmac will get this from
libcrypto. libcrypto is part of OpenSSL or one of its derivatives (LibreSSL
or BoringSSL).
On Microsoft Windows we recommend use of Mingw64/Msys2. Whilst the
code may work on Windows with other environments, these have not been
verified. Use of the configure script is a requirement too.
Update htscodecs submodule
==========================
Note that this section only applies to git checkouts. If you're building
from a release tar file, you can skip this section.
Some parts of HTSlib are provided by the external "htscodecs" project. This
is included as a submodule. When building from the git repository,
either clone the project using "git clone --recurse-submodules", or run:
git submodule update --init --recursive
to ensure the correct version of the submodule is present.
It is also possible to link against an external libhtscodecs library
by using the '--with-external-htscodecs' configure option. When
this is used, the submodule files will be ignored.
Building Configure
==================
This step is only needed if configure.ac has been changed, or if configure
does not exist (for example, when building from a git clone). The
configure script and config.h.in can be built by running:
autoreconf -i
Basic Installation
==================
To build and install HTSlib, 'cd' to the htslib-1.x directory containing
the package's source and type the following commands:
./configure
make
make install
The './configure' command checks your build environment and allows various
optional functionality to be enabled (see Configuration below). If you
don't want to select any optional functionality, you may wish to omit
configure and just type 'make; make install' as for previous versions
of HTSlib. However if the build fails you should run './configure' as
it can diagnose the common reasons for build failures.
The 'make' command builds the HTSlib library and various useful
utilities: bgzip, htsfile, and tabix. If compilation fails you should
run './configure' as it can diagnose problems with your build environment
that cause build failures.
The 'make install' command installs the libraries, library header files,
utilities, several manual pages, and a pkgconfig file to /usr/local.
The installation location can be changed by configuring with --prefix=DIR
or via 'make prefix=DIR install' (see Installation Locations below).
Shared library permissions can be set via e.g. 'make install LIB_PERM=755'.
Configuration
=============
By default, './configure' examines your build environment, checking for
requirements such as the zlib development files, and arranges for a plain
HTSlib build. The following configure options can be used to enable
various features and specify further optional external requirements:
--enable-plugins
Use plugins to implement exotic file access protocols and other
specialised facilities. This enables such facilities to be developed
and packaged outwith HTSlib, and somewhat isolates HTSlib-using programs
from their library dependencies. By default (or with --disable-plugins),
any enabled pluggable facilities (such as libcurl file access) are built
directly within HTSlib.
Programs that are statically linked to a libhts.a with plugins enabled
need to be linked using -rdynamic or a similar linker option.
The <https://github.com/samtools/htslib-plugins> repository contains
several additional plugins, including the iRODS (<http://irods.org/>)
file access plugin previously distributed with HTSlib.
--with-plugin-dir=DIR
Specifies the directory into which plugins built while building HTSlib
should be installed; by default, LIBEXECDIR/htslib.
--with-plugin-path=DIR:DIR:DIR...
Specifies the list of directories that HTSlib will search for plugins.
By default, only the directory specified via --with-plugin-dir will be
searched; you can use --with-plugin-path='DIR:$(plugindir):DIR' and so
on to cause additional directories to be searched.
--with-external-htscodecs
Build and link against an external copy of the htscodecs library
instead of using the source files in the htscodecs directory.
--enable-libcurl
Use libcurl (<http://curl.se/>) to implement network access to
remote files via FTP, HTTP, HTTPS, etc. By default or with
--enable-libcurl=check, configure will probe for libcurl and include
this functionality if libcurl is available. Use --disable-libcurl
to prevent this.
--enable-gcs
Implement network access to Google Cloud Storage. By default or with
--enable-gcs=check, this is enabled when libcurl is enabled.
--enable-s3
Implement network access to Amazon AWS S3. By default or with
--enable-s3=check, this is enabled when libcurl is enabled.
--disable-bz2
Bzip2 is an optional compression codec format for CRAM, included
in HTSlib by default. It can be disabled with --disable-bz2, but
be aware that not all CRAM files may be possible to decode.
--disable-lzma
LZMA is an optional compression codec for CRAM, included in HTSlib
by default. It can be disabled with --disable-lzma, but be aware
that not all CRAM files may be possible to decode.
--with-libdeflate
Libdeflate is a heavily optimized library for DEFLATE-based compression
and decompression. It also includes a fast crc32 implementation.
By default, ./configure will probe for libdeflate and use it if
available. To prevent this, use --without-libdeflate.
Each --enable-FEATURE/--disable-FEATURE/--with-PACKAGE/--without-PACKAGE
option listed also has an opposite, e.g., --without-external-htscodecs
or --disable-plugins. However, apart from those options for which the
default is to probe for related facilities, using these opposite options
is mostly unnecessary as they just select the default configure behaviour.
The configure script also accepts the usual options and environment variables
for tuning installation locations and compilers: type './configure --help'
for details. For example,
./configure CC=icc --prefix=/opt/icc-compiled
would specify that HTSlib is to be built with icc and installed into bin,
lib, etc subdirectories under /opt/icc-compiled.
If dependencies have been installed in non-standard locations (i.e. not on
the normal include and library search paths) then the CPPFLAGS and LDFLAGS
environment variables can be used to set the options needed to find them.
For example, NetBSD users may use:
./configure CPPFLAGS=-I/usr/pkg/include \
LDFLAGS='-L/usr/pkg/lib -Wl,-R/usr/pkg/lib'
to allow compiling and linking against dependencies installed via the ports
collection.
Installation Locations
======================
By default, 'make install' installs HTSlib libraries under /usr/local/lib,
HTSlib header files under /usr/local/include, utility programs under
/usr/local/bin, etc. (To be precise, the header files are installed within
a fixed 'htslib' subdirectory under the specified .../include location.)
You can specify a different location to install HTSlib by configuring
with --prefix=DIR or specify locations for particular parts of HTSlib by
configuring with --libdir=DIR and so on. Type './configure --help' for
the full list of such install directory options.
Alternatively you can specify different locations at install time by
typing 'make prefix=DIR install' or 'make libdir=DIR install' and so on.
Consult the list of prefix/exec_prefix/etc variables near the top of the
Makefile for the full list of such variables that can be overridden.
You can also specify a staging area by typing 'make DESTDIR=DIR install',
possibly in conjunction with other --prefix or prefix=DIR settings.
For example,
make DESTDIR=/tmp/staging prefix=/opt
would install into bin, lib, etc subdirectories under /tmp/staging/opt.
System Specific Details
=======================
Installing the prerequisites is system dependent and there is more
than one correct way of satisfying these, including downloading them
from source, compiling and installing them yourself.
For people with super-user access, we provide an example set of commands
below for installing the dependencies on a variety of operating system
distributions. Note these are not specific recommendations on distribution,
compiler or SSL implementation. It is assumed you already have the core set
of packages for the given distribution - the lists may be incomplete if
this is not the case.
Debian / Ubuntu
---------------
sudo apt-get update # Ensure the package list is up to date
sudo apt-get install autoconf automake make gcc perl zlib1g-dev libbz2-dev liblzma-dev libcurl4-gnutls-dev libssl-dev libdeflate-dev
Note: libcurl4-openssl-dev can be used as an alternative to libcurl4-gnutls-dev.
RedHat / CentOS
---------------
sudo yum install autoconf automake make gcc perl-Data-Dumper zlib-devel bzip2 bzip2-devel xz-devel curl-devel openssl-devel libdeflate-devel
Note: On some versions perl FindBin will need to be installed to make the tests work.
sudo yum install perl-FindBin
Alpine Linux
------------
doas apk update # Ensure the package list is up to date
doas apk add autoconf automake make gcc musl-dev perl bash zlib-dev bzip2-dev xz-dev curl-dev openssl-dev
Ideally also install a copy of libdeflate-dev for faster (de)compression.
This can be found in the Alpine community repository.
Note: some older Alpine versions use libressl-dev rather than openssl-dev.
OpenSUSE
--------
sudo zypper install autoconf automake make gcc perl zlib-devel libbz2-devel xz-devel libcurl-devel libopenssl-devel
Also install libdeflate-devel, available on OpenSUSE Leap 15.4 onwards
or directly via git releases above.
FreeBSD
-------
As root:
pkg install autoconf automake bash curl gmake libdeflate perl5
Build as a normal user. When building, compiler flags need to be set so that
the packages installed above are found. It is also necessary to use "gmake":
./configure CPPFLAGS='-I/usr/local/include' LDFLAGS='-L/usr/local/lib -Wl,-R/usr/local/lib'
gmake && gmake check
NetBSD
------
Make sure you have installed the "comp" file set to get a compiler, then
get the following packages as root:
pkg_add autoconf automake bash curl gmake libdeflate perl
Build as a normal user. When building, compiler flags need to be set so that
the packages installed above are found. It is also necessary to use "gmake":
./configure CPPFLAGS='-I/usr/pkg/include' LDFLAGS='-L/usr/pkg/lib -Wl,-R/usr/pkg/lib'
gmake && gmake check
OpenBSD
-------
Make sure you have installed the "comp" file set to get a compiler, then
get the following packages as root:
pkg_add autoconf automake bash bzip2 curl gmake libdeflate xz
You should select the most recent versions of autoconf and automake if asked.
Build as a normal user. When building, compiler flags need to be set so that
the packages installed above are found. It is also necessary to use "gmake":
./configure CPPFLAGS='-I/usr/local/include' LDFLAGS='-L/usr/local/lib -Wl,-R/usr/local/lib'
gmake && gmake check
Windows MSYS2/MINGW64
---------------------
The configure script must be used as without it the compilation will
likely fail.
Follow MSYS2 installation instructions at
https://www.msys2.org/wiki/MSYS2-installation/
Then relaunch to MSYS2 shell using the "MSYS2 MinGW x64" executable.
Once in that environment (check $MSYSTEM equals "MINGW64") install the
compilers using pacman -S and the following package list:
base-devel mingw-w64-x86_64-toolchain
mingw-w64-x86_64-libdeflate mingw-w64-x86_64-zlib mingw-w64-x86_64-bzip2
mingw-w64-x86_64-xz mingw-w64-x86_64-curl mingw-w64-x86_64-autotools
mingw-w64-x86_64-tools-git
(The last is only needed for building libraries compatible with MSVC.)
HP-UX
-----
HP-UX requires that shared libraries have execute permission. The
default for HTSlib is to install with permission 644 (read-write for
owner and read-only for group / other). This can be overridden by
setting the LIB_PERM variable at install time with:
make install LIB_PERM=755