1
2
XZ 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. Darwin (Mac OS X)
10
            1.2.2. Tru64
11
            1.2.3. Windows
12
            1.2.4. DOS
13
            1.2.5. OS/2
14
            1.2.6. OpenVMS
15
       1.3. Adding support for new platforms
16
    2. configure options
17
    3. xzgrep and other scripts
18
       3.1. Dependencies
19
       3.2. PATH
20
    4. Troubleshooting
21
       4.1. "No C99 compiler was found."
22
       4.1. "No POSIX conforming shell (sh) was found."
23
       4.2. configure works but build fails at crc32_x86.S
24
25
26
0. Preface
27
----------
28
29
    If you aren't familiar with building packages that use GNU Autotools,
30
    see the file INSTALL.generic for generic instructions before reading
31
    further.
32
33
    If you are going to build a package for distribution, see also the
34
    file PACKAGERS. It contains information that should help making the
35
    binary packages as good as possible, but the information isn't very
36
    interesting to those making local builds for private use or for use
37
    in special situations like embedded systems.
38
39
40
1. Supported platforms
41
----------------------
42
43
    XZ Utils are developed on GNU/Linux, but they should work on many
44
    POSIX-like operating systems like *BSDs and Solaris, and even on
45
    a few non-POSIX operating systems.
46
47
48
1.1. Compilers
49
50
    A C99 compiler is required to compile XZ Utils. If you use GCC, you
51
    need at least version 3.x.x. GCC version 2.xx.x doesn't support some
52
    C99 features used in XZ Utils source code, thus GCC 2 won't compile
53
    XZ Utils.
54
55
    XZ Utils takes advantage of some GNU C extensions when building
56
    with GCC. Because these extensions are used only when building
57
    with GCC, it should be possible to use any C99 compiler.
58
59
60
1.2. Platform-specific notes
61
62
1.2.1. Darwin (Mac OS X)
63
64
    You may need --disable-assembler if building universal binaries on
65
    Darwin. This is because different files are built when assembler is
66
    enabled, and there's no way to make it work with universal build.
67
    If you want to keep the assembler code, consider building one
68
    architecture at a time, and then combining the results to create
69
    universal binaries (see lipo(1)).
70
71
72
1.2.2. Tru64
73
74
    If you try to use the native C compiler on Tru64 (passing CC=cc to
75
    configure), it is possible that the configure script will complain
76
    that no C99 compiler was found even when the native compiler supports
77
    C99. You can safely override the test for C99 compiler by passing
78
    ac_cv_prog_cc_c99= as the argument to the configure script.
79
80
81
1.2.3. Windows
82
83
    Building XZ Utils on Windows is supported under MinGW and Cygwin.
84
    If the Autotools based build gives you trouble with MinGW, you may
85
    want try the alternative method found from the "windows" directory.
86
87
    MSVC doesn't support C99, thus it is not possible to use MSVC to
88
    compile XZ Utils. However, it is possible to use liblzma.dll from
89
    MSVC once liblzma.dll has been built with MinGW. The required
90
    import library for MSVC can be created from liblzma.def using the
91
    "lib" command shipped in MSVC:
92
93
        lib /def:liblzma.def /out:liblzma.lib /machine:ix86
94
95
    On x86-64, the /machine argument has to naturally be changed:
96
97
        lib /def:liblzma.def /out:liblzma.lib /machine:x64
98
99
100
1.2.4. DOS
101
102
    There is an experimental Makefile in the "dos" directory to build
103
    XZ Utils on DOS using DJGPP. Support for long file names (LFN) is
104
    needed.
105
106
    GNU Autotools based build hasn't been tried on DOS.
107
108
109
1.2.5. OS/2
110
111
    You will need to pass --disable-assembler to configure when building
112
    on OS/2.
113
114
    To omit large number of harmless warnings about visibility support,
115
    pass gl_cv_cc_visibility=no as an argument to the configure script.
116
    This isn't mandatory since it should have no effect on the resulting
117
    binaries.
118
119
120
1.2.6. OpenVMS
121
122
    XZ Utils can be built for OpenVMS, but the build system files are
123
    currently not included in the XZ Utils source package. The required
124
    OpenVMS-specific files are maintained by Jouk Jansen and can be
125
    downloaded here:
126
127
        http://nchrem.tnw.tudelft.nl/openvms/software2.html#xzutils
128
129
130
1.3. Adding support for new platforms
131
132
    If you have written patches to make XZ Utils to work on previously
133
    unsupported platform, please send the patches to me! I will consider
134
    including them to the official version. It's nice to minimize the
135
    need of third-party patching.
