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