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