136
137
    One exception: Don't request or send patches to change the whole
138
    source package to C89. I find C99 substantially nicer to write and
139
    maintain. However, the public library headers must be in C89 to
140
    avoid frustrating those who maintain programs, which are strictly
141
    in C89 or C++.
142
143
144
2. configure options
145
--------------------
146
147
    In most cases, the defaults are what you want. Most of the options
148
    below are useful only when building a size-optimized version of
149
    liblzma or command line tools.
150
151
    --enable-encoders=LIST
152
    --disable-encoders
153
                Specify a comma-separated LIST of filter encoders to
154
                build. See "./configure --help" for exact list of
155
                available filter encoders. The default is to build all
156
                supported encoders.
157
158
                If LIST is empty or --disable-encoders is used, no filter
159
                encoders will be built and also the code shared between
160
                encoders will be omitted.
161
162
                Disabling encoders will remove some symbols from the
163
                liblzma ABI, so this option should be used only when it
164
                is known to not cause problems.
165
166
    --enable-decoders=LIST
167
    --disable-decoders
168
                This is like --enable-encoders but for decoders. The
169
                default is to build all supported decoders.
170
171
    --enable-match-finders=LIST
172
                liblzma includes two categories of match finders:
173
                hash chains and binary trees. Hash chains (hc3 and hc4)
174
                are quite fast but they don't provide the best compression
175
                ratio. Binary trees (bt2, bt3 and bt4) give excellent
176
                compression ratio, but they are slower and need more
177
                memory than hash chains.
178
179
                You need to enable at least one match finder to build the
180
                LZMA1 or LZMA2 filter encoders. Usually hash chains are
181
                used only in the fast mode, while binary trees are used to
182
                when the best compression ratio is wanted.
183
184
                The default is to build all the match finders if LZMA1
185
                or LZMA2 filter encoders are being built.
186
187
    --enable-checks=LIST
188
                liblzma support multiple integrity checks. CRC32 is
189
                mandatory, and cannot be omitted. See "./configure --help"
190
                for exact list of available integrity check types.
191
192
                liblzma and the command line tools can decompress files
193
                which use unsupported integrity check type, but naturally
194
                the file integrity cannot be verified in that case.
195
196
                Disabling integrity checks may remove some symbols from
197
                the liblzma ABI, so this option should be used only when
198
                it is known to not cause problems.
199
200
    --disable-assembler
201
                liblzma includes some assembler optimizations. Currently
202
                there is only assembler code for CRC32 and CRC64 for
203
                32-bit x86.
204
205
                All the assembler code in liblzma is position-independent
206
                code, which is suitable for use in shared libraries and
207
                position-independent executables. So far only i386
208
                instructions are used, but the code is optimized for i686
209
                class CPUs. If you are compiling liblzma exclusively for
210
                pre-i686 systems, you may want to disable the assembler
211
                code.
212
213
    --enable-unaligned-access
214
                Allow liblzma to use unaligned memory access for 16-bit
215
                and 32-bit loads and stores. This should be enabled only
216
                when the hardware supports this, i.e. when unaligned
217
                access is fast. Some operating system kernels emulate
218
                unaligned access, which is extremely slow. This option
219
                shouldn't be used on systems that rely on such emulation.
220
221
                Unaligned access is enabled by default on x86, x86-64,
222
                and big endian PowerPC.
223
224
    --enable-small
225
                Reduce the size of liblzma by selecting smaller but
226
                semantically equivalent version of some functions, and
227
                omit precomputed lookup tables. This option tends to
228
                make liblzma slightly slower.
229
230
                Note that while omitting the precomputed tables makes
231
                liblzma smaller on disk, the tables are still needed at
232
                run time, and need to be computed at startup. This also
233
                means that the RAM holding the tables won't be shared
234
                between applications linked against shared liblzma.
235
236
                This option doesn't modify CFLAGS to tell the compiler
237
                to optimize for size. You need to add -Os or equivalent
238
                flag(s) to CFLAGS manually.
239
240
    --enable-assume-ram=SIZE
241
                On the most common operating systems, XZ Utils is able to
242
                detect the amount of physical memory on the system. This
243
                information is used to set the default memory usage limit.
244
245
                On some systems, there is no code to detect the amount of
246
                RAM though. Using --enable-assume-ram one can set how much
247
                memory to assume on these systems. SIZE is given as MiB.
248
                The default is 32 MiB, which is probably too low for most
249
                systems, but it is enough to allow decompressing .xz files
250
                created with the default settings.
251
252
                Feel free to send patches to add support for detecting
253
                the amount of RAM on the operating system you use. See
