INSTALL 35 KB

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