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