INSTALL 32 KB

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