254
                src/common/tuklib_physmem.c for details.
255
256
    --disable-threads
257
                Disable threading support. This makes some things
258
                thread-unsafe, meaning that if multithreaded application
259
                calls liblzma functions from more than one thread,
260
                something bad may happen.
261
262
                Use this option if threading support causes you trouble,
263
                or if you know that you will use liblzma only from
264
                single-threaded applications and want to avoid dependency
265
                on libpthread.
266
267
    --enable-dynamic=TYPE
268
                Specify how command line tools should be linked against
269
                liblzma. Possible TYPES:
270
271
                    yes     All command line tools are linked against
272
                            shared liblzma (if shared liblzma was built).
273
                            This is equivalent to --enable-dynamic (i.e.
274
                            no =TYPE).
275
276
                    mixed   Some tools are linked against static liblzma
277
                            and some against shared liblzma. This is the
278
                            default and recommended way.
279
280
                    no      All command line tools are linked against
281
                            static liblzma (if static liblzma was built).
282
                            This is equivalent to --disable-dynamic.
283
284
                This option is mostly useful for packagers, if distro
285
                policy requires linking against shared libaries. See the
286
                file PACKAGERS for more information about pros and cons
287
                of this option.
288
289
    --enable-debug
290
                This enables the assert() macro and possibly some other
291
                run-time consistency checks. It makes the code slower, so
292
                you normally don't want to have this enabled.
293
294
    --enable-werror
295
                If building with GCC, make all compiler warnings an error,
296
                that abort the compilation. This may help catching bugs,
297
                and should work on most systems. This has no effect on the
298
                resulting binaries.
299
300
301
3. xzgrep and other scripts
302
---------------------------
303
304
3.1. Dependencies
305
306
    POSIX shell (sh) and bunch of other standard POSIX tools are required
307
    to run the scripts. The configure script tries to find a POSIX
308
    compliant sh, but if it fails, you can force the shell by passing
309
    gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
310
    script.
311
312
    Some of the scripts require also mktemp. The original mktemp can be
313
    found from <http://www.mktemp.org/>. On GNU, most will use the mktemp
314
    program from GNU coreutils instead of the original implementation.
315
    Both mktemp versions are fine for XZ Utils (and practically for
316
    everything else too).
317
318
319
3.2. PATH
320
321
    The scripts assume that the required tools (standard POSIX utilities,
322
    mktemp, and xz) are in PATH; the scripts don't set the PATH themselves.
323
    Some people like this while some think this is a bug. Those in the
324
    latter group can easily patch the scripts before running the configure
325
    script by taking advantage of a placeholder line in the scripts.
326
327
    For example, to make the scripts prefix /usr/bin:/bin to PATH:
328
329
        perl -pi -e 's|^#SET_PATH.*$|PATH=/usr/bin:/bin:\$PATH|' \
330
                src/scripts/xz*.in
331
332
333
4. Troubleshooting
334
------------------
335
336
4.1. "No C99 compiler was found."
337
338
    You need a C99 compiler to build XZ Utils. If the configure script
339
    cannot find a C99 compiler and you think you have such a compiler
340
    installed, set the compiler command by passing CC=/path/to/c99 as
341
    an argument to the configure script.
342
343
    If you get this error even when you think your compiler supports C99,
344
    you can override the test by passing ac_cv_prog_cc_c99= as an argument
345
    to the configure script. The test for C99 compiler is not perfect (and
346
    it is not as easy to make it perfect as it sounds), so sometimes this
347
    may be needed. You will get a compile error if your compiler doesn't
348
    support enough C99.
349
350
351
4.1. "No POSIX conforming shell (sh) was found."
352
353
    xzgrep and other scripts need a shell that (roughly) conforms
354
    to POSIX. The configure script tries to find such a shell. If
355
    it fails, you can force the shell to be used by passing
356
    gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
357
    script.
358
359
360
4.2. configure works but build fails at crc32_x86.S
361
362
    The easy fix is to pass --disable-assembler to the configure script.
363
364
    The configure script determines if assembler code can be used by
365
    looking at the configure triplet; there is currently no check if
366
    the assembler code can actually actually be built. The x86 assembler
367
    code should work on x86 GNU/Linux, *BSDs, Solaris, Darwin, MinGW,
368
    Cygwin, and DJGPP. On other x86 systems, there may be problems and
369
    the assembler code may need to be disabled with the configure option.
370
371
    If you get this error when building for x86-64, you have specified or
372
    the configure script has misguessed your architecture. Pass the
373
    correct configure triplet using the --build=CPU-COMPANY-SYSTEM option
374
    (see INSTALL.generic).