]> icculus.org git repositories - icculus/xz.git/blob - INSTALL
Change the default of --enable-assume-ram from 32 to 128 MiB.
[icculus/xz.git] / INSTALL
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. IRIX
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. IRIX
63
64     MIPSpro 7.4.4m has been reported to produce broken code if using
65     the -O2 optimization flag ("make check" fails). Using -O1 should
66     work.
67
68
69 1.2.2. Tru64
70
71     If you try to use the native C compiler on Tru64 (passing CC=cc to
72     configure), it is possible that the configure script will complain
73     that no C99 compiler was found even when the native compiler supports
74     C99. You can safely override the test for C99 compiler by passing
75     ac_cv_prog_cc_c99= as the argument to the configure script.
76
77     There's no code to detect the amount of RAM on Tru64. It can be
78     added, but I currently don't know anyone who can test on Tru64.
79     For now, you may want to pass --enable-assume-ram=SIZE to the
80     configure script. See the section 2 in this file for details.
81
82
83 1.2.3. Windows
84
85     Building XZ Utils on Windows is supported under MinGW + MSYS and
86     Cygwin. There is windows/build.sh to ease packaging XZ Utils with
87     MinGW + MSYS into a redistributable .zip or .7z file. See
88     windows/INSTALL-Windows.txt for more information.
89
90     It might be possible to build liblzma with a non-GNU toolchain too,
91     but that will probably require writing a separate makefile. Building
92     the command line tools with non-GNU toolchains will be harder than
93     building only liblzma.
94
95     Even if liblzma is built with MinGW, the resulting DLL or static
96     library can be used by other compilers and linkers, including MSVC.
97     Thus, it shouldn't be a problem to use MinGW to build liblzma even
98     if you cannot use MinGW to build the rest of your project. See
99     windows/README-Windows.txt for details.
100
101
102 1.2.4. DOS
103
104     There is an experimental Makefile in the "dos" directory to build
105     XZ Utils on DOS using DJGPP. Support for long file names (LFN) is
106     needed. See dos/README for more information.
107
108     GNU Autotools based build hasn't been tried on DOS. If you try, I
109     would like to hear if it worked.
110
111
112 1.2.5. 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 128 MiB, which allows decompressing files
249                 created with "xz -9".
250
251                 Feel free to send patches to add support for detecting
252                 the amount of RAM on the operating system you use. See
253                 src/common/tuklib_physmem.c for details.
254
255     --disable-threads
256                 Disable threading support. This makes some things
257                 thread-unsafe, meaning that if multithreaded application
258                 calls liblzma functions from more than one thread,
259                 something bad may happen.
260
261                 Use this option if threading support causes you trouble,
262                 or if you know that you will use liblzma only from
263                 single-threaded applications and want to avoid dependency
264                 on libpthread.
265
266     --enable-dynamic=TYPE
267                 Specify how command line tools should be linked against
268                 liblzma. Possible TYPES:
269
270                     yes     All command line tools are linked against
271                             shared liblzma (if shared liblzma was built).
272                             This is equivalent to --enable-dynamic (i.e.
273                             no =TYPE).
274
275                     mixed   Some tools are linked against static liblzma
276                             and some against shared liblzma. This is the
277                             default and recommended way.
278
279                     no      All command line tools are linked against
280                             static liblzma (if static liblzma was built).
281                             This is equivalent to --disable-dynamic.
282
283                 This option is mostly useful for packagers, if distro
284                 policy requires linking against shared libaries. See the
285                 file PACKAGERS for more information about pros and cons
286                 of this option.
287
288     --enable-debug
289                 This enables the assert() macro and possibly some other
290                 run-time consistency checks. It makes the code slower, so
291                 you normally don't want to have this enabled.
292
293     --enable-werror
294                 If building with GCC, make all compiler warnings an error,
295                 that abort the compilation. This may help catching bugs,
296                 and should work on most systems. This has no effect on the
297                 resulting binaries.
298
299
300 3. xzgrep and other scripts
301 ---------------------------
302
303 3.1. Dependencies
304
305     POSIX shell (sh) and bunch of other standard POSIX tools are required
306     to run the scripts. The configure script tries to find a POSIX
307     compliant sh, but if it fails, you can force the shell by passing
308     gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
309     script.
310
311     Some of the scripts require also mktemp. The original mktemp can be
312     found from <http://www.mktemp.org/>. On GNU, most will use the mktemp
313     program from GNU coreutils instead of the original implementation.
314     Both mktemp versions are fine for XZ Utils (and practically for
315     everything else too).
316
317
318 3.2. PATH
319
320     The scripts assume that the required tools (standard POSIX utilities,
321     mktemp, and xz) are in PATH; the scripts don't set the PATH themselves.
322     Some people like this while some think this is a bug. Those in the
323     latter group can easily patch the scripts before running the configure
324     script by taking advantage of a placeholder line in the scripts.
325
326     For example, to make the scripts prefix /usr/bin:/bin to PATH:
327
328         perl -pi -e 's|^#SET_PATH.*$|PATH=/usr/bin:/bin:\$PATH|' \
329                 src/scripts/xz*.in
330
331
332 4. Troubleshooting
333 ------------------
334
335 4.1. "No C99 compiler was found."
336
337     You need a C99 compiler to build XZ Utils. If the configure script
338     cannot find a C99 compiler and you think you have such a compiler
339     installed, set the compiler command by passing CC=/path/to/c99 as
340     an argument to the configure script.
341
342     If you get this error even when you think your compiler supports C99,
343     you can override the test by passing ac_cv_prog_cc_c99= as an argument
344     to the configure script. The test for C99 compiler is not perfect (and
345     it is not as easy to make it perfect as it sounds), so sometimes this
346     may be needed. You will get a compile error if your compiler doesn't
347     support enough C99.
348
349
350 4.1. "No POSIX conforming shell (sh) was found."
351
352     xzgrep and other scripts need a shell that (roughly) conforms
353     to POSIX. The configure script tries to find such a shell. If
354     it fails, you can force the shell to be used by passing
355     gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
356     script.
357
358
359 4.2. configure works but build fails at crc32_x86.S
360
361     The easy fix is to pass --disable-assembler to the configure script.
362
363     The configure script determines if assembler code can be used by
364     looking at the configure triplet; there is currently no check if
365     the assembler code can actually actually be built. The x86 assembler
366     code should work on x86 GNU/Linux, *BSDs, Solaris, Darwin, MinGW,
367     Cygwin, and DJGPP. On other x86 systems, there may be problems and
368     the assembler code may need to be disabled with the configure option.
369
370     If you get this error when building for x86-64, you have specified or
371     the configure script has misguessed your architecture. Pass the
372     correct configure triplet using the --build=CPU-COMPANY-SYSTEM option
373     (see INSTALL.generic).
374