Build: Change --enable-ifunc handling.
[xz.git] / INSTALL
blob8e26363763323a569fd4d41a0cac5f7db55bfae1
2 XZ Utils Installation
3 =====================
5     0. Preface
6     1. Supported platforms
7        1.1. Compilers
8        1.2. Platform-specific notes
9             1.2.1. AIX
10             1.2.2. IRIX
11             1.2.3. MINIX 3
12             1.2.4. OpenVMS
13             1.2.5. Solaris, OpenSolaris, and derivatives
14             1.2.6. Tru64
15             1.2.7. Windows
16             1.2.8. DOS
17             1.2.9. z/OS
18        1.3. Adding support for new platforms
19     2. configure options
20        2.1. Static vs. dynamic linking of liblzma
21        2.2. Optimizing xzdec and lzmadec
22     3. xzgrep and other scripts
23        3.1. Dependencies
24        3.2. PATH
25     4. Tests
26        4.1 Testing in parallel
27        4.2 Cross compiling
28     5. Troubleshooting
29        5.1. "No C99 compiler was found."
30        5.2. "No POSIX conforming shell (sh) was found."
31        5.3. configure works but build fails at crc32_x86.S
32        5.4. Lots of warnings about symbol visibility
33        5.5. "make check" fails
34        5.6. liblzma.so (or similar) not found when running xz
37 0. Preface
38 ----------
40     If you aren't familiar with building packages that use GNU Autotools,
41     see the file INSTALL.generic for generic instructions before reading
42     further.
44     If you are going to build a package for distribution, see also the
45     file PACKAGERS. It contains information that should help making the
46     binary packages as good as possible, but the information isn't very
47     interesting to those making local builds for private use or for use
48     in special situations like embedded systems.
51 1. Supported platforms
52 ----------------------
54     XZ Utils are developed on GNU/Linux, but they should work on many
55     POSIX-like operating systems like *BSDs and Solaris, and even on
56     a few non-POSIX operating systems.
59 1.1. Compilers
61     A C99 compiler is required to compile XZ Utils. If you use GCC, you
62     need at least version 3.x.x. GCC version 2.xx.x doesn't support some
63     C99 features used in XZ Utils source code, thus GCC 2 won't compile
64     XZ Utils.
66     XZ Utils takes advantage of some GNU C extensions when building
67     with GCC. Because these extensions are used only when building
68     with GCC, it should be possible to use any C99 compiler.
71 1.2. Platform-specific notes
73 1.2.1. AIX
75     If you use IBM XL C compiler, pass CC=xlc_r to configure. If
76     you use CC=xlc instead, you must disable threading support
77     with --disable-threads (usually not recommended).
80 1.2.2. IRIX
82     MIPSpro 7.4.4m has been reported to produce broken code if using
83     the -O2 optimization flag ("make check" fails). Using -O1 should
84     work.
86     A problem has been reported when using shared liblzma. Passing
87     --disable-shared to configure works around this. Alternatively,
88     putting "-64" to CFLAGS to build a 64-bit version might help too.
91 1.2.3. MINIX 3
93     The default install of MINIX 3 includes Amsterdam Compiler Kit (ACK),
94     which doesn't support C99. Install GCC to compile XZ Utils.
96     MINIX 3.1.8 and older have bugs in /usr/include/stdint.h, which has
97     to be patched before XZ Utils can be compiled correctly. See
98     <http://gforge.cs.vu.nl/gf/project/minix/tracker/?action=TrackerItemEdit&tracker_item_id=537>.
100     MINIX 3.2.0 and later use a different libc and aren't affected by
101     the above bug.
103     XZ Utils doesn't have code to detect the amount of physical RAM and
104     number of CPU cores on MINIX 3.
106     See section 5.4 in this file about symbol visibility warnings (you
107     may want to pass gl_cv_cc_visibility=no to configure).
110 1.2.4. OpenVMS
112     XZ Utils can be built for OpenVMS, but the build system files
113     are not included in the XZ Utils source package. The required
114     OpenVMS-specific files are maintained by Jouk Jansen and can be
115     downloaded here:
117         http://nchrem.tnw.tudelft.nl/openvms/software2.html#xzutils
120 1.2.5. Solaris, OpenSolaris, and derivatives
122     The following linker error has been reported on some x86 systems:
124         ld: fatal: relocation error: R_386_GOTOFF: ...
126     This can be worked around by passing gl_cv_cc_visibility=no
127     as an argument to the configure script.
129     test_scripts.sh in "make check" may fail if good enough tools are
130     missing from PATH (/usr/xpg4/bin or /usr/xpg6/bin). Nowadays
131     /usr/xpg4/bin is added to the script PATH by default on Solaris
132     (see --enable-path-for-scripts=PREFIX in section 2), but old xz
133     releases needed extra steps. See sections 5.5 and 3.2 for more
134     information.
137 1.2.6. Tru64
139     If you try to use the native C compiler on Tru64 (passing CC=cc to
140     configure), you may need the workaround mention in section 5.1 in
141     this file (pass also ac_cv_prog_cc_c99= to configure).
144 1.2.7. Windows
146     If it is enough to build liblzma (no command line tools):
148       - There is CMake support. It should be good enough to build
149         static liblzma or liblzma.dll with Visual Studio. The CMake
150         support may work with MinGW or MinGW-w64. Read the comment
151         in the beginning of CMakeLists.txt before running CMake!
153       - There are Visual Studio project files under the "windows"
154         directory. See windows/INSTALL-MSVC.txt. In the future the
155         project files will be removed when CMake support is good
156         enough. Thus, please test the CMake version and help fix
157         possible issues.
159     To build also the command line tools:
161       - MinGW-w64 + MSYS (32-bit and 64-bit x86): This is used
162         for building the official binary packages for Windows.
163         There is windows/build.bash to ease packaging XZ Utils with
164         MinGW(-w64) + MSYS into a redistributable .zip or .7z file.
165         See windows/INSTALL-MinGW.txt for more information.
167       - MinGW + MSYS (32-bit x86): I haven't recently tested this.
169       - Cygwin 1.7.35 and later: NOTE that using XZ Utils >= 5.2.0
170         under Cygwin older than 1.7.35 can lead to DATA LOSS! If
171         you must use an old Cygwin version, stick to XZ Utils 5.0.x
172         which is safe under older Cygwin versions. You can check
173         the Cygwin version with the command "cygcheck -V".
175     It may be possible to build liblzma with other toolchains too, but
176     that will probably require writing a separate makefile. Building
177     the command line tools with non-GNU toolchains will be harder than
178     building only liblzma.
180     Even if liblzma is built with MinGW(-w64), the resulting DLL can
181     be used by other compilers and linkers, including MSVC. See
182     windows/README-Windows.txt for details.
185 1.2.8. DOS
187     There is a Makefile in the "dos" directory to build XZ Utils on
188     DOS using DJGPP. Support for long file names (LFN) is needed at
189     build time but the resulting xz.exe works without LFN support too.
190     See dos/INSTALL.txt and dos/README.txt for more information.
193 1.2.9. z/OS
195     To build XZ Utils on z/OS UNIX System Services using xlc, pass
196     these options to the configure script: CC='xlc -qhaltonmsg=CCN3296'
197     CPPFLAS='-D_UNIX03_THREADS -D_XOPEN_SOURCE=600'. The first makes
198     xlc throw an error if a header file is missing, which is required
199     to make the tests in configure work. The CPPFLAGS are needed to
200     get pthread support (some other CPPFLAGS may work too; if there
201     are problems, try -D_UNIX95_THREADS instead of -D_UNIX03_THREADS).
203     test_scripts.sh in "make check" will fail even if the scripts
204     actually work because the test data includes compressed files
205     with US-ASCII text.
207     No other tests should fail. If test_files.sh fails, check that
208     the included .xz test files weren't affected by EBCDIC conversion.
210     XZ Utils doesn't have code to detect the amount of physical RAM and
211     number of CPU cores on z/OS.
214 1.3. Adding support for new platforms
216     If you have written patches to make XZ Utils to work on previously
217     unsupported platform, please send the patches to me! I will consider
218     including them to the official version. It's nice to minimize the
219     need of third-party patching.
221     One exception: Don't request or send patches to change the whole
222     source package to C89. I find C99 substantially nicer to write and
223     maintain. However, the public library headers must be in C89 to
224     avoid frustrating those who maintain programs, which are strictly
225     in C89 or C++.
228 2. configure options
229 --------------------
231     In most cases, the defaults are what you want. Many of the options
232     below are useful only when building a size-optimized version of
233     liblzma or command line tools.
235     --enable-encoders=LIST
236     --disable-encoders
237                 Specify a comma-separated LIST of filter encoders to
238                 build. See "./configure --help" for exact list of
239                 available filter encoders. The default is to build all
240                 supported encoders.
242                 If LIST is empty or --disable-encoders is used, no filter
243                 encoders will be built and also the code shared between
244                 encoders will be omitted.
246                 Disabling encoders will remove some symbols from the
247                 liblzma ABI, so this option should be used only when it
248                 is known to not cause problems.
250     --enable-decoders=LIST
251     --disable-decoders
252                 This is like --enable-encoders but for decoders. The
253                 default is to build all supported decoders.
255     --enable-match-finders=LIST
256                 liblzma includes two categories of match finders:
257                 hash chains and binary trees. Hash chains (hc3 and hc4)
258                 are quite fast but they don't provide the best compression
259                 ratio. Binary trees (bt2, bt3 and bt4) give excellent
260                 compression ratio, but they are slower and need more
261                 memory than hash chains.
263                 You need to enable at least one match finder to build the
264                 LZMA1 or LZMA2 filter encoders. Usually hash chains are
265                 used only in the fast mode, while binary trees are used to
266                 when the best compression ratio is wanted.
268                 The default is to build all the match finders if LZMA1
269                 or LZMA2 filter encoders are being built.
271     --enable-checks=LIST
272                 liblzma support multiple integrity checks. CRC32 is
273                 mandatory, and cannot be omitted. See "./configure --help"
274                 for exact list of available integrity check types.
276                 liblzma and the command line tools can decompress files
277                 which use unsupported integrity check type, but naturally
278                 the file integrity cannot be verified in that case.
280                 Disabling integrity checks may remove some symbols from
281                 the liblzma ABI, so this option should be used only when
282                 it is known to not cause problems.
284     --enable-external-sha256
285                 Try to use SHA-256 code from the operating system libc
286                 or similar base system libraries. This doesn't try to
287                 use OpenSSL or libgcrypt or such libraries.
289                 The reasons to use this option:
291                   - It makes liblzma slightly smaller.
293                   - It might improve SHA-256 speed if the implementation
294                     in the operating is very good (but see below).
296                 External SHA-256 is disabled by default for two reasons:
298                   - On some operating systems the symbol names of the
299                     SHA-256 functions conflict with OpenSSL's libcrypto.
300                     This causes weird problems such as decompression
301                     errors if an application is linked against both
302                     liblzma and libcrypto. This problem affects at least
303                     FreeBSD 10 and older and MINIX 3.3.0 and older, but
304                     other OSes that provide a function "SHA256_Init" might
305                     also be affected. FreeBSD 11 has the problem fixed.
306                     NetBSD had the problem but it was fixed it in 2009
307                     already. OpenBSD uses "SHA256Init" and thus never had
308                     a conflict with libcrypto.
310                   - The SHA-256 code in liblzma is faster than the SHA-256
311                     code provided by some operating systems. If you are
312                     curious, build two copies of xz (internal and external
313                     SHA-256) and compare the decompression (xz --test)
314                     times:
316                         dd if=/dev/zero bs=1024k count=1024 \
317                             | xz -v -0 -Csha256 > foo.xz
318                         time xz --test foo.xz
320     --disable-microlzma
321                 Don't build MicroLZMA encoder and decoder. This omits
322                 lzma_microlzma_encoder() and lzma_microlzma_decoder()
323                 API functions from liblzma. These functions are needed
324                 by specific applications only. They were written for
325                 erofs-utils but they may be used by others too.
327     --disable-lzip-decoder
328                 Disable decompression support for .lz (lzip) files.
329                 This omits the API function lzma_lzip_decoder() from
330                 liblzma and .lz support from the xz tool.
332     --disable-xz
333     --disable-xzdec
334     --disable-lzmadec
335     --disable-lzmainfo
336                 Don't build and install the command line tool mentioned
337                 in the option name.
339                 NOTE: Disabling xz will skip some tests in "make check".
341                 NOTE: If xzdec is disabled and lzmadec is left enabled,
342                 a dangling man page symlink lzmadec.1 -> xzdec.1 is
343                 created.
345     --disable-lzma-links
346                 Don't create symlinks for LZMA Utils compatibility.
347                 This includes lzma, unlzma, and lzcat. If scripts are
348                 installed, also lzdiff, lzcmp, lzgrep, lzegrep, lzfgrep,
349                 lzmore, and lzless will be omitted if this option is used.
351     --disable-scripts
352                 Don't install the scripts xzdiff, xzgrep, xzmore, xzless,
353                 and their symlinks.
355     --disable-doc
356                 Don't install the documentation files to $docdir
357                 (often /usr/doc/xz or /usr/local/doc/xz). Man pages
358                 will still be installed. The $docdir can be changed
359                 with --docdir=DIR.
361     --disable-assembler
362                 liblzma includes some assembler optimizations. Currently
363                 there is only assembler code for CRC32 and CRC64 for
364                 32-bit x86.
366                 All the assembler code in liblzma is position-independent
367                 code, which is suitable for use in shared libraries and
368                 position-independent executables. So far only i386
369                 instructions are used, but the code is optimized for i686
370                 class CPUs. If you are compiling liblzma exclusively for
371                 pre-i686 systems, you may want to disable the assembler
372                 code.
374     --disable-clmul-crc
375                 Disable the use carryless multiplication for CRC
376                 calculation even if compiler support for it is detected.
377                 The code uses runtime detection of SSSE3, SSE4.1, and
378                 CLMUL instructions on x86. On 32-bit x86 this currently
379                 is used only if --disable-assembler is used (this might
380                 be fixed in the future). The code works on E2K too.
382                 If using compiler options that unconditionally allow the
383                 required extensions (-msse4.1 -mpclmul) then runtime
384                 detection isn't used and the generic code is omitted.
386     --disable-ifunc
387                 Disable the use of __attribute__((__ifunc__())) for
388                 function dispatching even if support is detected.
390                 The ifunc attribute is incompatible with
391                 -fsanitize=address so it may need to be disabled in
392                 debug builds with extra instrumentation.
394     --enable-unaligned-access
395                 Allow liblzma to use unaligned memory access for 16-bit,
396                 32-bit, and 64-bit loads and stores. This should be
397                 enabled only when the hardware supports this, that is,
398                 when unaligned access is fast. Some operating system
399                 kernels emulate unaligned access, which is extremely
400                 slow. This option shouldn't be used on systems that
401                 rely on such emulation.
403                 Unaligned access is enabled by default on these:
404                   - 32-bit x86
405                   - 64-bit x86-64
406                   - 32-bit big endian PowerPC
407                   - 64-bit big endian PowerPC
408                   - 64-bit little endian PowerPC
409                   - some RISC-V [1]
410                   - some 32-bit ARM [2]
411                   - some 64-bit ARM64 [2] (NOTE: Autodetection bug
412                     if using GCC -mstrict-align, see below.)
414                 [1] Unaligned access is enabled by default if
415                     configure sees that the C compiler
416                     #defines __riscv_misaligned_fast.
418                 [2] Unaligned access is enabled by default if
419                     configure sees that the C compiler
420                     #defines __ARM_FEATURE_UNALIGNED:
422                       - ARMv7 + GCC or Clang: It works. The options
423                         -munaligned-access and -mno-unaligned-access
424                         affect this macro correctly.
426                       - ARM64 + Clang: It works. The options
427                         -munaligned-access, -mno-unaligned-access,
428                         and -mstrict-align affect this macro correctly.
429                         Clang >= 17 supports -mno-strict-align too.
431                       - ARM64 + GCC: It partially works. The macro
432                         is always #defined by GCC versions at least
433                         up to 13.2, even when using -mstrict-align.
434                         If building for strict-align ARM64, the
435                         configure option --disable-unaligned-access
436                         should be used if using a GCC version that has
437                         this issue because otherwise the performance
438                         may be degraded. It likely won't crash due to
439                         how unaligned access is done in the C code.
441     --enable-unsafe-type-punning
442                 This enables use of code like
444                     uint8_t *buf8 = ...;
445                     *(uint32_t *)buf8 = ...;
447                 which violates strict aliasing rules and may result
448                 in broken code. There should be no need to use this
449                 option with recent GCC or Clang versions on any
450                 arch as just as fast code can be generated in a safe
451                 way too (using __builtin_assume_aligned + memcpy).
453                 However, this option might improve performance in some
454                 other cases, especially with old compilers (for example,
455                 GCC 3 and early 4.x on x86, GCC < 6 on ARMv6 and ARMv7).
457     --enable-small
458                 Reduce the size of liblzma by selecting smaller but
459                 semantically equivalent version of some functions, and
460                 omit precomputed lookup tables. This option tends to
461                 make liblzma slightly slower.
463                 Note that while omitting the precomputed tables makes
464                 liblzma smaller on disk, the tables are still needed at
465                 run time, and need to be computed at startup. This also
466                 means that the RAM holding the tables won't be shared
467                 between applications linked against shared liblzma.
469                 This option doesn't modify CFLAGS to tell the compiler
470                 to optimize for size. You need to add -Os or equivalent
471                 flag(s) to CFLAGS manually.
473     --enable-assume-ram=SIZE
474                 On the most common operating systems, XZ Utils is able to
475                 detect the amount of physical memory on the system. This
476                 information is used by the options --memlimit-compress,
477                 --memlimit-decompress, and --memlimit when setting the
478                 limit to a percentage of total RAM.
480                 On some systems, there is no code to detect the amount of
481                 RAM though. Using --enable-assume-ram one can set how much
482                 memory to assume on these systems. SIZE is given as MiB.
483                 The default is 128 MiB.
485                 Feel free to send patches to add support for detecting
486                 the amount of RAM on the operating system you use. See
487                 src/common/tuklib_physmem.c for details.
489     --enable-threads=METHOD
490                 Threading support is enabled by default so normally there
491                 is no need to specify this option.
493                 Supported values for METHOD:
495                         yes     Autodetect the threading method. If none
496                                 is found, configure will give an error.
498                         posix   Use POSIX pthreads. This is the default
499                                 except on Windows outside Cygwin.
501                         win95   Use Windows 95 compatible threads. This
502                                 is compatible with Windows XP and later
503                                 too. This is the default for 32-bit x86
504                                 Windows builds. Unless the compiler
505                                 supports __attribute__((__constructor__)),
506                                 the 'win95' threading is incompatible with
507                                 --enable-small.
509                         vista   Use Windows Vista compatible threads. The
510                                 resulting binaries won't run on Windows XP
511                                 or older. This is the default for Windows
512                                 excluding 32-bit x86 builds (that is, on
513                                 x86-64 the default is 'vista').
515                         no      Disable threading support. This is the
516                                 same as using --disable-threads.
517                                 NOTE: If combined with --enable-small
518                                 and the compiler doesn't support
519                                 __attribute__((__constructor__)), the
520                                 resulting liblzma won't be thread safe,
521                                 that is, if a multi-threaded application
522                                 calls any liblzma functions from more than
523                                 one thread, something bad may happen.
525     --enable-sandbox=METHOD
526                 There is limited sandboxing support in the xz tool. If
527                 built with sandbox support, it's used automatically when
528                 (de)compressing exactly one file to standard output and
529                 the options --files or --files0 weren't used. This is a
530                 common use case, for example, (de)compressing .tar.xz
531                 files via GNU tar. The sandbox is also used for
532                 single-file 'xz --test' or 'xz --list'.
534                 Supported METHODs:
536                         auto    Look for a supported sandboxing method
537                                 and use it if found. If no method is
538                                 found, then sandboxing isn't used.
539                                 This is the default.
541                         no      Disable sandboxing support.
543                         capsicum
544                                 Use Capsicum (FreeBSD >= 10.2) for
545                                 sandboxing. If no Capsicum support
546                                 is found, configure will give an error.
548                         pledge  Use pledge(2) (OpenBSD >= 5.9) for
549                                 sandboxing. If pledge(2) isn't found,
550                                 configure will give an error.
552                         landlock
553                                 Use Landlock (Linux >= 5.13) for
554                                 sandboxing. If no Landlock support
555                                 is found, configure will give an error.
557     --enable-symbol-versions
558                 Use symbol versioning for liblzma. This is enabled by
559                 default on GNU/Linux, other GNU-based systems, and
560                 FreeBSD.
562     --enable-debug
563                 This enables the assert() macro and possibly some other
564                 run-time consistency checks. It makes the code slower, so
565                 you normally don't want to have this enabled.
567     --enable-werror
568                 If building with GCC, make all compiler warnings an error,
569                 that abort the compilation. This may help catching bugs,
570                 and should work on most systems. This has no effect on the
571                 resulting binaries.
573     --enable-path-for-scripts=PREFIX
574                 If PREFIX isn't empty, PATH=PREFIX:$PATH will be set in
575                 the beginning of the scripts (xzgrep and others).
576                 The default is empty except on Solaris the default is
577                 /usr/xpg4/bin.
579                 This can be useful if the default PATH doesn't contain
580                 modern POSIX tools (as can be the case on Solaris) or if
581                 one wants to ensure that the correct xz binary is in the
582                 PATH for the scripts. Note that the latter use can break
583                 "make check" if the prefixed PATH causes a wrong xz binary
584                 (other than the one that was just built) to be used.
586                 Older xz releases support a different method for setting
587                 the PATH for the scripts. It is described in section 3.2
588                 and is supported in this xz version too.
591 2.1. Static vs. dynamic linking of liblzma
593     On 32-bit x86, linking against static liblzma can give a minor
594     speed improvement. Static libraries on x86 are usually compiled as
595     position-dependent code (non-PIC) and shared libraries are built as
596     position-independent code (PIC). PIC wastes one register, which can
597     make the code slightly slower compared to a non-PIC version. (Note
598     that this doesn't apply to x86-64.)
600     If you want to link xz against static liblzma, the simplest way
601     is to pass --disable-shared to configure. If you want also shared
602     liblzma, run configure again and run "make install" only for
603     src/liblzma.
606 2.2. Optimizing xzdec and lzmadec
608     xzdec and lzmadec are intended to be relatively small instead of
609     optimizing for the best speed. Thus, it is a good idea to build
610     xzdec and lzmadec separately:
612       - To link the tools against static liblzma, pass --disable-shared
613         to configure.
615       - To select somewhat size-optimized variant of some things in
616         liblzma, pass --enable-small to configure.
618       - Tell the compiler to optimize for size instead of speed.
619         For example, with GCC, put -Os into CFLAGS.
621       - xzdec and lzmadec will never use multithreading capabilities of
622         liblzma. You can avoid dependency on libpthread by passing
623         --disable-threads to configure.
625       - There are and will be no translated messages for xzdec and
626         lzmadec, so it is fine to pass also --disable-nls to configure.
628       - Only decoder code is needed, so you can speed up the build
629         slightly by passing --disable-encoders to configure. This
630         shouldn't affect the final size of the executables though,
631         because the linker is able to omit the encoder code anyway.
633     If you have no use for xzdec or lzmadec, you can disable them with
634     --disable-xzdec and --disable-lzmadec.
637 3. xzgrep and other scripts
638 ---------------------------
640 3.1. Dependencies
642     POSIX shell (sh) and bunch of other standard POSIX tools are required
643     to run the scripts. The configure script tries to find a POSIX
644     compliant sh, but if it fails, you can force the shell by passing
645     gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
646     script.
648     xzdiff (xzcmp/lzdiff/lzcmp) may use mktemp if it is available. As
649     a fallback xzdiff will use mkdir to securely create a temporary
650     directory. Having mktemp available is still recommended since the
651     mkdir fallback method isn't as robust as mktemp is. The original
652     mktemp can be found from <https://www.mktemp.org/>. On GNU, most will
653     use the mktemp program from GNU coreutils instead of the original
654     implementation. Both mktemp versions are fine.
656     In addition to using xz to decompress .xz files, xzgrep and xzdiff
657     use gzip, bzip2, and lzop to support .gz, bz2, and .lzo files.
660 3.2. PATH
662     The method described below is supported by older xz releases.
663     It is supported by the current version too, but the newer
664     --enable-path-for-scripts=PREFIX described in section 2 may be
665     more convenient.
667     The scripts assume that the required tools (standard POSIX utilities,
668     mktemp, and xz) are in PATH; the scripts don't set the PATH themselves
669     (except as described for --enable-path-for-scripts=PREFIX). Some
670     people like this while some think this is a bug. Those in the latter
671     group can easily patch the scripts before running the configure script
672     by taking advantage of a placeholder line in the scripts.
674     For example, to make the scripts prefix /usr/bin:/bin to PATH:
676         perl -pi -e 's|^#SET_PATH.*$|PATH=/usr/bin:/bin:\$PATH|' \
677                 src/scripts/xz*.in
680 4. Tests
681 --------
683     The test framework can be built and run by executing "make check" in
684     the build directory. The tests are a mix of executables and POSIX
685     shell scripts (sh). All tests should pass if the default configuration
686     is used. Disabling features through the configure options may cause
687     some tests to be skipped. If any tests do not pass, see section 5.5.
690 4.1. Testing in parallel
692     The tests can be run in parallel using the "-j" make option on systems
693     that support it. For instance, "make -j4 check" will run up to four
694     tests simultaneously.
697 4.2. Cross compiling
699     The tests can be built without running them:
701         make check TESTS=
703     The TESTS variable is the list of tests you wish to run. Leaving it
704     empty will compile the tests without running any.
706     If the tests are copied to a target machine to execute, the test data
707     files in the directory tests/files must also be copied. The tests
708     search for the data files using the environment variable $srcdir,
709     expecting to find the data files under $srcdir/files/. If $srcdir
710     isn't set then it defaults to the current directory.
712     The shell script tests can be copied from the source directory to the
713     target machine to execute. In addition to the test files, these tests
714     will expect the following relative file paths to execute properly:
716         ./create_compress_files
717         ../config.h
718         ../src/xz/xz
719         ../src/xzdec/xzdec
720         ../src/scripts/xzdiff
721         ../src/scripts/xzgrep
724 5. Troubleshooting
725 ------------------
727 5.1. "No C99 compiler was found."
729     You need a C99 compiler to build XZ Utils. If the configure script
730     cannot find a C99 compiler and you think you have such a compiler
731     installed, set the compiler command by passing CC=/path/to/c99 as
732     an argument to the configure script.
734     If you get this error even when you think your compiler supports C99,
735     you can override the test by passing ac_cv_prog_cc_c99= as an argument
736     to the configure script. The test for C99 compiler is not perfect (and
737     it is not as easy to make it perfect as it sounds), so sometimes this
738     may be needed. You will get a compile error if your compiler doesn't
739     support enough C99.
742 5.2. "No POSIX conforming shell (sh) was found."
744     xzgrep and other scripts need a shell that (roughly) conforms
745     to POSIX. The configure script tries to find such a shell. If
746     it fails, you can force the shell to be used by passing
747     gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
748     script. Alternatively you can omit the installation of scripts and
749     this error by passing --disable-scripts to configure.
752 5.3. configure works but build fails at crc32_x86.S
754     The easy fix is to pass --disable-assembler to the configure script.
756     The configure script determines if assembler code can be used by
757     looking at the configure triplet; there is currently no check if
758     the assembler code can actually actually be built. The x86 assembler
759     code should work on x86 GNU/Linux, *BSDs, Solaris, Darwin, MinGW,
760     Cygwin, and DJGPP. On other x86 systems, there may be problems and
761     the assembler code may need to be disabled with the configure option.
763     If you get this error when building for x86-64, you have specified or
764     the configure script has misguessed your architecture. Pass the
765     correct configure triplet using the --build=CPU-COMPANY-SYSTEM option
766     (see INSTALL.generic).
769 5.4. Lots of warnings about symbol visibility
771     On some systems where symbol visibility isn't supported, GCC may
772     still accept the visibility options and attributes, which will make
773     configure think that visibility is supported. This will result in
774     many compiler warnings. You can avoid the warnings by forcing the
775     visibility support off by passing gl_cv_cc_visibility=no as an
776     argument to the configure script. This has no effect on the
777     resulting binaries, but fewer warnings looks nicer and may allow
778     using --enable-werror.
781 5.5. "make check" fails
783     If the other tests pass but test_scripts.sh fails, then the problem
784     is in the scripts in src/scripts. Comparing the contents of
785     tests/xzgrep_test_output to tests/xzgrep_expected_output might
786     give a good idea about problems in xzgrep. One possibility is that
787     some tools are missing from the current PATH or the tools lack
788     support for some POSIX features. This can happen at least on
789     Solaris where the tools in /bin may be ancient but good enough
790     tools are available in /usr/xpg4/bin or /usr/xpg6/bin. For possible
791     fixes, see --enable-path-for-scripts=PREFIX in section 2 and the
792     older alternative method described in section 3.2 of this file.
794     If tests other than test_scripts.sh fail, a likely reason is that
795     libtool links the test programs against an installed version of
796     liblzma instead of the version that was just built. This is
797     obviously a bug which seems to happen on some platforms.
798     A workaround is to uninstall the old liblzma versions first.
800     If the problem isn't any of those described above, then it's likely
801     a bug in XZ Utils or in the compiler. See the platform-specific
802     notes in this file for possible known problems. Please report
803     a bug if you cannot solve the problem. See README for contact
804     information.
807 5.6. liblzma.so (or similar) not found when running xz
809     If you installed the package with "make install" and get an error
810     about liblzma.so (or a similarly named file) being missing, try
811     running "ldconfig" to update the run-time linker cache (if your
812     operating system has such a command).