INSTALL 36 KB

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