xref: /netbsd-src/external/public-domain/xz/dist/INSTALL (revision 288bb96063654ec504ca8732afc683d3ebc514b5)
1
2XZ Utils Installation
3=====================
4
5    0. Preface
6    1. Supported platforms
7       1.1. Compilers
8       1.2. Platform-specific notes
9            1.2.1. IRIX
10            1.2.2. MINIX 3
11            1.2.3. OpenVMS
12            1.2.4. Tru64
13            1.2.5. Windows
14            1.2.6. DOS
15       1.3. Adding support for new platforms
16    2. configure options
17       2.1. Static vs. dynamic linking of liblzma
18       2.2. Optimizing xzdec and lzmadec
19    3. xzgrep and other scripts
20       3.1. Dependencies
21       3.2. PATH
22    4. Troubleshooting
23       4.1. "No C99 compiler was found."
24       4.2. "No POSIX conforming shell (sh) was found."
25       4.3. configure works but build fails at crc32_x86.S
26       4.4. Lots of warnings about symbol visibility
27
28
290. Preface
30----------
31
32    If you aren't familiar with building packages that use GNU Autotools,
33    see the file INSTALL.generic for generic instructions before reading
34    further.
35
36    If you are going to build a package for distribution, see also the
37    file PACKAGERS. It contains information that should help making the
38    binary packages as good as possible, but the information isn't very
39    interesting to those making local builds for private use or for use
40    in special situations like embedded systems.
41
42
431. Supported platforms
44----------------------
45
46    XZ Utils are developed on GNU/Linux, but they should work on many
47    POSIX-like operating systems like *BSDs and Solaris, and even on
48    a few non-POSIX operating systems.
49
50
511.1. Compilers
52
53    A C99 compiler is required to compile XZ Utils. If you use GCC, you
54    need at least version 3.x.x. GCC version 2.xx.x doesn't support some
55    C99 features used in XZ Utils source code, thus GCC 2 won't compile
56    XZ Utils.
57
58    XZ Utils takes advantage of some GNU C extensions when building
59    with GCC. Because these extensions are used only when building
60    with GCC, it should be possible to use any C99 compiler.
61
62
631.2. Platform-specific notes
64
651.2.1. IRIX
66
67    MIPSpro 7.4.4m has been reported to produce broken code if using
68    the -O2 optimization flag ("make check" fails). Using -O1 should
69    work.
70
71
721.2.2. MINIX 3
73
74    The default install of MINIX 3 includes Amsterdam Compiler Kit (ACK),
75    which doesn't support C99. Install GCC to compile XZ Utils.
76
77    MINIX 3.1.8 (and possibly some other versions too) has bugs in
78    /usr/include/stdint.h, which has to be patched before XZ Utils
79    can be compiled correctly. See
80    <http://gforge.cs.vu.nl/gf/project/minix/tracker/?action=TrackerItemEdit&tracker_item_id=537>.
81
82    XZ Utils doesn't have code to detect the amount of physical RAM and
83    number of CPU cores on MINIX 3.
84
85    See section 4.4 in this file about symbol visibility warnings (you
86    may want to pass gl_cv_cc_visibility=no to configure).
87
88
891.2.3. OpenVMS
90
91    XZ Utils can be built for OpenVMS, but the build system files
92    are not included in the XZ Utils source package. The required
93    OpenVMS-specific files are maintained by Jouk Jansen and can be
94    downloaded here:
95
96        http://nchrem.tnw.tudelft.nl/openvms/software2.html#xzutils
97
98
991.2.4. Tru64
100
101    If you try to use the native C compiler on Tru64 (passing CC=cc to
102    configure), you may need the workaround mention in section 4.1 in
103    this file (pass also ac_cv_prog_cc_c99= to configure).
104
105
1061.2.5. Windows
107
108    Building XZ Utils on Windows is supported under MinGW + MSYS,
109    MinGW-w64 + MSYS, and Cygwin. There is windows/build.bash to
110    ease packaging XZ Utils with MinGW(-w64) + MSYS into a
111    redistributable .zip or .7z file. See windows/INSTALL-Windows.txt
112    for more information.
113
114    It might be possible to build liblzma with a non-GNU toolchain too,
115    but that will probably require writing a separate makefile. Building
116    the command line tools with non-GNU toolchains will be harder than
117    building only liblzma.
118
119    Even if liblzma is built with MinGW, the resulting DLL or static
120    library can be used by other compilers and linkers, including MSVC.
121    Thus, it shouldn't be a problem to use MinGW to build liblzma even
122    if you cannot use MinGW to build the rest of your project. See
123    windows/README-Windows.txt for details.
124
125
1261.2.6. DOS
127
128    There is an experimental Makefile in the "dos" directory to build
129    XZ Utils on DOS using DJGPP. Support for long file names (LFN) is
130    needed. See dos/README for more information.
131
132    GNU Autotools based build hasn't been tried on DOS. If you try, I
133    would like to hear if it worked.
134
135
1361.3. Adding support for new platforms
137
138    If you have written patches to make XZ Utils to work on previously
139    unsupported platform, please send the patches to me! I will consider
140    including them to the official version. It's nice to minimize the
141    need of third-party patching.
142
143    One exception: Don't request or send patches to change the whole
144    source package to C89. I find C99 substantially nicer to write and
145    maintain. However, the public library headers must be in C89 to
146    avoid frustrating those who maintain programs, which are strictly
147    in C89 or C++.
148
149
1502. configure options
151--------------------
152
153    In most cases, the defaults are what you want. Many of the options
154    below are useful only when building a size-optimized version of
155    liblzma or command line tools.
156
157    --enable-encoders=LIST
158    --disable-encoders
159                Specify a comma-separated LIST of filter encoders to
160                build. See "./configure --help" for exact list of
161                available filter encoders. The default is to build all
162                supported encoders.
163
164                If LIST is empty or --disable-encoders is used, no filter
165                encoders will be built and also the code shared between
166                encoders will be omitted.
167
168                Disabling encoders will remove some symbols from the
169                liblzma ABI, so this option should be used only when it
170                is known to not cause problems.
171
172    --enable-decoders=LIST
173    --disable-decoders
174                This is like --enable-encoders but for decoders. The
175                default is to build all supported decoders.
176
177    --enable-match-finders=LIST
178                liblzma includes two categories of match finders:
179                hash chains and binary trees. Hash chains (hc3 and hc4)
180                are quite fast but they don't provide the best compression
181                ratio. Binary trees (bt2, bt3 and bt4) give excellent
182                compression ratio, but they are slower and need more
183                memory than hash chains.
184
185                You need to enable at least one match finder to build the
186                LZMA1 or LZMA2 filter encoders. Usually hash chains are
187                used only in the fast mode, while binary trees are used to
188                when the best compression ratio is wanted.
189
190                The default is to build all the match finders if LZMA1
191                or LZMA2 filter encoders are being built.
192
193    --enable-checks=LIST
194                liblzma support multiple integrity checks. CRC32 is
195                mandatory, and cannot be omitted. See "./configure --help"
196                for exact list of available integrity check types.
197
198                liblzma and the command line tools can decompress files
199                which use unsupported integrity check type, but naturally
200                the file integrity cannot be verified in that case.
201
202                Disabling integrity checks may remove some symbols from
203                the liblzma ABI, so this option should be used only when
204                it is known to not cause problems.
205
206    --disable-xz
207    --disable-xzdec
208    --disable-lzmadec
209    --disable-lzmainfo
210                Don't build and install the command line tool mentioned
211                in the option name.
212
213                NOTE: Disabling xz will skip some tests in "make check".
214
215                NOTE: If xzdec is disabled and lzmadec is left enabled,
216                a dangling man page symlink lzmadec.1 -> xzdec.1 is
217                created.
218
219    --disable-lzma-links
220                Don't create symlinks for LZMA Utils compatibility.
221                This includes lzma, unlzma, and lzcat. If scripts are
222                installed, also lzdiff, lzcmp, lzgrep, lzegrep, lzfgrep,
223                lzmore, and lzless will be omitted if this option is used.
224
225    --disable-scripts
226                Don't install the scripts xzdiff, xzgrep, xzmore, xzless,
227                and their symlinks.
228
229    --disable-assembler
230                liblzma includes some assembler optimizations. Currently
231                there is only assembler code for CRC32 and CRC64 for
232                32-bit x86.
233
234                All the assembler code in liblzma is position-independent
235                code, which is suitable for use in shared libraries and
236                position-independent executables. So far only i386
237                instructions are used, but the code is optimized for i686
238                class CPUs. If you are compiling liblzma exclusively for
239                pre-i686 systems, you may want to disable the assembler
240                code.
241
242    --enable-unaligned-access
243                Allow liblzma to use unaligned memory access for 16-bit
244                and 32-bit loads and stores. This should be enabled only
245                when the hardware supports this, i.e. when unaligned
246                access is fast. Some operating system kernels emulate
247                unaligned access, which is extremely slow. This option
248                shouldn't be used on systems that rely on such emulation.
249
250                Unaligned access is enabled by default on x86, x86-64,
251                and big endian PowerPC.
252
253    --enable-small
254                Reduce the size of liblzma by selecting smaller but
255                semantically equivalent version of some functions, and
256                omit precomputed lookup tables. This option tends to
257                make liblzma slightly slower.
258
259                Note that while omitting the precomputed tables makes
260                liblzma smaller on disk, the tables are still needed at
261                run time, and need to be computed at startup. This also
262                means that the RAM holding the tables won't be shared
263                between applications linked against shared liblzma.
264
265                This option doesn't modify CFLAGS to tell the compiler
266                to optimize for size. You need to add -Os or equivalent
267                flag(s) to CFLAGS manually.
268
269    --enable-assume-ram=SIZE
270                On the most common operating systems, XZ Utils is able to
271                detect the amount of physical memory on the system. This
272                information is used by the options --memlimit-compress,
273                --memlimit-decompress, and --memlimit when setting the
274                limit to a percentage of total RAM.
275
276                On some systems, there is no code to detect the amount of
277                RAM though. Using --enable-assume-ram one can set how much
278                memory to assume on these systems. SIZE is given as MiB.
279                The default is 128 MiB.
280
281                Feel free to send patches to add support for detecting
282                the amount of RAM on the operating system you use. See
283                src/common/tuklib_physmem.c for details.
284
285    --disable-threads
286                Disable threading support. This makes some things
287                thread-unsafe, meaning that if multithreaded application
288                calls liblzma functions from more than one thread,
289                something bad may happen.
290
291                Use this option if threading support causes you trouble,
292                or if you know that you will use liblzma only from
293                single-threaded applications and want to avoid dependency
294                on libpthread.
295
296    --enable-debug
297                This enables the assert() macro and possibly some other
298                run-time consistency checks. It makes the code slower, so
299                you normally don't want to have this enabled.
300
301    --enable-werror
302                If building with GCC, make all compiler warnings an error,
303                that abort the compilation. This may help catching bugs,
304                and should work on most systems. This has no effect on the
305                resulting binaries.
306
307
3082.1. Static vs. dynamic linking of liblzma
309
310    On 32-bit x86, linking against static liblzma can give a minor
311    speed improvement. Static libraries on x86 are usually compiled as
312    position-dependent code (non-PIC) and shared libraries are built as
313    position-independent code (PIC). PIC wastes one register, which can
314    make the code slightly slower compared to a non-PIC version. (Note
315    that this doesn't apply to x86-64.)
316
317    If you want to link xz against static liblzma, the simplest way
318    is to pass --disable-shared to configure. If you want also shared
319    liblzma, run configure again and run "make install" only for
320    src/liblzma.
321
322
3232.2. Optimizing xzdec and lzmadec
324
325    xzdec and lzmadec are intended to be relatively small instead of
326    optimizing for the best speed. Thus, it is a good idea to build
327    xzdec and lzmadec separately:
328
329      - To link the tools against static liblzma, pass --disable-shared
330        to configure.
331
332      - To select somewhat size-optimized variant of some things in
333        liblzma, pass --enable-small to configure.
334
335      - Tell the compiler to optimize for size instead of speed.
336        E.g. with GCC, put -Os into CFLAGS.
337
338      - xzdec and lzmadec will never use multithreading capabilities of
339        liblzma. You can avoid dependency on libpthread by passing
340        --disable-threads to configure.
341
342      - There are and will be no translated messages for xzdec and
343        lzmadec, so it is fine to pass also --disable-nls to configure.
344
345      - Only decoder code is needed, so you can speed up the build
346        slightly by passing --disable-encoders to configure. This
347        shouldn't affect the final size of the executables though,
348        because the linker is able to omit the encoder code anyway.
349
350    If you have no use for xzdec or lzmadec, you can disable them with
351    --disable-xzdec and --disable-lzmadec.
352
353
3543. xzgrep and other scripts
355---------------------------
356
3573.1. Dependencies
358
359    POSIX shell (sh) and bunch of other standard POSIX tools are required
360    to run the scripts. The configure script tries to find a POSIX
361    compliant sh, but if it fails, you can force the shell by passing
362    gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
363    script.
364
365    Some of the scripts require also mktemp. The original mktemp can be
366    found from <http://www.mktemp.org/>. On GNU, most will use the mktemp
367    program from GNU coreutils instead of the original implementation.
368    Both mktemp versions are fine for XZ Utils (and practically for
369    everything else too).
370
371
3723.2. PATH
373
374    The scripts assume that the required tools (standard POSIX utilities,
375    mktemp, and xz) are in PATH; the scripts don't set the PATH themselves.
376    Some people like this while some think this is a bug. Those in the
377    latter group can easily patch the scripts before running the configure
378    script by taking advantage of a placeholder line in the scripts.
379
380    For example, to make the scripts prefix /usr/bin:/bin to PATH:
381
382        perl -pi -e 's|^#SET_PATH.*$|PATH=/usr/bin:/bin:\$PATH|' \
383                src/scripts/xz*.in
384
385
3864. Troubleshooting
387------------------
388
3894.1. "No C99 compiler was found."
390
391    You need a C99 compiler to build XZ Utils. If the configure script
392    cannot find a C99 compiler and you think you have such a compiler
393    installed, set the compiler command by passing CC=/path/to/c99 as
394    an argument to the configure script.
395
396    If you get this error even when you think your compiler supports C99,
397    you can override the test by passing ac_cv_prog_cc_c99= as an argument
398    to the configure script. The test for C99 compiler is not perfect (and
399    it is not as easy to make it perfect as it sounds), so sometimes this
400    may be needed. You will get a compile error if your compiler doesn't
401    support enough C99.
402
403
4044.2. "No POSIX conforming shell (sh) was found."
405
406    xzgrep and other scripts need a shell that (roughly) conforms
407    to POSIX. The configure script tries to find such a shell. If
408    it fails, you can force the shell to be used by passing
409    gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
410    script.
411
412
4134.3. configure works but build fails at crc32_x86.S
414
415    The easy fix is to pass --disable-assembler to the configure script.
416
417    The configure script determines if assembler code can be used by
418    looking at the configure triplet; there is currently no check if
419    the assembler code can actually actually be built. The x86 assembler
420    code should work on x86 GNU/Linux, *BSDs, Solaris, Darwin, MinGW,
421    Cygwin, and DJGPP. On other x86 systems, there may be problems and
422    the assembler code may need to be disabled with the configure option.
423
424    If you get this error when building for x86-64, you have specified or
425    the configure script has misguessed your architecture. Pass the
426    correct configure triplet using the --build=CPU-COMPANY-SYSTEM option
427    (see INSTALL.generic).
428
429
4304.4. Lots of warnings about symbol visibility
431
432    On some systems where symbol visibility isn't supported, GCC may
433    still accept the visibility options and attributes, which will make
434    configure think that visibility is supported. This will result in
435    many compiler warnings. You can avoid the warnings by forcing the
436    visibility support off by passing gl_cv_cc_visibility=no as an
437    argument to the configure script. This has no effect on the
438    resulting binaries, but fewer warnings looks nicer and may allow
439    using --enable-werror.
440
441