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